[Tex/LaTex] Most useful/important (La)TeX commands/environments

best practicesenvironments

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

Best Answer

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}