0

The question is pretty straightforward: Where (in which file) and how is the twocolumn option for latex classes defined?

This is what I found searching article.cls, just in case:

Linha  96:   \DeclareOption{onecolumn}{\@twocolumnfalse}
    Linha  98: \DeclareOption{twocolumn}{\@twocolumntrue}
    Linha  98: \DeclareOption{twocolumn}{\@twocolumntrue}
    Linha 210:       \if@twocolumn
    Linha 214:           \twocolumn[\@maketitle]%
    Linha 322: \if@twocolumn
    Linha 331: \if@twocolumn
    Linha 378:       \if@twocolumn
    Linha 387:       {\if@twocolumn\else\endquotation\fi}
    Linha 412:       \if@twocolumn
    Linha 420:     {\if@restonecol\twocolumn \else \newpage \fi
    Linha 425:       \if@twocolumn
    Linha 433:     {\if@restonecol\twocolumn \else \newpage \fi
    Linha 587:                {\if@twocolumn
    Linha 592:                 \twocolumn[\section*{\indexname}]%
    Linha 635: \if@twocolumn
    Linha 636:   \twocolumn

Note: I had already searched it, of course.

What I mean is, what does \@twocolumntrue/false point to?

user574859
  • 867
  • 3
  • 11
  • 1
    Have you looked at say article.cls? Just search for twocolumn. Twocolumn is a feature of the output routine, the classes then provides options to switch this feature on an off. – daleif Nov 28 '22 at 11:21
  • Special case of macros - Where do I find out how a command/environment is defined? - TeX - LaTeX Stack Exchange. ■ specifically it's in texdoc classes which is mentioned in the top answer there. – user202729 Nov 28 '22 at 11:22
  • I know the classes have options to switch it on/off, and yes, I looked at classes.pdf, which have the "switchers", but not the def. itself -- what do you mean as "feature of the output routine"? where do i find this "feature"? – user574859 Nov 28 '22 at 11:48
  • @user574859 the idea is that you locate the file article.cls (for example using kpsewhich article.cls from a terminal), then open that file in an editor, then search for the string twocolumn, there you see how the option is defined and handled. – Marijn Nov 28 '22 at 11:50
  • @Marijn, see updated question and comment above. – user574859 Nov 28 '22 at 12:00
  • I'm not sure I fully understand your question, but the boolean flag @twocolumn that is being set to true with the class option is defined in latex.ltx (which is loaded by default when you compile with pdflatex or xelatex or lualatex, although in a precompiled form), in my version on line 15060 \newif \if@twocolumn \@twocolumnfalse. Is that what you are asking about? – Marijn Nov 28 '22 at 12:17

1 Answers1

1

If you look in the same directory as article.cls you will see a file latex.ltx and on line 16090 (of the current version) is

\def \twocolumn {%
  \clearpage
  \global\columnwidth\textwidth
  \global\advance\columnwidth-\columnsep
  \global\divide\columnwidth\tw@
  \global\hsize\columnwidth
  \global\linewidth\columnwidth
  \global\@twocolumntrue
  \global\@firstcolumntrue
  \col@number \tw@
  \@ifnextchar [\@topnewpage\@floatplacement
}

Together with multiple tests

\if@twocolumn

All over the file.

This is the source of the latex format, a typeset version including code level comments is obtained by

texdoc source2e

David Carlisle
  • 757,742