2

I am writing a document of the type \documentclass[twocolumn]{article}, I want to use a pgfornament right after the title centered. If I use it like that:

\begin{@twocolumnfalse}
\begin{center}
test
\end{center}
\end{@twocolumnfalse}

Where test is the ornament (or, it doesn't really matter, same problem when I am using the text test). My problem is that the \begin{@twocolumnfalse} doesn't do anything at all. The text or the ornament are still centered in the left column, although they should be in the center of the whole page. What am I doing wrong?

  • 1
    you are just setting \if@twocolumn boolean to false, but as center (like most code) doesn't look at that boolean there is no change of behaviour. – David Carlisle Nov 28 '20 at 12:29
5

LaTeX has a boolean flag \if@twocolumn which is set true if the twocolumn option has been used. Some code (typically \maketitle) checks this boolean and uses different layout in one or two column modes.

Your code fragment is equivalent to

{\@twocolumnfalse
\begin{center}
test
\end{center}
}

So it just sets the flag to false but doesn't actually change the layout. center does not check the boolean at all so acts as normal. In standard latex \begin{document}, floating environments like figure, \maketitle/titlepage and abstract are the only places that check this boolean.


in two column mode article class uses

          \twocolumn[\@maketitle]%

to set the title, the optional argument here is placed in a spanning box that is full page width before the two column starts.

I would guess that your real use case should add the ornament to the definition of \@maketitle so that it comes within this spanning box.

  • Thank you, but is there any way to do what I need to do? I tried puting the ornament into a figure already but that doesn't help. – luca Nov 28 '20 at 12:38
  • 2
    @luca sorry your question is far too vague for me to guess what you intended to do, I could only answer the specific question as asked as to why surrounding center with @twocolumnfalse does nothing. Probably you want to add the ornament to the definition of \maketitle so that it is within the spanning box that that command puts at the top of the page – David Carlisle Nov 28 '20 at 12:47
  • @luca I'll add a note to my answer – David Carlisle Nov 28 '20 at 12:48
  • Thanks again. I marked you answer as the solution because it would probably be enough for a normal LaTeX user but I am really new to this, could you maybe give me any pointers as to how I can add the ornament to the definition of \@maketitle? Because this is exactly what I need. – luca Nov 28 '20 at 14:09
  • @luca perhaps \makeatletter \let\old@maketitle\@maketitle \renewcommand\@maketitle{\old@maketile\begin{center} text\end{center}} \makeatother – David Carlisle Nov 28 '20 at 14:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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