52

A friend of mine asked me why I use LaTeX instead of Word/OpenOffice/LibreOffice etc. (no, this is not going to be a question like 'Word vs. LaTeX')

I showed him some of the showcases here on TeX.SE, some of my personal work too (not shown here). He was puzzled about the 'huge range of commands' to be learned. He wanted to know which and how many commands he should learn in order to produce 'reasonable' documents.

My answer was that this would depend on the type and content of the document, but I could not give a clear answer.

I know, this question might provoke opinion based answers or is too broad, therefore I want to restrict the question

What are the 50 most useful/important commands or environments for writing a typographically good every-day-document (article/book/beamer)? Probably those commands/environments are the most used ones(?)

In order to reduce the wide range of possible answers I will put some more obstacles:

  • Since a lot of TeX macros deal with mathematical typesetting, it's better to exclude them in this question, environments however are 'allowed'

  • No LaTeX document can 'live' without \documentclass and \document, so those macros are mandatory anyway and can be excluded

  • Environments \begin{...}...\end{...} should count just as one command
  • Class/Package writer commands and deep internals should be excluded too, as they have in principle nothing to do with everyday's work.
  • TikZ/pstricks etc. are really nice bundles, but it's not useful to list a lot of macros from those packages
  • Structuring commands like \chapter etc. are basically the same, so they count as one
  • \blindtext \lipsum are not useful in producing everyday's document, so they do not count as well
  • The various \cite... commands available from bibliographies count as one

I know, there are some (un)related questions

It is not necessary to list exactly 50 macros or environments -- I will collect from the answers and generate a top list of them

  • I think you should make clear whether you want to include commands which require packages or not. If you do, I think the question is too broad: there are too many possible answers. I'd suggest limiting it to a standard class with a short, fixed preamble - maybe just \documentclass{article}\begin{document}. – cfr Jan 2 '15 at 0:21
  • @cfr: Of course, packages provide a huge range of possible commands, but many of them reimplement tabular, for example – user31729 Jan 2 '15 at 0:23
  • 1
    It definitely is not a duplicate of that question. Whether it is too broad is a different matter. I could imagine it being thought too broad or, even, too opinion-based. But 'top 50 commands' cannot be thought equivalent to 'packages most often loaded by default'! – cfr Jan 2 '15 at 16:12
  • 1
    Actually, it's quite probable that in order to use Word or LibreOffice, the number of commands is larger: the number of buttons is overwhelming. It's really strange someone can work in such environment. I recently read someone had made a text-editor with no buttons (only shortcuts) simply to have some peace. – Willem Van Onsem Jan 2 '15 at 17:32
  • 1
    @CommuSoft: I remember such text-editors as well, in the early nineties... Wordstar etc. ;-) – user31729 Jan 2 '15 at 17:35
44

Note that I refuse to exclude essential commands and environments. A list of the most important should be just that: any list of specific macros which misses \documentclass and document is deficient! In fact, these are so important that they are numbered zero in the list below (as a kind of concession to sticklers for following the rules dictated in questions):

Two + Fifty LaTeX Basics

2+50 commands and environments

Note that 8 and 9 are not errors. In particular, the first disjunct of 8 is a blank line and 9 is a comment (essential for avoiding spurious spaces).

Notes

  • The emphasis here is on producing an article. As such, commands for contents listings, lists of figures, chapters etc. are omitted. (Except that contents stuff is useful for beamer. See below.)

    • Obviously, some people's first LaTeX document will be a multi-chapter creation. Mine was. But I don't think this is the best way to begin, and it is not a route I would recommend to the non-desperate. (I was desperate so I would recommend it to me. But that is not the standard case, I hope.)
  • I've attempted to emphasise semantic mark-up as opposed to manual formatting. So \textbf{}, \itshape, \small etc. are out, whereas \section etc. are in.

  • \emph is an exception in being halfway between semantic mark-up and manual formatting. However, insofar as it is the latter, it is essentially tied to content and is, therefore, the business of the document author and not the style author.

    • The writer of a class or package does not know which words I wish to, or ought to, emphasise!
  • The list tries to illustrate some key concepts without presenting an exhaustive list, which cannot be done in 50 items and would be fairly useless to a beginner in any case.

    • 17 is there largely as an example of a character which is treated as special and so needs to be escaped. It is not the only character of this kind, of course, but it is the one I think I use most frequently.

    • 18 is there as an example of an accent. It happens to be the one I need most often.

  • Regarding 23, at least in my discipline, quotation is more standard than quote. I only ever use the latter, really, by mistake or for a purpose it was not designed for.

  • 27 and 28 are disjunctive because I think it does not matter terribly much which system you first learn to format citations and references with, provided you learn some form of semantic mark-up.

    • And it certainly would not be wise to learn multiple systems all at once! So the disjunctions here are necessary: the list ought not include commands for all three systems separately, as though a learner should immediately try to figure out the standard environment, BibTeX and BibLaTeX/Biber all at the same time.
  • I am not sure I would encourage a beginner to typeset presentations using LaTeX, but I've included some items for beamer anyway.

    • \includegraphics is listed here because I think this much less basic with respect to other kinds of documents, whereas it is pretty essential when preparing slides.
  • Letters were not mentioned in the question but are an extremely common, everyday kind of document to create, and knowing some basic commands and environments for making them seems appropriate.

  • The exception for mathematical environments (as opposed to commands) was added after I'd disappeared to work on the list, and I therefore planned the list on the assumption that mathematical mark-up was to be excluded.

    • For me, personally, this is not unreasonable as I typeset relatively little mathematics.

    • However, for a standard list, I'd recommend cutting the beamer section and adding stuff for mathematics instead.

    • In any case, I would certainly cut 2 of the items here to make room for $...$ and \[...\] which I do actually use a bit.

