[Tex/LaTex] Rotating text by -90 degrees

rotatingxetex

Using lscape from the graphics package, one can rotate all of the text within \begin{landscape} and \end{landscape} by 90 degrees, while permitting the text to break across pages. Is there a way to rotate the text in the same manner, but -90 degrees?

Update:

The desired result is to rotate all of the text within the body of the page, but not the page itself, and not the footnotes. The use is connected with this question: Vertical Chinese text with XeTeX, however, using a minipage is not a good option, as the long material does not properly wrap at the end of the page. However, the lscape solution rotates the text 90 degrees in the wrong direction.

Here is an example of the code using lscape which rotates the text 90 degrees:

\documentclass{article}
\usepackage{lscape}
\begin{document}
    \begin{landscape}
        This is some text.
    \end{landscape}
\end{document}

Note, with the above code that footnotes and headers are not changed. When compiled with xelatex, and viewed in a PDF reader, the page is not turned to landscape mode. I hope this behavior can be copied, but with -90 rotation of the text only.

Best Answer

Redefining landscape

I was wrong. lscape instead of pdflscape should be used here, because the text will be also rotated. And patch the command as Stefan Kottwitz do.

You can define a new environment to rotate the page by -90 degrees, without changing the definiton of landscape environment. To do this, you can use

\let\antilandscape\landscape
\let\endantilandscape\endlandscape
\def\LS@antirot{%
  \setbox\@outputbox\vbox{\hbox{\rotatebox{-90}{\box\@outputbox}}}}
\patchcmd{\antilandscape}{\LS@rot}{\LS@antirot}{}{} % require etoolbox package

Vertical typesetting example

It is quite difficult to get everything well in vertical mode. The following example shows how to get proper footnote for vertical Chinese text. There are still more things to do, you can try.

\documentclass[UTF8]{ctexart}
\usepackage{etoolbox}
\usepackage{lscape}
\makeatletter
\let\antilandscape\landscape
\let\endantilandscape\endlandscape
\def\LS@antirot{%
  \setbox\@outputbox\vbox{\hbox{\rotatebox{-90}{\box\@outputbox}}}}
\patchcmd{\antilandscape}{\LS@rot}{\LS@antirot}{}{}

\newfontlanguage{Chinese}{CHN}
\setCJKfamilyfont{songvert}[Script=CJK,Language=Chinese,Vertical=RotatedGlyphs]{SimSun}
\newcommand*\songvert{\CJKfamily{songvert}\punctstyle{plain}\CJKmove}

\newcommand*\CJKmovesymbol[1]{\raise.35em\hbox{#1}}
\newcommand*\CJKmove{\punctstyle{plain}% do not modify the spacing between punctuations
  \let\CJKsymbol\CJKmovesymbol
  \let\CJKpunctsymbol\CJKsymbol}

\newenvironment{CJKvert}
  {\antilandscape
   \appto{\normalfont}{\songvert}\songvert
   \let\oldfootnote\footnote
   \renewcommand\footnote[1]{\oldfootnote{\songvert##1}}%
   \renewcommand\thefootnote{[\chinese{footnote}]}%
   \def\vert@makefnmark{\hbox{\normalfont\@thefnmark\space}}%
   \let\old@makefntext\@makefntext
   \long\def\@makefntext##1{{%
     \let\@makefnmark\vert@makefnmark
     \old@makefntext{##1}}}%
  }
  {\endantilandscape}

\makeatother

\usepackage{lipsum}

\begin{document}

\lipsum[1]

\begin{CJKvert}
\parindent=0pt
『朝发轫于苍梧兮,\\
夕余至乎县圃。\\
欲少留此灵琐兮,\\
日忽忽其将暮。\\
吾令羲和弭节兮,\\
望崦嵫而勿迫。』\footnote{屈原《离骚》}
\end{CJKvert}

\lipsum[2]

\end{document}