15

Would it be off-topic to have a question where people can showcase good preambles for some specific purpose (like assignments, books, lecture notes, letters, articles etc.)? I am thinking about a topic like Showcase of beautiful typography done in TeX & friends, but where you can show off concrete preambles that are useful for this and that particular purpose (obviously, we would need different questions for each purpose). I am not thinking about a topic like Best practice on organising your preamble, which is more concerned with the theory of overall preamble design. Also, What packages do people load by default in LaTeX? is not what I am thinking of either, since it is for showcasing individual packages, not full preambles. There is currently (as far as I can see) no topic here that matches my suggestion, which might be because it would be considered opinion-based.

I expect a lot of comments arguing that it is impossible to create one preamble that solves all problems, that it is better if people sit down and learn TeX themselves and find out which packages they need. The reality is that many people never learn to write proper TeX at all, precisely because they are left alone in the vast jungle of classes and packages, many of which are obsolete, poorly written, unnecessary, do not work together, or break core functionality. Furthermore, there is an equally outdated collection of manuals on the Internet that promote bad coding practice and wrong solutions. As a result, a lot of people get started on TeX by taking over preambles from others, which are filled with precisely the mentioned kind of packages. For instance, I have found LaTeX preambles on the Internet that still use \documentstyle.

In my opinion, a lot of people would benefit from a topic on this page that showed up-to-date, well-written and well-documented preambles, created and maintained by some of the TeX oracles in here. They cannot and should not contain solutions to all problems, but should include the standard packages that many people will need in this particular situation. The usual Stack Exchange voting system would naturally regulate such a topic, the best preambles coming out on top.

