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.

I have a simple document class adapted from article, but independent (.cls file). The document is twocolumn, but when I add a title with

  \newcommand\maketitle{\begin{titlepage}%
  \begin{center}%
    {\LARGE \@title \par}%
  \end{center}\par
  \end{titlepage}%
}
\newenvironment{titlepage}
    {%
      \@restonecoltrue\onecolumn
      \thispagestyle{empty}%
      \setcounter{page}\@ne
    }%

This makes the entire document onecolumn. How should I set the titlepage environment to be onecolumn without affecting the entire document?

share|improve this question

2 Answers 2

up vote 9 down vote accepted

The definition of the titlepage environment in article.cls depends on whether compatibility mode is on/off, but both variants include

\if@restonecol\twocolumn \else \newpage \fi

in the code to be executed at the end of the environment. In your version of titlepage, you simply switch to \onecolumn (which makes \@restonecoltrue superfluous) at the start of the environment, so you need to switch back to \twocolumn at the end. I suggest, however, to simply use the original non-compatibility variant of titlepage, as this will make your custom class also work in onecolumn mode.

share|improve this answer
    
very clear information! I wonder how I missed that critical line :) –  All Apr 16 '12 at 17:11

You can define \maketitle using the optional argument to the command \twocolumn:

\def\maketitle{%
  \twocolumn[\vbox to \textheight{\vfil
    \begin{center}\LARGE \@title \par\end{center}%
  \vfil}]%
  \clearpage
}

The command \twocolumn does 3 things:

  1. starts a new page if necessary
  2. typesets its optional argument in one-column mode
  3. the rest of the new page is in two-column mode
share|improve this answer

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.