Compared to StackOverflow, where you basically can post code snippets and ask questions about them, this community seems to require more or less the entire document to be posted. Why so, is it the nature of TeX, that have way too much in global scope, or is it just a different policy on this site?
7 Answers
Just to make an example, look at europecv stack exceeding which cannot be answered in the current form, as
\documentclass{europecv}
\usepackage[T1]{fontenc}
\usepackage[magyar]{babel}
\begin{document}
x
\end{document}
gives no error whatsoever.
In the .../tex/latex
subtree of TeX Live there are currently 2066 directories, which correspond to more than 2000 packages. A question about a problem depending on one of these packages must, at least, mention what package is necessary. Also knowing the document class is often needed, because some classes redefine some commands such as \title
, \maketitle
or \chapter
: think to memoir
that introduces a second optional argument for \chapter
and the other sectional commands; instead, scrbook
introduces a key-value syntax for the same set of commands.
Not to mention that some packages are pairwise incompatible, or should be loaded in a particular order with respect to others. Knowing the list of needed packages is therefore essential in most cases. Another case that comes to mind is that of a tikzpicture
that uses features only available in additional libraries: these should be mentioned. Playing hide and seek is fun, but limits the chances to get an answer.
Consider that adding a suitable document preamble around a code snippet that doesn't mention the necessary class/packages requires a non-trivial effort from people trying to help: in several cases it's really impossible to prepare an answer, if information is insufficient.
It's not really different from C snippets that depend on unspecified libraries and I'm quite sure that such questions would be fast closed on StackOverflow.
This doesn't mean posting the entire document, but only a “compilable abridged version” that exhibits the issue, particularly when errors or unexpected output is concerned. It often happens that trying to make the MWE helps the questioner in pinpointing the problem.
-
6Perhaps also note that to get a snippet to run requires (for LaTeX/ConTeXt) a non-trivial amount of effort from people trying to answer?– Joseph Wright ModAug 16, 2015 at 20:39
-
6@JosephWright And a non-trivial amount of knowledge! In some cases, I've answered questions involving packages I've never used because the MWE let me figure out the problem. Without the required preamble, I'd have had no clue how
\somemacroiveneverheardofbefore
was defined or in which of the thousands of files in my installation (or not) it might lurk.– cfrAug 17, 2015 at 0:20 -
"t's not really different from C snippets that depend on unspecified libraries and I'm quite sure that such questions would be fast closed on StackOverflow." There are tags for that. I am pretty sure I do not have to include a main function on SO. But indeed things may become horrible in C when there are a lot of macros. LaTeX may benefit from separate translation units. Then there would not be that hard to figure out what the problem is. Aug 17, 2015 at 12:58
-
1The example question mentioned the
hungarian
option and theeuropecv
environment. Adding it gives that error. For convenience, I added the MWE for reproducing to my answer there.– Stefan Kottwitz ModAug 17, 2015 at 13:19 -
8@user877329: Ultimately you're here (on SE) to ask for help. The onus rests on your shoulders to spoon-feed your audience with as much detail as possible. This includes showing some effort on your part of what you may have tried. I've seen plenty of "it doesn't work" in my time, only to make up some small code and "it works". When you ask a question, put yourself in the shoes of someone else and use that as a frame of reference. Never assume that "[it] would not be that hard to figure out what the problem is". If that's the case, then you might as well figure out the problem yourself, yes?– Werner ModAug 17, 2015 at 14:47
-
@werner "Never assume that "[it] would not be that hard to figure out what the problem is". If that's the case, then you might as well figure out the problem yourself, yes?" - the user likely means for experts, from the perspective of a newcomer, so I don't think 'figure out the problem yourself,yes?' is relevant.– LauaAug 17, 2015 at 16:36
Another very important thing to note is language, as in written language. LaTeX uses easy-readable commands in plain english, this is great but not my point.
Here at TeX.SX are people of many many nations helping each other. Describing a problem in words can be very hard in a different language, espeacially when a special nomentclature is in use. I have seen the word title in many questions, some meant the real title which is set with \title
, some meant the page header, some meant the chapter title.
Imagine to be in a different country and your car breaks down without speaking the language. It will be very hard for you to explain to a mechanic what is wrong with the car, even more if your own knowledge of cars is limited and you don't know how the parts are called. Drag the mechanic to the car and use your finger to point.
Most LaTeX problems are purely mechanical as well. As you cannot drag us in front of your computer, and sending us a complete document isn't possible, boiling down the document (i.e. pointing with the finger) is an efficient way to get quick and personalized help.
-
My problem is that I do not know how to pointing with the figure. So all I can do I give you what I want TeX to produce. Aug 17, 2015 at 13:38
Some remarks about the "global scope" in the question: Yes LaTeX (not TeX) needs quite some global code. You can't compile
hello world
It gives the error
! LaTeX Error: Missing \begin{document}.
And adding only a document environment doesn't work either
\begin{document}
hello world
\end{document}
gives the error
! LaTeX Error: The font size command \normalsize is not defined:
there is probably something wrong with the class file.
So in most cases when I investigate a LaTeX problem -- may it be to find the cause of an error or to add some feature -- I work with complete documents and this means that a good question should contain all needed parts to create a complete document as test suite with as less fuss as possible. Such complete documents can be quite small, but there have been cases where a large graphic, or a large data file for a plot, or some other large file was either really necessary or couldn't be removed easily.
The effort to produce a minimal working example, in my case, almost always results in a solution and prevents me from posting a question on the site. Not that we want to discourage questions, but there is a lot you can do to debug a problem before you ask for help, and the MWE encourages that.
-
11since one of the goals of this site is to encourage learning, i'd say that the effect is precisely the desired one. even so, if the question you would have posted before you found the solution is one you think would help someone else in the future, then post it anyhow, and give a "self answer" after a day or so. Aug 19, 2015 at 16:27
-
@barbarabeeton, this might not always be useful. When the above happened to me, it was very often that I discovered some totally idiotic mistake on my part.– vonbrandAug 21, 2015 at 13:56
-
4@vonbrand -- true enough (it happens to all of us), but sometimes the problem is one that is particularly elusive, or uncovers a bug, and in those cases it can be useful to make the result public. use judgment. Aug 21, 2015 at 14:18
Another reason why minimal examples are often required (meaning "necessary to solve the problem" not "mandated by the site") is that errors in TeX are notoriously cryptic and the line number at which an error arises may be very far away from the actual source of the error. So, for example, someone gets an error and the posts the fragment of code that the log reports the error occurred at. But depending on the error, this fragment may be completely fine, but happens to be the first place at which the error state arises.
And new LaTeX users are particularly susceptible to this problem, since if they bother to read the log file at all, they would expect it to be helpful.
See ! Paragraph ended before \@optionaltemp was complete for a very concrete example of this problem along with a detailed explanation.
Because in TeX, unlike other programming languages, the entire document to reproduce the problem is hardly ever longer than 30 lines long. And typing that much shouldn't be seen as a burden to get an answer from the community that is known to be very fast to respond already.
And most of the times, you find out the problem yourself while creating the minimal document because there is not enough places to escape (either package clash or wrong macro expansion order etc.).
Lastly specific to TeX and friends, the problems can be environment-aware that is, a particular preamble setup can cause errors in an otherwise perfectly viable document (document class quirks, package options and so on).
-
-
@vonbrand Starbucks coding is what I would say thanks to all Mac using hipsters every morning I see around.– percusseAug 21, 2015 at 15:03
Code snippets are sufficient when we are talking about TeX. We can show only the problem in pair lines and relevant macros.
But problem is that most of questions here are not about TeX itself, but about LaTeX. And LaTeX brings a huge number of problems mentioned here by other posters.
x