43
  • 3
    As far as I have been taught on TeX-SX, putting information as showcase online makes people even lazier hence for the sanity of future generations I really don't want to have yet another source of confusion. For proof, see the LaTeX wiki. As much as I usually take the side of the newcomers, I would be the first to admit that people are lazy. If they just read this site for an hour about the packages they have been using since the last two decades we wouldn't have your second paragraph. One particular example on TeXample.net and we had at least 20 questions about it here.
    – percusse
    Sep 25, 2015 at 22:16
  • 1
    For your examples, if people switch to Lua- or Xe- they should drop the fontenc, inputenc and switch to fontspec also microtype causes problems in certain cases. babel works but polyglossia sometimes a better choice. What about mathtools instead of amsmath. Even the location where you place hyperref is an art. Hence, it is not that straightforward to say this is an ideal preamble and works under every condition. It will work only specific to that particular preamble.
    – percusse
    Sep 26, 2015 at 9:04
  • 3
    mathtools loads amsmath already so you don't need to load it. See what I mean?
    – percusse
    Sep 26, 2015 at 9:24
  • 4
    Impossible, should not be done. i can't express how mnuch i am against this idea. Taking into account all that is to be thought of, the answer will have an incredible amount of information; the wall of confusion. Who is to climb that wall?
    – Johannes_B
    Sep 26, 2015 at 9:28
  • 2
    I have seen documents don't need amsmath, nor siunitx, nor any other package. Nor any other package.
    – Johannes_B
    Sep 26, 2015 at 9:30
  • 3
    Ask your indian friends about the old colonial school system. Some might indeed prefer a world without schools. The point is that we have the de facto position of TeX related best-pratice source. When something appears here it will be picked up by some and if it works for their initial four five documents they will use it for life. And that is exactly what happened years ago and that's why you have your second paragraph.
    – percusse
    Sep 26, 2015 at 10:27
  • 7
    @Gaussler -- no, you should not load both amsmath and mathtools. mathtools loads amsmath, and if you want to add an option to amsmath (such as fleqn), and you happen to load amsmath after mathtools, you won't get the result you expect. if you're a newbie, that can be extremely confusing. what is needed instead, is a good tutorial on how to load packages -- what they do, which are interrelated, and what is the benefit of a over b. oh, what is really needed are users who read documentation and don't expect to find ready-made preambles. Sep 26, 2015 at 16:38
  • 1
    It might not be off-topic. But I don't think it is a good idea. A collection such as this will just run risk of becoming one of the pages where people go and copy and paste a preamble without thinking about it. The problem with that approach is that just because people have a preamble that doesn't mean they know what to do with it. People might load cleveref with all its bells and whistles and still write see equation (4) in Theorem 3 out by hand. So a skilfully crafted preamble (percusse is absolutely right, writing one is an art) is not the solution to the problem.
    – moewe
    Sep 27, 2015 at 7:08
  • 5
    Additionally, you would have to create lots of "example preambles" for all sorts of different applications. I firmly believe that loading a package just for the sake of (loading) it, and then not using it, is counter-productive to say the least. You probably shouldn't load pgfplots if you don't need to plot anything, and if you don't write maths you probably don't need mathtools. Another problem is that sometimes (often) there are more packages for one job, and an in-depth discussion about the (dis)advantages is needed to decide which one to use.
    – moewe
    Sep 27, 2015 at 7:13
  • 1
    I think it is a bad idea to branch in the preamble with \ifluatex, if that is what you suggested above (I'm not entirely sure). A user should understand the preamble and every line should actually do something. You run the risk of amassing a huge preamble with all sort of logic and branching that it hard to suss out. Finally, I would like to repeat the point of my first comment: Just because you load a package that doesn't mean you know how to use it. An example preamble would need to also come with a showcase document that shows how you use all the fancy stuff you have requested.
    – moewe
    Sep 29, 2015 at 5:16
  • 2
    My main point is not the amount of work, though I admit that that also plays into it: I would expect these preambles to be maintained properly. My main point is more that people who blindly copy and paste ignore comments in the preamble or don't read everything. In some cases you will need very long comments to explain the use of a package as well as viable alternatives and known incompatibilities. This will bloat the preamble and might discourage people from reading the comments. They will end up with a huge preamble using only a fraction of the features they could use.
    – moewe
    Sep 29, 2015 at 9:18
  • 3
    I think that one should only load packages one needs. As such the loading of each package ought to be a conscious decision. If you simply dump packages into your preamble you are probably not going to know if you need all of them; chances are you don't even know if your document would look any different if you removed anything. I'm all for questions directed at novices such as "I need to add a bibliography to my document, what do I need to do?" if the answers explain different ways and highlight (dis)advantages of the approaches. But I'm against covering users in packages.
    – moewe
    Sep 29, 2015 at 9:27
  • 2
    @cfr For the record, the boxes hyperref shows in the pdf are not printed. ;-)
    – Johannes_B
    Sep 29, 2015 at 14:20
  • 2
    I have thought a pretty lot above this issue, it started quite a while ago. Get a cup of tea and a silent environment and let your brain do all the work. Won't take long till you notice you are turning in circles. It is just impossible to make this approach properly. You need to learn how to drive a bike before driving a bike. Same for nuclear power plants, you need to know how to run it. You even have to learn how to hold a hammer properly. Be aware of what you are doing. Learn stuff.
    – Johannes_B
    Sep 29, 2015 at 14:23
  • 2
    I suspect none of the best TeXnicians in the world have a preamble "template" that they rely on. I certainly have a "system" in terms of how I generally load packages, probably similar to the "best practice" question you linked to. A philosophy about how to load seems more useful than a list for 30+ different templates for people to unthinkingly copy. As for package loading itself, there's this pexperimental package](ctan.org/pkg/pkgloader?lang=en) that you might find interesting.
    – jon
    Oct 3, 2015 at 3:26

3 Answers 3

27

Such a question would be clearly on topic but should be closed for other reasons (too broad) or (opinion based). This is generally true of any such "showcase" question (despite the fact that one or two have been left to stand).

But aside from general concerns about showcase questions, suggesting preambles would be a really bad idea. One of the more common problems we see is people just collecting ever larger preambles loading packages they don't need, specifying packages multiple times, and generally accumulating complexity and fragility for no gain. We see this even in the suggested preamble in the comments under the question, where specifying both amsmath and mathtools just slows things down at best and potentially causes errors if either of them is specified with package options.

A beginner should simply start with

\documentclass{article}
\begin{document}
\end{document}

and add packages or change the document class if they need some feature.

I think any list of "off the shelf" preambles would just promote bad practice.

