I am wondering about a question which is closely related to the question with almost identical title: Editing Minimal Working Examples (MWEs), in which the focus was on the minimizing part. More precisely, the discussion was whether or not it is OK to kick out unrelated things such as unnecessary packages.

I am mainly wondering about the "working" part. Specifically,

Is it OK to make a non-working MWE working?

Obviously, I am not thinking about questions of the type "why does that code not work?". Rather, I am wondering whether it is OK to add the document preamble and cure obvious mistakes like a missing semicolon at the end of a TikZ path, say.

I can see reasons why one might consider making the code compilable: more users may play with it because the threshold is lower, and hence a btter answer may emerge.

On the other hand, there are good reasons not to do it. In the worst case, one may introduce errors. Or one may just upset others by loading packages that are not essential and so on.

Clearly, this is only a very partial list of pros and cons, and the purpose of this question is to inquire the opinion of the community on this. (I plan not to accept an answer, rather votes should give an impression how the majority feels, and I really would like to collect all pros and cons.)

I'd leave the code as it was posted by the OP.

If you add \documentclass{article} and then you find out that the OP is using \documentclass{beamer}, for example, the answer could differ.

I'd correct only the formatting issues (new users don't often use the {} button) and leave a comment asking the OP to add a complete MWE.

Tricky question! In most cases I agree with @CarLaTeX's answer and would leave it to the OP. However I also see the good intention to give other users working code as some starting point for working on an answer.

As a compromise maybe one could use a strategy I already saw a couple of times on the main site: Leave the code from the questions as it is and add the working code at the end of the post clearly marked as edit by user @xyz.

This could be used in cases where the preamble etc. is simply missing.

Example:

This is the original question

    with code fragments

which are not compilable


Edit by @xyz to include a working example

\documentclass{article}

\begin{document}

code fragment

\end{document}

  • 13
    i'd go along with this answer if the document class has been identified by the op in a comment and the context makes sense. but without that information, it becomes a different question, which really doesn't help. – barbara beeton Jun 24 at 16:39
  • 3
    I think this adds further to the "just do it for me" mentality. And while I understand people who like to answer those questions (which tend to be drawing related), I'm not sure we should get people used to having their questions improved in this way. – Alan Munn Jun 25 at 15:44

In almost all cases I just leave a comment suggesting that the OP fixes the example however sometimes I edit the question.

For edits I think it's important to distinguish why the example isn't working/complete.

  1. The posted example was never tested and has typos that suggest it wasn't used to generate the output or error described.

    In this case I'd just leave a comment to the OP to fix the example.

  2. The posted example looks like it is a fragment of a working example that produced the output or error, but the OP has (un)helpfully trimmed it for posting.

    Here, for new users I may just add the missing preamble and \end{document} and leave a comment that the example has been completed to help people test answers.

    But generally (and for not so new users) I'd just leave a comment, or perhaps not comment and answer anyway, depending.

  3. The question is in fact quite tricky and the OP has had genuine difficulty to isolate the problem in order to generate an example.

    Here (especially if I don't have a good answer to hand) I may add an example with a heading saying it's been added as shown in samcarter's example.

You must log in to answer this question.

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