MathOverflow is a question and answer site for professional mathematicians. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have never learned how to use Latex properly. Whenever writing a paper, I use hacks to override behavior of the underlying template. What would be an intermediate to advanced book on learning how to use Latex to create style files and how to use it most efficiently? The book would ideally help one to get rid of bad habits when using Latex.

share|cite|improve this question

closed as off-topic by quid, Emil Jeřábek, Alain Valette, Karl Schwede, Todd Trimble Jan 21 '15 at 15:18

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question does not appear to be about research level mathematics within the scope defined in the help center." – Alain Valette, Karl Schwede
If this question can be reworded to fit the rules in the help center, please edit the question.

I think this question may be off-topic because it is about LaTeX in a rather general way. This used to be considered as somewhat on-topic early on, but since the existence of TeX - LaTeX is not anymore. – user9072 Jan 21 '15 at 14:23
You can also consult this distant cousin of MathOverflow – Tony Huynh Jan 21 '15 at 14:27

15 Answers 15

Preface: I think most people don't learn LaTeX "properly"; they're happy enough to be able to get their documents to look about right with a relatively small amount of effort. There is nothing wrong with that. Being a good mathematician and being a LaTeX wizard have little to do with each other. That said, I really like obsessing over typesetting.

As far as books, I would recommend is you read The TeXbook. You shouldn't be using raw TeX unless you have a good reason to do so, so you might think this book is useless to a LaTeX user, but remember that LaTeX runs on TeX. I find it extremely helpful to understand how the underlying TeX engine works. Also, Knuth is extremely pleasant and stimulating reading (for a mathematician at least). For LaTeX proper, I think The LaTeX Companion is a pretty standard reference; it's nice to read sections on things you're interested in, but I certainly wouldn't recommend reading it like a novel

More important than reading any book, you should become interested in what happens to your documents. You probably already deal with LaTeX errors to get your documents to compile, but you should also investigate LaTeX warnings. A large chunk of my LaTeX knowledge has been acquired while tracking down and eliminating warnings. The nice thing here is that you often get some insight into why something should be done a particular way. For example, if you hack something together to get the job done, you'll often get a warning from the compiler, and in tracking down that warning, you'll likely learn the right way to do it and what was wrong with your hack. For this part of your LaTeX education, this TeX FAQ is very helpful. In particular, I highly recommend learning about the \show command, which allows you to deconstruct macros and understand how they work.

share|cite|improve this answer

One of my first year undergraduate professors put me onto this: The Not So Short Introduction to LaTeX.

I haven't had the need to typeset anything serious yet (I'm only an undergraduate), but I found it was a good place to start.

share|cite|improve this answer
That's where I first learned about it. – Akhil Mathew Dec 11 '09 at 0:27

The book Math Into LaTex, and the newer edition More Math Into LaTeX, by George Grätzer is a good intermediate/advanced reference to LaTeX.

You can also follow his series "What's New in LaTeX" the Notices of the AMS, in the January, May and August issues of this year.

share|cite|improve this answer

I've found l2tabu to be a very useful guide to avoiding bad habits. Yes, it's occasionally over-dramatic - one of its sections is entitled "Deadly Sins"! - but it does provide good reasons for all the taboos it lists.

But it does only cover sins of LaTeX coding, and not sins of bad typography. I tend to work on the principle that TeX and LaTeX were designed by people who know much more about typography than I ever will, so there's probably a good reason for the default settings. Thus, if in doubt, leave it alone.

That advice probably applies to the question of whether or not to create style files: unless you're creating a whole load of documents which you want to look identical in style, creating a style file only reduces the portability of your document, since you have to remember to include the extra file when you transfer it, etc., etc..

But, if you are writing style files, or class files (which are rather harder to get right!), Appendix A of the LaTeX Companion is exactly what you need, though if it gets complicated you might want to refer to the TeXbook when you need native TeX commands.

Finally, if you come to make pretty pictures and don't want to have to include EPS files and cart them around with the document, the LaTeX Graphics Companion tells you a million and one ways to get lovely diagrams with just a few lines of code; xy is particularly useful for commutative diagrams, though I mainly use pstricks for basically every kind of diagram anyone ever needs.