16
  • 2
    For monoglot English contexts, maybe. But if somebody is immediately going to try writing about gwdihŵs in Y Tŷ Gwyn, then it is not going to work out very well.
    – cfr
    Sep 29, 2015 at 0:14
  • 4
    @cfr yes exactly! but a high voted preamble answer that has \userpackage[welsh]{babel} isn't going to work out too well if it gets block copied into lots of German documents. People should start out small and add what they need, not start with everything and remove things when they get weird package interactions. Sep 29, 2015 at 7:03
  • 1
    On the contrary, I think a preamble template should always load babel (at least if it is for pdfTeX) and have language information in the options of \documentstyle. A comment should then indicate something like "Here you choose the main language of the document". In an example preamble I distribute at my university, I load first English and then Danish, with a comment saying very clearly that the last language will be the main language of the document. I think I managed to avoid confusion.
    – Gaussler
    Sep 29, 2015 at 8:09
  • Also, I think I would advise people to start with memoir instead of article.
    – Gaussler
    Sep 29, 2015 at 8:10
  • 4
    @Gaussler memoir is a good class but people should realise they are using a non standard class and use it once they are familiar with the basics. Some would suggest Koma classes, to which same answer applies. A beginner is best to stick to a standard class, so the experience matches documentation such as the latex book, and the syntax and available commands match what commonly available in journal submission classes, rather than starting with a big class like memoir and then having to learn what you can not do in other contexts. Sep 29, 2015 at 8:34
  • 3
    @Gaussler posting templates with comments saying how they should be adjusted simply does not work if you put \usepacakge[danish]{babel}% specify the main language of the document then people will copy exactly that. The whole point of such a template is for people to copy it without reading documentation, so you can not be surprised if that is what they do, Witness the number of final documents that load lipsum package , or use the [draft] option and or other bits of code only ever intended to be in an example. Sep 29, 2015 at 8:37
  • Oh, I agree. I only really meant that even this non-preamble is only going to work in some cases. If you're teaching this in a certain context, you can give them the necessary Babel bit for that context. But that won't work here because there is no shared linguistic context.
    – cfr
    Sep 29, 2015 at 13:09
  • 2
    @Gaussler If you are telling them about options to pass \documentstyle then you are definitely telling them wrong!
    – cfr
    Sep 29, 2015 at 13:10
  • @cfr You got me there. I assume you know what I meant. ;-)
    – Gaussler
    Sep 29, 2015 at 13:12
  • 3
    s/really/really super awful mega/ This alone -- this concept of the 'inherited preamble' -- is the number one reason those not 'in the know' seem to hold TeX in contempt. Showcasing such a practice would not only normalize it further, but promote it. Sep 29, 2015 at 16:46
  • 1
    @SeanAllred I learnt LaTeX from a book. I didn't even know what a preamble was to ask anybody for one ;). In retrospect, maybe ignorance did me a favour: I knew so little about it, it didn't even occur to me to seek this kind of thing. I just followed the instructions in the book. (I knew one person using it who told me that I didn't want to learn it and shouldn't try.)
    – cfr
    Sep 29, 2015 at 18:24
  • 1
    @SeanAllred As far as I agree about the good words, the reality is that people already get started on TeX by taking over bad preambles from others. Even if it were better if everyone started from scratch, this is not going to happen no matter what we do. The only way I can see to counter this bad tendency is to provide new users with better templates.
    – Gaussler
    Sep 29, 2015 at 18:38
  • 2
    "templates" -- There's that word! That infernal word! Even if that were the case, the SE platform would not be the place for such a terrible trove. We shouldn't spend time working on something that would damage the community. Rather, we should spend time developing good, visible, and ever-current learning materials for newcomers. Sep 29, 2015 at 18:53
  • Where is @barbara? How did this start off of its own? This is amazing. #FascinatedUserInFrontOfTheScreen
    – Johannes_B
    Sep 29, 2015 at 19:00
  • @Johannes_B -- barbara has been trying to get some work done. she has two days in which to clear off old (but still valuable) stuff from a machine that will soon be unplugged, before it's lost forever. (includes the archives of pre-1990 tugboat.) this discussion is making her head spin! Sep 29, 2015 at 20:42
11

Allow me to contribute a few concrete examples of hidden gems of preamble art

Beamer not compiling presentation properly

