All of the standard LaTeX document classes (article, book and report) declare some basic functionality and parameters based on the condition @compatibility. Here's an extract from from article.cls that defines the standard paper size options available to the class(es):

   {\setlength\paperheight {297mm}%
    \setlength\paperwidth  {210mm}}
   {\setlength\paperheight {210mm}%
    \setlength\paperwidth  {148mm}}
   {\setlength\paperheight {250mm}%
    \setlength\paperwidth  {176mm}}
   {\setlength\paperheight {11in}%
    \setlength\paperwidth  {8.5in}}
   {\setlength\paperheight {14in}%
    \setlength\paperwidth  {8.5in}}
   {\setlength\paperheight {10.5in}%
    \setlength\paperwidth  {7.25in}}
   {\setlength\@tempdima   {\paperheight}%
    \setlength\paperheight {\paperwidth}%
    \setlength\paperwidth  {\@tempdima}}

Starting a document with

\documentclass{<standard document class>}

skips these paper definitions, including many others. What is the use of this compatibility condition? Does it allow some form of compatibility with LaTeX 2.09 or other platforms? Why would one use it?

For example, the following compiles fine:

\begin{document} Hello world. \end{document}

while the following issues a warning:

\begin{document} Hello world. \end{document}

for the reasons described above.


3 Answers 3


It is in fact a compatibility mode for LaTeX 2.09 which is enabled if you use the old \documentstyle instead of \documentclass. It is included to allow to compile LaTeX 2.09 documents with LaTeX 2e, which was very important at the time it appeared when most users still had a lot of 2.09 documents. I think this helped to get people to switch to the new version faster. If you have to change all your existing documents to be able to compile them, but then have to change them back if you or one of your partners want to use the old compiler then you think twice if you really want to update.


The switch \if@compatibility is set to true by \documentstyle (or, to be precise, in the latex209.def file that is read in when executing \documentstyle).

It should not be used in new classes not meant to run also with \documentstyle. Its purpose is just to make sure that a legacy document compiles properly also with LaTeX2e as preloaded format and frees the kernel developers from maintaining two different versions of the standard classes.

The number of \documentstyle users should be, by now, down to a few irreducible soldiers.

  • \documentstyle "users" is a group that includes a lot of docs on ctan -- like all of the old ttn sources, for example. they're irreducible (of course, since they should not be changed), but can be compiled with a certain amount of care. Commented Apr 16, 2012 at 19:44
  • 1
    @wasteofspace Legacy documents can still be compiled and aren't influenced by new classes. I was referring to people still writing documents that begin with \documentstyle.
    – egreg
    Commented Apr 16, 2012 at 19:53

\if@compatibility is true means you are in LaTeX 2.09 compatible mode. If you use


You are in this mode.

See source2e: "File L ltclass.dtx" for more information.


You must log in to answer this question.

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