Code

\documentclass[twocolumn]{article}
\usepackage{textcomp}
\newcommand*\mycommand[2][command]{%
  \def\tempa{command}%
  \def\tempb{env}%
  \def\tempc{#1}%
  \ifx\tempa\tempc \item \texttt{\textbackslash #2}
  \else \item \texttt{\textbackslash begin\{#2\} \dots \textbackslash end\{#2\}}
  \fi}
\pagestyle{empty}
\begin{document}
  \begin{enumerate}\setcounter{enumi}{-1}
    \mycommand{documentclass}\setcounter{enumi}{-1}
    \mycommand[env]{document}
    \mycommand{usepackage}
    \mycommand{author}
    \mycommand{title}
    \mycommand{date}
    \mycommand{maketitle}
    \mycommand{section}
    \mycommand{subsection}
    \item \mbox{}\\\emph{or} \texttt{\textbackslash par}
    \item \texttt{\%}
    \mycommand[env]{enumerate}
    \mycommand[env]{itemize}
    \mycommand{item}
    \mycommand{emph}
    \item \texttt{\textquotesingle}
    \item \texttt{--}
    \item \texttt{---}
    \mycommand{\&}
    \mycommand{\textasciicircum}
    \mycommand{footnote}
    \mycommand{label}
    \mycommand{ref}
    \mycommand{cite}
    \mycommand[env]{quotation}
    \item \texttt{\textasciigrave\dots\textquotesingle}
    \item \texttt{\textasciigrave\textasciigrave\dots\textquotesingle\textquotesingle}
    \mycommand{dots}
    \mycommand[env]{thebibliography}\\\emph{or} \texttt{\textbackslash bibliography}\\\emph{or} \texttt{\textbackslash printbibliography}
    \mycommand{bibitem}\\\emph{or} \texttt{\textbackslash bibliographystyle}\\\emph{or} \texttt{\textbackslash usepackage[]\{biblatex\}}
    \mycommand[env]{abstract}
    \mycommand[env]{figure}
    \mycommand[env]{table}
    \mycommand{caption}
    \mycommand{centering}
    \mycommand[env]{tabular}
    \mycommand{hline}
    \item \texttt{\&}
    \item[\textbullet] \emph{for letters:}
    \mycommand[env]{letter}
    \mycommand{name}
    \mycommand{signature}
    \mycommand{opening}
    \mycommand{closing}
    \mycommand{encl}
    \item[\textbullet] \emph{for beamer:}
    \mycommand[env]{frame}
    \mycommand{titlepage}
    \mycommand{tableofcontents}
    \mycommand[env]{columns}
    \mycommand[env]{column}
    \mycommand[env]{block}
    \mycommand{usetheme}
    \mycommand{includegraphics}
  \end{enumerate}
\end{document}
  • 2
    +1. Smart way to write your list. Suggestion: \texttt{} for commands? – Sigur Jan 2 '15 at 0:40
  • 2
    @Sigur Only because the question was edited to exclude them while I was writing my list ;). Still, I refuse to exclude them. Answers should be useful to all users - even those who don't bother to read the questions! – cfr Jan 2 '15 at 1:10
  • 1
    @ChristianHupfer As a concession, I've numbered them zero in my final list, which also reflects their importance. – cfr Jan 2 '15 at 1:52
  • 1
    @cfr: ;-) Can't upvote again ;-) – user31729 Jan 2 '15 at 1:53
  • 1
    @ChristianHupfer Stickler for the rules! I bet you insist on obeying the law of gravity even on public holidays, as well. ;) – cfr Jan 2 '15 at 1:55
14

I am too lazy to make a list of 50 commands, but the LaTeX cheet sheet of Winston Chang, in a single page, cover a list of basic commands and even include a MWE. Very helpful for a novice.

If you do not agree completely with the selection, the LaTeX source file is available and you can modify under the terms of a CC license.

For a longer list, see the AMS-LATEX Reference Card #1.

Finally, I think that the Beamer class probably deserves its own list of commands as well as themes, templates options, etc. The Beamer appearance cheet sheet.

  • Well, I stated in my question, that it's not necessary to list exactly 50 commands... I will collect from answers and generate a list of the top 50 commands – user31729 Jan 2 '15 at 7:24
12

Since I'm a mathematician, I would say:

  1. sectional commands (\section \subsection)
  2. equation environment (and their variants, e.g., align).
  3. labels and refs for crossed references (\label \eqref \cite).
  4. diagram packages (xy tikz)

and of course,

  1. AMS packages/commands (e.g., amsmath \DeclareMathOperator).
  • 1
    (+1) I don't think this list is deficient. But I think mine would be deficient if I excluded those commands, just because we've answered at different levels of generality. – cfr Jan 2 '15 at 1:13
8

'~' is indispensable to write a decent paper. This is due to the fact that using the tilde results in putting non-breakable space in a document. In consequence we may easily eliminate typesetting errors connected with breaking lines, the so called orphans, for example:


This is due to the fact that using the tilde 
results in putting non-breakable space in a 
document.

The linebreak after 'a' and before 'document' can be thus eliminated by typing 'a~document'.

Thus '~' is one of the (La)TeX goodies really worth mastering. And according to Knuth himself via this you can gain a lot:

Once you learn how to insert them [i.e. '~'s], you will have graduated from the ranks of ordinary TeXnical typists to the select group of Distinguished TeXnicians. (TeXbook, p. 91)

  • 1
    perhaps it might be good to explain why '~' is so useful – user36296 Jan 7 '15 at 0:00
  • 1
    @samcarter Good point. Improved my answer. – Mad Hatter Jan 7 '15 at 11:07

protected by user31729 Jan 8 '15 at 12:41

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?