Sharelatex 'swallows' 80 pages of my work when compiling pdf

Using 'caption' package with 'thesis' class - undefined control sequence

Thesis class error Extra } or forgotten \endgroup on second compile (not first) in float caption

and many many more (please keep adding if you remember more)


Instead have a look at this old question which is kind of what you might have in mind and see the answers gently saying noooooooooo, doooon't dooo thisssssss

Good LaTeX preambles for math thesis

3
  • 2
    +1 For your second example which loads the lipsum package, since that should only be used for example dummy text and not in a real document. Sep 29, 2015 at 22:12
  • @AndrewCashner Ever looked into the turabian class? ctan.org/tex-archive/macros/latex/contrib/turabian
    – Johannes_B
    Oct 2, 2015 at 15:18
  • I don't see why it shouldn't have lipsum loaded. The point I tried to make is how ridiculously haphazard it is. @Johannes_B You are developing an unhealthy dislike to templates. They are not all evil. ;)
    – percusse
    Oct 2, 2015 at 15:21
5

Actually, all showcase questions are off-topic. Citing the help center:

To prevent your question from being flagged and possibly removed, avoid asking subjective questions where …

  • every answer is equally valid: “What’s your favorite ______?”

I understand that the view of this community is slightly different and we tend to twist the rules, in sake of usefulness. I can understand how exhaustive lists of all possible (useful) answers is useful, like in 1 2 3 4 5. However, these are not showcase questions, and while voting can be subjective on them, there are attempts to make the available information objective, for instance by creating a template for the answers, as in 1. The idea of a showcase being helpful seems at least weird to me, as they can hardly be objective.

9
  • 3
    But then we do tolerate the big-list questions, of which some (especially highly-voted and -viewed ones) also fit this bill. I for one would be sad to see any of those go. In the light of this "double standard" retreating to "the rules", seems a bit like cheating here.
    – moewe
    Sep 28, 2015 at 7:27
  • @moewe I know about this. It is unfortunate. The problem is, only very few of these IMHO carry any value. I also voted to close many of them.
    – yo'
    Sep 28, 2015 at 17:17
  • I think many of these questions are actually very useful (even if they deviate from the normal Q&A scheme a bit). Given that apparently the general consensus is that we decide on a case-by-case basis whether such a question is valuable, I think there more important point here is to discuss whether a showcase of preambles is "valuable" (whatever that may mean). You are correct if we talk about the rules, but de facto other things seem to play into the discussion as well.
    – moewe
    Sep 28, 2015 at 17:23
  • 1
    @moewe My opinion is that this one would be completely useless. Of the big-list questions, it's not the showcases that are useful, it's the exhaustive lists that are: Editors/IDEs, books, math alphabets, document classes.
    – yo'
    Sep 28, 2015 at 17:26
  • 1
    I actually quite like the showcases as well. Although I agree that of "hard value" are probably only the questions you mention. I also agree that a "showcase of preambles" especially as Gaussler seems to imagine and intend it to work is not useful (and maybe even counterproductive or outright dangerous).
    – moewe
    Sep 28, 2015 at 17:30
  • @moewe I tried to make the answer more clear about the point of "big-list" vs. "showcase".
    – yo'
    Sep 28, 2015 at 17:33
  • 1
    Up to a point I agree with you there as well. Answers to showcase questions can't be objectively judged. Still, for nice (maybe not useful, but nice and beautiful) results such as Showcase of beautiful typography done in TeX & friends I'm willing to risk a bit of hypocrisy on my stance on this topic. For a preamble showcase, on the other hand, I'm all for applying the rule rigorously, for reasons see the discussion below the question above.
    – moewe
    Sep 28, 2015 at 17:40
  • 7
    @moewe A dose of hypocrisy a day, keeps the SO mods away :P
    – percusse
    Sep 28, 2015 at 18:39
  • 4
    @moewe -- "dangerous" is the operative word here. although not life-threatening, inappropriate preambles can be very expensive, especially when submitted for publication to an organization that takes its editorial function seriously. and that raises the costs for everybody; higher production costs engender higher subscription costs (or lowered quality, or, even worse, both). it's sometimes enough to make one cry. Sep 28, 2015 at 19:16

You must log in to answer this question.

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