Rotating page with page number

2,977 views
Skip to first unread message

Josh Hykes

unread,
Oct 12, 2009, 5:21:36 PM10/12/09
to LaTeX Users Group
Hello,

I am working on a LaTeX class to meet my school's thesis guidelines.
I haven't found a way to fully meet the requirements for rotating
pages for large tables and figures. The guidelines state that pages
which contain sideways tables or figures should be turned sideways in
the PDF. I can accomplish this using the pdflscape package.

The tricky part is rotating the page number. Instead of having the
number printed in the normal position, the rules state that the number
should be rotated as well. Their idea is that as you read the
document in your favorite PDF viewer, the page number on rotated pages
will be easily readable. For an example, see page 41 in the
guidelines at http://www.ncsu.edu/grad/etd/docs/etd-guide.pdf

I have constructed a workaround by using fancyhdr and positioning the
page number within a picture environment. While I can get the page
number positioned correctly this way, there is no footskip to keep the
proper distance between the number and the rest of the page content
(in my case I am putting the number on the bottom). Rotating the
header and footer would presumably solve this problem.

This question is identical to the one at
http://www.latex-community.org/forum/viewtopic.php?f=5&t=1771#p21780

One suggestion on that thread is to use the gmeometric package. From
the package documentation, it seems to provide adequate options.
Unfortunately, I can't seem to get it to work in my thesis document,
or even in a short test document. For example, I would expect the
following to put page 2 in landscape, but this is not the case.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass{article}

\usepackage{lipsum}
\usepackage[portrait]{gmeometric}

\begin{document}

\lipsum[1-3]

\newpage
\geometry{landscape}
\lipsum[1-3]

\newpage
\geometry{portrait}
\lipsum[1-3]


\end{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


I realize that this is an odd request, and that this is not a good
typographic practice. However, the rules are set and I don't have the
freedom to change them.

Thanks for any ideas,

-Josh

Josh Hykes

unread,
Oct 20, 2009, 1:24:37 PM10/20/09
to LaTeX Users Group
Hello,

I thought I'd reply to myself with the solution I've found to rotating
pages with the margins and page number. It isn't pretty, but it gets
the job done (at least I haven't found any problems with it yet). The
following is a mix of latex and pseudo-code:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\usepackage{pdflscape}
\usepackage{changepage}
\usepackage{rotating}

%% A new environment to rotate page, margins, and page number
\newenvironment{lscapenum}
{
\clearpage
\changepage{%insert appropriate changes here, see changepage docs%}
\begin{landscape}
\pagestyle{fancy}
\fancyhead{} % clear all header fields
\fancyfoot{} % clear all footer fields
\renewcommand{\headrulewidth}{0pt}
\rfoot{
% Since the header and footer are unrotated, we must manually
% place the page number. The picture environment is included
in
% standard LaTeX.
\setlength{\unitlength}{\textheight}
\begin{picture}(0,0)
\put(%xshift%,%yshift%){\begin{sideways}\thepage\end
{sideways}}
\end{picture}
}
}
{
\end{landscape}
% The \textheight is too large leaving landscape environment
% since we invoked the \changepage. We manually reduce it.
\addtolength{\textheight}{-\myoldfootskip}

% \textheight controls 3 other variables, which must be updated.
% See \endlandscape definition in lscape.sty
\global\@colht=\textheight
\global\vsize=\textheight
\global\@colroom=\textheight

\pagestyle{plain}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

The most difficult part of this approach (that I have found) is
getting the margins correct in the page after the rotated page. You
will likely have to play around with the dimensions or add another
\changepage command after the landscape command.

If someone has a better solution, I'd still be glad to hear it.

Thanks,

Josh
Reply all
Reply to author
Forward
0 new messages