2

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?

  • 1
    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
3

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}
\addvspace{3em}
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.
 ...                                              

l.7 \addvspace{3em}

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}

enter image description here

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.