Take the 2-minute tour ×
MathOverflow is a question and answer site for professional mathematicians. It's 100% free, no registration required.

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|improve this question
add comment

14 Answers 14

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|improve this answer
add comment

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|improve this answer
    
That's where I first learned about it. –  Akhil Mathew Dec 11 '09 at 0:27
add comment

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|improve this answer
add comment

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|improve this answer
add comment

For graphics, the Tikz & PGF manual ( http://tug.ctan.org/tex-archive/graphics/pgf/base/doc/generic/pgf/pgfmanual.pdf ) 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 http://texample.net .

share|improve this answer
add comment

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|improve this answer
add comment

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|improve this answer
add comment

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

share|improve this answer
add comment

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.

http://www.amazon.com/LaTeX-Document-Preparation-System-2nd/dp/0201529831

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|improve this answer
add comment

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|improve this answer
add comment

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|improve this answer
add comment

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|improve this answer
add comment

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

share|improve this answer
add comment

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

http://predrag.freeshell.org/SciCG/resources/tex.html

share|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
3  
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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