Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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):

\if@compatibility\else
\DeclareOption{a4paper}
   {\setlength\paperheight {297mm}%
    \setlength\paperwidth  {210mm}}
\DeclareOption{a5paper}
   {\setlength\paperheight {210mm}%
    \setlength\paperwidth  {148mm}}
\DeclareOption{b5paper}
   {\setlength\paperheight {250mm}%
    \setlength\paperwidth  {176mm}}
\DeclareOption{letterpaper}
   {\setlength\paperheight {11in}%
    \setlength\paperwidth  {8.5in}}
\DeclareOption{legalpaper}
   {\setlength\paperheight {14in}%
    \setlength\paperwidth  {8.5in}}
\DeclareOption{executivepaper}
   {\setlength\paperheight {10.5in}%
    \setlength\paperwidth  {7.25in}}
\DeclareOption{landscape}
   {\setlength\@tempdima   {\paperheight}%
    \setlength\paperheight {\paperwidth}%
    \setlength\paperwidth  {\@tempdima}}
\fi

Starting a document with

\makeatletter\@compatibilitytrue\makeatother
\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:

%\makeatletter\@compatibilityfalse\makeatother
\documentclass[a4paper]{article}
\begin{document} Hello world. \end{document}

while the following issues a warning:

\makeatletter\@compatibilitytrue\makeatother
\documentclass[a4paper]{article}
\begin{document} Hello world. \end{document}

for the reasons described above.

share|improve this question
add comment

3 Answers

up vote 14 down vote accepted

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.

share|improve this answer
add comment

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.

share|improve this answer
    
\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. –  wasteofspace Apr 16 '12 at 19:44
    
@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 Apr 16 '12 at 19:53
add comment

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

\documentstyle{article}

You are in this mode.

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.