367

The most common mistake is spending too long on TeX coding and not getting the document written.


348

Marc van Dongen gave a great answer. I'll throw in another reason: \it and \bf do not play well together. That is, they do not nest as one would intuitively expect: Whereas \textit and \textbf do play well together: This is nice. However, you may notice that it still fails to handle nested style adjustments to small caps, since the Computer Modern fonts ...


187

I think this is a job for cases from the amsmath package \documentclass{article} \usepackage{amsmath} \begin{document} \[ f(x)= \begin{cases} \frac{x^2-x}{x},& \text{if } x\geq 1\\ 0, & \text{otherwise} \end{cases} \] \end{document} or if you would prefer a displaystyle fraction, then you could use dcases from the ...


186

Here are some common, non-esoteric mistakes I help people fix on a regular basis: Ending each and every paragraph in the document with \\ (or even \\[10pt]) instead of a blank line. Ignoring warnings and errors until there's hundreds of them, and the new material isn't getting typeset at all. "Why can't I format my file? I have to finish chapter 2 by ...


167

\par is a TeX primitive and is the same as a blank line (except in special environments such as verbatim where the usual rules don't apply). It ends horizontal mode, causes TeX to break the horizontal text into lines placed on the current vertical list, and exercises the page breaker which may possibly cause the next page to be shipped out. \\ is different ...


122

Someone on pgf-users list writes to T Tantau : I suggest keeping the old syntax, \tikzstyle{my style}=[some options,...] since it is much easier to read and understand. The new syntax would be for the more "advanced" users and library writers. Answer of Till Tantau : I'm a bit undecided on this. First, for compatibility reasons \tikzstyle ...


108

TL;DR: ' is a shorthand for ^{\prime}. ' is defined in latex.ltx as active math character: \def\active@math@prime{^\bgroup\prim@s} {\catcode`\'=\active \global\let'\active@math@prime} \def\prim@s{% \prime\futurelet\@let@token\pr@m@s} \def\pr@m@s{% \ifx'\@let@token \expandafter\pr@@@s \else \ifx^\@let@token \expandafter\expandafter\...


100

Here's a list of possibly obsolete packages and classes, and recommendable successors. It's not intended as a judgement – it's supposed to help in choosing packages or checking preambles. Readers can make their own decision based on the package documentation of the compared packages. Obsolete package(s): Recommended successor(s) a4, a4wide, anysize: ...


95

When is it better to use \operatorname (or its wrapper \DeclareMathOperator) instead of \mathop? The answer is easy: always, unless you know precisely what's the behavior of \mathop. First of all, one must of course recall that \operatorname and \DeclareMathOperator are provided by the amsopn package, which is automatically loaded by amsmath, but is also ...


94

If you want to see how things can get tangled in a preamble have a look at the preamble of the Comprehensive LaTeX Symbol List. It might not be exactly spaghetti code but it can certainly be classified as code soup! So you right, you need to have a strategy and start working on it early in the development of your document. The tips below are from my own ...


84

First of all: never use \include to load a file with personal definitions and packages to use. The choice is thus between \input and \usepackage; for the first it's better to use the extension .tex for the file, for the second .sty is mandatory. What are the pros of the latter solution? Many. For instance you can define options that can change the behavior ...


80

The minimal class doesn't define size changing commands, so any example that relies on them won't work. It doesn't set \parindent, nor many other useful parameters, among which \tabcolsep: tabular environments will not show properly. The "really minimal" class for typesetting purposes is article. As David Carlisle and Joseph Wright remark, the minimal ...


78

Not making enough use -- or (sadly all too frequently) not making hardly any use -- of the opportunities afforded by LaTeX to separate the content of a document from its visual appearance. In particular, too many attempts to engage in visual formatting at early to intermediate stages of writing a working paper, a technical note, or whatever. Addendum: The ...


77

Allow me to give an answer in the form of a practical anecdote: When I wrote my PhD dissertation in chemistry, each chapter had either been published in or was soon to be submitted to a peer-reviewed journal. Each chapter was written at a different time over the course of several years, and of course each journal had its own standards as to whether there ...


76

\bmod is designed for mod used as a binary op.


74

TeXies have a good chance of recognizing TeXed documents, especially if Computer Modern (or Latin Modern) is used. But assuming you want to convert Word-users and other heathens, figuratively speaking, you could use a colophon, a "brief description of publication or production notes relevant to the edition, in modern books usually located at the reverse of ...


74

You can write to the aux file with \write\@auxout{hello} or \immediate\write\@auxout{hello2} or \protected@write\@auxout{}{hello3} Depending on requirements. \immediate\write writes to the specified file at that point, expanding the supplied tokens (like \edef) so fragile commands will do the wrong thing. \write does not write at that point it puts a ...


73

Sorry, no, that is not true. Most journals do accept reasonable shortcuts: \newcommand*\NN{\mathbb{N}} % natural numbers \newcommand*\AAA{\mathcal{A}} % automaton \newcommand*\WWW{\mathring{W}^2_1} % Sobolev space 2,1,o \newcommand*\defined[1]{\emph{#1}} % used for defining new terms \DeclarePairedDelimiter\abs{\lvert}{\rvert} % proper absolute value ... ...


71

DONT Read tutorials that advise best practices from the stone age. Especially german LaTeX tutorials advise something like this in the preamble: \usepackage[latin9]{inputenc} \usepackage[T1]{fontenc} Then i see a lot of people that are writing umlauts like this: \"u. Please forget this! DO In times of UTF8 use \usepackage[utf8]{inputenc} and you're done....


66

Two objections come to mind: If you don't know you will be entering math mode, then you may write something "semantically" correct that breaks. For example: \documentclass{article} \newcommand\mathmacro[1][A]{\ensuremath{{#1}_1}} \begin{document} \mathmacro[$x^2$] % The dollar signs *leave* math mode \end{document} What's going on here is that \...


66

TikZ and its underlying engine PGF have a powerful built-in module pgfkeys. It can also be used as a standalone package (via \usepackage{pgfkeys}) to manipulate options for other purposes. No matter which command is used, therefore, every defined option goes to some instruction in the form of \pgfkeys{/key family/key/.subkey = {value list} } Since TikZ ...


66

You can certainly load both the varioref and the cleveref with hyperref provided that you load them in the following order \usepackage{varioref} \usepackage{hyperref} \usepackage{cleveref} They all play very nicely together. The varioref and cleveref weren't around when I did my thesis, but I'm working on a multi-chapter document at the moment in which I'...


65

\addbibresource features an optional argument that allows you (among other things) to specify the location of a (local or remote) resource and the date type of the resource (e.g., bibtex, ris). See section 3.6.1 of the biblatex documentation for details. Note that when using \addbibresource (which was introduced in biblatex v1.2), "files must be specified ...


64

Reading these answers, and comments to them, piqued my curiosity… Especially this sentence that Will Robertson wrote in his answer: [...] I usually consider 1em to be about the same size as the font size in points. It inspired me to investigate the actual behavior of TeX (or rather LaTeX). Since my findings could be of interest to those finding ...


63

I don't think writing the thesis in a word processor like Open/Libreoffice or Word and then transferring it to LaTeX would be a good idea. This approach would force you to do some things twice and to take care about lots of stuff that could get lost on the transfer. With LaTeX you have the ability to get a lot of things easily done while writing your text (...


62

As several people have said, the only way is to write and typeset documents in LaTeX. Calculating the first 30 primes might make you a better programmer, but it is doubtful if it will make you a better LaTeX user, since it is of dubious utility to solve a problem for which LaTeX is not the right solution. If you're not sure what to write: Do your homework, ...


61

There was a talk at TUG'11 exactly about this: Didier Verna, Toward LaTeX coding standards: The paper is available for TUG members only till the end of the year, but the video is available for all. Take a look: Didier has many interesting thoughts to offer. You might be also interested in Chris Rowley's talk at TUG'09. And please consider joining TUG: ...


61

All features of color are available by loading the xcolor package as well. I would say that you can always load the latter one since: You don't have to care which features are in which one. You surely satisfy all other packages relying on color/xcolor. Many package load it anyways (tikz to name the most important one), so you even don't have to load it ...


Only top voted, non community-wiki answers of a minimum length are eligible