40

Since LaTeX is a format built on top of TeX, it surely has several high level abstractions that perform similarly to TeX commands, with some added error-handling functionality, for example. I always find scattered advice saying

Instead of \def, use \newcommand

...which I'm sure also applies to other commands.

Is there a document compiling such matches? If not, how about we compile them here? So far, I can think of the following. I may or may not be right with some of them, but I hope it illustrates my point.

\def --> \newcommand, \renewcommand
\hskip --> \hspace
\vskip --> \vspace

The objective is to avoid using low-level TeX commands unless absolutely necessary. And even if it were necessary, confine them inside macro definitions.

I imagine this to be community wiki. So one matchup per answer. A big-list community wiki answer has been started below, categorized according to problem domains. Feel free to edit and/or add problem domains and matchups.

A TeX --> LaTeX matchup means that they tackle the same problem domain, so one or more TeX commands may match one or more LaTeX commands. Also include with your answer the reasons (or a link) explaining why the LaTeX alternative is better as a high-level implementation.

3
  • 5
    I think that this is great, but I'd rather go for a single comunity wiki answer with the commands grouped in some logical fashion. Moreover (having just dipped my toe in the murky waters of LaTeX3 syntax) I'd like to add LaTeX3-type commands to this. Aug 29, 2011 at 7:05
  • @Andrew, right, that's part of what I envisioned. Maybe have everyone add in their matchup, then edit the big-list answer, with a link to their answer which contains their explanation.
    – Kit
    Aug 29, 2011 at 7:28
  • 1
    While it is not the plain list you asked for, mirror.ctan.org/info/l2tabu/english/l2tabuen.pdf can provide some answers.
    – Stephen
    Aug 29, 2011 at 18:07

2 Answers 2

20

On the left are TeX commands, on the right are LaTeX commands with similar functionality.

Macro definitions

  • \def, \gdef --> \newcommand*, \providecommand*, \renewcommand*
  • \long\def, \long\gdef --> \newcommand, \providecommand, \renewcommand

    For commands with a scope, i.e. including grouping, LaTeX provides \newenvironment and \renewenvironment.

Mathematics

Tables

  • \cr, \crcr --> \\, \tabularnewline

Spacing

  • \kern, \hskip --> \hspace
  • \vskip --> \vspace

Positioning

  • \centerline --> \centering or the center environment
  • \raise --> \raisebox

Miscellaneous

  • \uppercase --> \MakeUppercase
4
  • 1
    The high number of upvotes to the question shows that the question is interesting. So there's a CW answer now, feel free to extend it. It would be great if you supplement suggestions with links to existing questions & answers on the site.
    – Stefan Kottwitz
    Aug 29, 2011 at 22:12
  • I would add the commands \(re)newenvironemt and begin{...}...end{...}. And what do you think about font commands like \bf? Aug 29, 2011 at 22:15
  • @Marco: \bf, \it are also obsolete LaTeX 2.09 commands, that's why I didn't add it at first. Just edit :-) no need to ask. I'm sure you make good additions.
    – Stefan Kottwitz
    Aug 29, 2011 at 22:23
  • 1
    I especially like the links to questions, that's a nice feature of having this list here rather than on some website somewhere. Aug 30, 2011 at 10:05
8

For what it is worth, the nag package will warn you whenever you use a TeX command instead of a LaTeX one. Good way to learn which commands are deprecated outdated and superseded (quoting the nag documentation).

1
  • 4
    How, exactly, can the underlying language primitives be "deprecated"?!
    – morbusg
    Aug 30, 2011 at 8:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .