# Is there a way to rotate all pages in XeLaTeX?

I known there is a landscape command to set horizontal pages, but this is not I want. My purpose is to typeset vertical CJK with XeLaTeX. The general approach is using \rotatebox{-90} get a vertical paragraph in a box. It works for a single paragraph in one page; The disadvantage is that it can not deal with more complex situations such as multiple pages. I am wondering if there is a way to rotate the all pages?

-
Do you know want all pages, i.e. the complete document in landscape as the title says, or only several pages? For pdfLaTeX I would suggest pdflscape but I don't think it will work for XeLaTeX. – Martin Scharrer Apr 20 '11 at 11:13
@Martin Scharrer I am going to rotate all the pages with rotated text. – Ma Ming Apr 20 '11 at 11:16
Is there a way to rotate pages with unrotated text? – Martin Scharrer Apr 20 '11 at 11:18
@Martin pdflscape works fine xelatex. – Ulrike Fischer Apr 20 '11 at 11:38
@Ulrike: Thanks for pointing this out. – Martin Scharrer Apr 20 '11 at 11:40

\documentclass[nofonts]{ctexart}
\newfontlanguage{Chinese}{CHN}
\setCJKmainfont[Script=CJK,Language=Chinese,Vertical=RotatedGlyphs]{SimSun}

% rotate the page
\usepackage{everypage}

\begin{document}

\end{document}


BTW, you'd better discuss these topics at CTeX forum . It is strange to answer your question here for me.

-
 Thanks for the link, now I know where we can send others with these issues. – Matthew Leingang Apr 20 '11 at 17:33

This is possible with the pgfpages package that is part of the pgf bundle. Unfortunately there is a bug in the 2.10 release. There is a simple fix, though, which you can patch in like this:

792a793,801
> % MPL 2011-04-20 08:04:45
> % patch to fix bug in rotation.  See
> % http://old.nabble.com/pgfpages-and-rotation-tt26508856.html#a26508856
> %        \expandafter\ifx\csname pgfpages@p@\the\pgf@cpn @rotation\endcsname\relax%
> %           \pgfscope%
> %        \else%
> %          \pgflowlevel{\pgftransformrotate{\csname pgfpages@p@\the\pgf@cpn @rotation\endcsname}}%
> %        \fi%
>         \pgfscope%
794d802
<           \pgfscope%


(the only substantial change is that a \pgfscope macro is moved from within an \ifx...\fi to before it.)

Here is a sample to see how it works:

\documentclass{article}
\usepackage{lipsum} % just for dummy text
\usepackage{pgfpages}

\pgfpagesdeclarelayout{down}{}{%
\pgfpagesphysicalpageoptions
{%
logical pages=1,%
physical height=8.5in,
physical width=11in
}
\pgfpageslogicalpageoptions{1}
{%
rotation=-90,
center=\pgfpoint{0.5\pgfphysicalwidth}{0.5\pgfphysicalheight}%
}%
}
\pgfpagesuselayout{down}

\begin{document}
\lipsum
\end{document}


This was all going great until I tried compiling with xelatex, and I got that the physical page size did not change. But we are 90% there.

-