share|cite|improve this answer

For graphics, the Tikz & PGF manual ( ) was extremely helpful. It's very readable and does a great job balancing useful examples with explanations of the general philosophy of the packages.

For pure examples, I like .

share|cite|improve this answer

I think it was Lamport who that the three most common mistakes in using LaTeX were: 1. Worrying too much about format, and not enough about content. 2. Worrying too much about format, and not enough about content. 3. Worrying too much about format, and not enough about content.

If you're just starting out, I agree strongly with the recommendation in favour of Grätzer's "More Math in LaTeX". I have found Grätzer more useful than Kopka and Daley, but a beginner might rank them the other way around. Lamport's book on LaTeX is dated and Knuth's TeXbook does serve as a good example over-indexing a book. Eventually (when you come to write a book or a thesis) you will probably need to refer to the "LaTeX Companion".

For your figures, use tikz and pgf.

If you want to try something different there is ConTeXt, this is built on plain TeX (for which Seroul's "A Beginner's Book of TEX" provides a good introduction). Since most publishers will insist on a LaTeX input file, your chances to use ConTeXt might be limited. :-(

share|cite|improve this answer

Of course it depends what those bad habits are. Sometimes people's bad habits involve trying to do things traditional typesetters or designers would never do - for example, setting very narrow margins. I would recommend reading a bit about the craft of typesetting in the traditional sense and reading about the ideas of traditional style design. The TeXBook is a good source for references.

Sometimes bad habits in LaTeX involve hard-coding things like theorems instead of using environments, for example, \textbf{Theorem 1} {\it This is my theorem.}

However, it doesn't sound like your bad habits are of this nature. Maybe you should give us some examples of the kind of bad habits you have in mind.

share|cite|improve this answer

I'm surprised that no one has mentioned the American Mathematical Society's Short Math Guide for LaTeX.

share|cite|improve this answer

The absolutely standard place to start is "LaTeX: A Document Preparation System" by Leslie Lamport, the original author of the LaTeX macros on top of TeX.

When I started my PhD, I asked if I could borrow my supervisors copy. He said yes, but that I should get my own. He was right.

It is extremely accessible and well written. Given the higher technical nature, it is quite compact, and seriously manages to say exactly what you need, in a form that allows you to find it easily.

I've tried to use online books etc when I've been without my copy. They aren't even nearly as useful.

share|cite|improve this answer

I like A Guide to LaTeX by Kopka and Daly. (Much better than Lamport's book, in my opinion.) If you want to tweak things, then definitely read The TeXBook by Knuth.

share|cite|improve this answer

I have found with LaTeX life is much easier if you don't fight the template. The defaults are surprisingly sane, and trying to work around them is a headache. Mind, I've never been a wizard with it. You can do some amazing work once you dig deep enough.

share|cite|improve this answer

I've learned a lot from G. Grätzer, "Math into LaTeX". The first part is a walkthrough on how to write a document the right way (from start to finish). In the appendices, more advanced techniques are explained (redefining commands). It also features the AMS packages and many more (for instance, fancyhdr).

share|cite|improve this answer

By Grätzer there's also his First Steps in LaTeX. See also this list.

share|cite|improve this answer

I am resurrecting this eight months old thread to post hopefully useful link to a small write up about TeX resources I did for GSU guys

share|cite|improve this answer
More like 18+ months. You might check for other MathOverflow questions regarding online resources, as well as one users site (MathOnLine? Andrea Feretti? Apologies in advance for any mistakes.) for other places to publish a link. Gerhard "Email Me About System Design" Paseman, 2011.06.24 – Gerhard Paseman Jun 24 '11 at 22:18
Actually, I posted this answer 10 months ago. I just updated the link. – Predrag Punosevac Jun 24 '11 at 22:31
My stupid. Thanks for your maintenance efforts. Gerhard "Apologize Before Saying Something Stupid" Paseman, 2011.06.29 – Gerhard Paseman Jun 29 '11 at 7:10

You might try to take a look at this free ebook::


share|cite|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.