# How to repeat centered text in a sideway environment?

Some text can be repeated, for example, by using \multido of the package "multido" and text can be rotated by using the sideways environment of the package "rotating". Combining both works. But when trying to center the text additionally there is the revealing error message:

Somethings's wrong--perhaps a missing \item.


I didn't know that lists come into play... Here is a MWE:

\documentclass{article}
\usepackage{rotating,multido}
\begin{document}

%using center environment
\begin{sideways}
\multido{\i=0+1}{3}{%
\begin{center}This is some centered text...\end{center}
}
\end{sideways}

%using \centering
\begin{sideways}
\centering
\multido{\i=0+1}{3}{%
This is some centered text...\\ \bigskip
}
\end{sideways}

\end{document}


What is the problem?

• You can use a box: \documentclass{article} \usepackage{rotating,multido} \begin{document} \begin{sideways} \parbox{\textheight}{\multido{\i=0+1}{3}{\centering This is some centered text... \\} } \end{sideways} \end{document} – Gonzalo Medina May 13 '13 at 21:58

The problem in this case is with \addvspace (hidden in the definitions of center and \centering) being called outside vmode, as the following simple example demonstrates:

\documentclass{article}
\usepackage{rotating}

\begin{document}

\begin{sideways}
This is some centered text...
\end{sideways}

\end{document}


This code triggers the "famous" error:

! LaTeX Error: Something's wrong--perhaps a missing \item.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
...



To confirm this, a simple conditional test helps:

\documentclass{article}
\usepackage{rotating}

\begin{document}
\begin{sideways}
\ifvmode a\else b\fi
\end{sideways}
\end{document}


the above code, typesets "b", so we are not in vmode.

This is so, because sideways (and also rotate and turn) use a \hbox to collect the material; for example, in rotating.sty one finds:

\def\sideways{%
\Grot@setangle{90}%
\setbox\z@\color@hbox\ignorespaces}


and then

\AtBeginDocument{%
\providecommand\color@hbox{\hbox\bgroup}
}


You can prevent the problem using, for example, a \parbox:

\documentclass{article}
\usepackage{rotating,multido}

\begin{document}
\begin{sideways}
\parbox{\textheight}{%
\multido{\i=0+1}{3}{\centering This is some centered text... \\}%
}
\end{sideways}
\end{document}