We had a situation today regarding this question. (See also the timeline).

What happened:

  1. The submitter asked a question with a code excerpt only, without making a compileable minimum working example (MWE).
  2. The question was edited and some fluff was added to illustrate the problem (full disclosure: it was me who did the code edit changes).
  3. Someone added an answer based on the MWE.
  4. Turned out that the proposed solution was breaking other things (that the OP didn't mention, so the real document had to be referenced via a link to figure out what's really the problem).
  5. A completely different solution was offered that solved the issue the submitter had.

If the submitter had made an effort to create a MWE the extra work could have been averted (I apologize to Martin Scharrer for the time he had to spend on this).

Now the question is:

Should incomplete code be edited in the question for the benefit of the user (and potential responders), or should this be the sole responsibility of the original poster?

I see a few pros and cons for editing user's code:


  • Most of the time it works, and everybody's happy.
  • The edit might be just what's needed to attract some quick replies, as the code can be copied and compiled without modification.
  • No time is lost in back-and-forth communication between the OP and the potential editor.
  • No duplicate posts (there has been a similar situation recently, when a new user didn't notice they can edit their own posts, and created a duplicate, which was promptly closed).


  • When it doesn't work, this results in some extra effort to people trying to solve the wrong problem.
  • Time is lost when figuring out what's actually wrong, which could have been averted if the OP was asked to provide a MWE by themselves.
  • Original submitter might be frustrated that people meddle with their stuff, playing "smart guy" (although with good intentions).

Personally, I think the extra editing helps in most of the cases, but when it fails, it does spectacularly.

Other opinions?

Edit: It seems most think that it shouldn't be done in general, or if done, should be careful and clarified. Although I reserve a somewhat dissenting opinion, I understand the arguments of everybody, and will refrain from such editing in the future.


In my opinion this depends a lot on the question. In many cases, making the code compilable is really helpful, but I think it should only be done in really obvious cases. In the case in question, the answer depended a lot on the context; then one should better ask the OP to complete the code.


Usually I do not think that it is helpful to add to a MWE. Wasting the time of people answering the question based on wrong information is worse than slowing down the answering progress by requesting a complete MWE. There are so many ways to produces bad/wrong TeX code that it is generally impossible to say what the OP has done. Additionally, there are often more than one package that implement a certain command.

(Note that subtracting from code in the question is often fine, as long as it stays a WE (and gets closer to a minimal one).)


I'd say that there is a difference between completing code to a MWE and adding a MWE. In the first case, the original code is hidden but in the second it is still there. For example (although it doesn't qualify as a MWE), I added something to PDF inclusion: found PDF version <1.5>, but at most version <1. 4> allowed to try to reproduce the error. I think that that was helpful, but the original post is still clearly visible and it is clear what I've added, so that if someone answers then they will know (and be able to say) whether or not they are answering the original question or the modified version.

  • Actually, your (well-intentioned) edit has discouraged me from answering that question. You've muddied the issue by bringing in a slightly different angle from the initial questioner, meaning that I would have to write a much more elaborate answer, carefully distinguishing the two cases, and aimed at both you (who understands some subtleties) and the OP (who misspells pdftex primitives and doesn't know where the log file is). I don't feel inclined to write such an answer at the moment (given the question remains open it seems like nobody else does either: if it remains so, I may answer later). – Lev Bishop Mar 4 '11 at 17:03
  • @Lev: I'd hope that if my edit wasn't helpful then someone would be able to ignore it. Maybe I should have made it clearer that I was only trying to be helpful and that I wasn't bothered by the particular problem so I'm not waiting with baited breath on the answer. (On the other hand, it doesn't seem that the OP is waiting either.) I didn't edit immediately and it did seem that no-one was able/willing to help with the question as it stood. – Loop Space Mar 4 '11 at 21:14
  • Fair enough. I suspect the situation would be roughly the same whether you edited or not, since the OP is not clarifying either way. Anyway, I commented on your part of the question. – Lev Bishop Mar 4 '11 at 21:25

(Full disclosure: It was me who approved @Martin Tapankov's code edit changes. I did this only after spending a few minutes to check that [besides the also missing document environment] only packages were added that were necessary to create a MWE.)

Even if the later discussion revealed that the MWE-based answer broke other things in the questioner's real-world document, Martin's efforts sped up unearthing the actual problem and were -- in my opinion -- a valuable service for the questioner and the community.

  • Well, I disagree with "sped up unearthing the actual problem". Maybe that's shameless, but I claim that I unearthed the actual problem with my very first comment to the question. – Hendrik Vogt Mar 3 '11 at 18:41
  • @Hendrik: You may well be right. And though I skimmed the question in its original form, I should have checked its state when the edit notification popped up instead of only checking @Martin Tapankov's MWE edits (and thereby missing your comment). – lockstep Mar 3 '11 at 19:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .