3

I just asked a question in which I included a small excerpt of my code that wasn't a standalone example, but enough to see the context (at least I thought so). In a comment*, I was asked to provide a "minimum working example" - I thought that was what I did?

I realize there is a difference between a few lines of code and a fully working example, and that it's not always possible to find the problem with just a small part of the entire code - but is it reasonable (or relevant) to force every question to be accompanied by a fully working example? Or is that threshold to high?


Update in response to some of the answers:
The reason I'm asking this question is not because I don't see the benefit of a MWE. However, I have experienced (or so it feels) a lean towards not even looking at the problem if there is no MWE posted with it. This, I feel, is an unwanted development, since it puts a very high threshold for newcommers to the community on their first posts.

There is apparently not always a need for a full working example when discussing many other programming languages (see for example the original SO community where many questions are asked and answered with no more than a couple of lines of code).

The discussion we need to take here is: is this relevant for the TeX family as well? I can see a point in the fact that there are so many packages and compilers that no code (at least not from the preamble) is really irrelevant.

So, is a MWE more or less required for the question to be well posed, or does that set a too high threshold for newcomers?


*) There was a few typos in the original post. Was it just those that caused that comment, or was my example too small even with those corrected?

5
  • 1
    And you still haven't added a MWE. Surely doing so would have taken less time than writing this question.
    – TH.
    Sep 28, 2010 at 7:04
  • @TH: Sure, that is possible. However, the reason I'm asking this question here is not because I want that specific question answered without having to compile a MWE, but rather to find out what the community really thinks in this matter, and what we should expect from each other in the future as well. So far, I seem to be out of sync with the community in what I think is reasonable, which is yet another reason to bring up a more general discussion here. Please do not lock on to that specific case. Sep 28, 2010 at 7:56
  • 4
    Ok, let me try to answer the general case: Assuming that someone knows that the community would like to see an MWE, and he knows how to prepare an MWE, then yes absolutely he should post an MWE. Sep 28, 2010 at 8:55
  • @Jukka: The question I'm posing here is related to your first assumption - would the community like to see an MWE in every case, or is that overkill? Sep 28, 2010 at 13:52
  • No, not every case. This question doesn't need one. But questions of the form "Why doesn't it work when I do X?" or "Where did this space in this output come from?" or really anything dealing with a specific instance often need a MWE. Questions like, "Should I use subfig or subfigure?" don't (for the most part).
    – TH.
    Sep 28, 2010 at 22:19

4 Answers 4

8

Incidentally, I think that this is a very good question. Those of us who've been around the site for a while have learnt the value of MWEs, but we could probably be a little gentler on saying "Please provide a MWE". Perhaps, "This question looks interesting, but to be able to help you I need to have some code that I can just cut-and-paste to see the problem. Otherwise, it's hard to know even where to start."

MindCorrosive's first point is a very important one: people who answer questions are doing so from their own time and own resources with no real thought of reward (other than to make this a great site from which they will, hopefully, benefit). So when you ask a question, you are asking someone to do your work for you. That's the point of the site, so that is not meant as a disincentive to asking a question, but is intended as guidance on why we ask for questions to be as detailed and complete as possible.

Take, for example, this question on MO. There's no context, no background, no motivation. Why should I even try to understand the question, let alone provide an answer? Contrast that with this one. It's not much longer, but explains the context and background and shows what led the person to ask the question.

So we encourage MWEs because it makes it easier to answer the question, and experience has taught us that questions with MWEs get better and quicker answers than those without.

To answer your point about SO, the inhabitants of SO are, by and large, people whose jobs involve programming. If I'm typical of the users here, then this is not true here. I think I know a bit about LaTeX and some of the things, but it's not directly part of my job so often the things I've found out are as a result of just tinkering. So if you want me (and people like me) to help you, you need to phrase your question in such a way that I can look at it using that method: just tinkering. An MWE is the simplest way to do it.

Despite that, I wouldn't go so far as to require a MWE, and perhaps the "standard" way of saying "Please provide a MWE" could be a little gentler.

11

As you have seen from the answer to your question, the "relevant context" is not the same for you and for the person who tried to help you. Minimal examples are needed for two main reasons, one psycological, and one technical:

  • Saves time for people to see the result from the code provided, and hopefully, the problem. If you don't include a fully compile-able excerpt, then not many people would have the incentive to fill in the missing bits to have it compiled and examined. This is a courtesy to the others, since all people here are donating from their free time to contribute. Besides, this lowers the barrier of entry for people to give it a shot -- if I see a full example, I can simply copy/paste it quickly before I've even examined it, just to see what happens, and proceed to debug it from there.
  • And second, but not less important, the technical reason -- there are many TeX distributions and packages, each with their quirks and idiosyn-crazy-es. Most of the time it's important what other packages are you using, which compiler do you use (latex, pdfLaTeX, XeTeX, or something completely different), and so on. Narrowing down the problem to a small portion of the code helps a lot in debugging. This is an important principle in software testing as well.

And when people ask for "minimum working example", they mean an example that can be compiled without modifications. That is -- add the relevant preamble stuff, narrow down the packages that seem to be the problem, etc. Most of the times preparing a minimum example will actually help you see the problem for yourself.

4

As you can see from Geoffrey Jones's answer, most likely the problem is elsewhere, not in the particular code fragment that you have included in your question.

If you had provided a minimum working example, I guess your problem would have been by now already solved.

4

I think the short answer is: No, you don't have to provide a minimal working example. In fact, I think most of the questions in the site do not provide such examples (just have a look around). But if people trying to answer your question are asking you to provide a MWE is, most likely, because they weren't able to answer your question without you giving them more details and that's what a MWE is good for.

You must log in to answer this question.

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