Access paper dimensions

How can I access the paper dimension that are in use when compiling a document? In other words, I am looking for a command that returns the width and height of the paper used (so that the returned parameters would change if the paper size is changed).

-
You should just use the geometry package to set these dimensions. I guess it's not entire clear what you want to achieve. –  Werner Mar 24 '13 at 19:04
\paperheight and \paperwidth –  David Carlisle Mar 24 '13 at 19:06
@Werner: I want to access the paper dimensions so that I can use the ratio between them when setting new margins with the geometry package. I want to set margins based on the rule to keep the text-block width-to-height ratio equal to that in the paper (while also setting the left and right margins equal, and the bottom margin to half of the top margin). –  hjb981 Mar 24 '13 at 20:59

\documentclass{article}
\begin{document}

\the\paperheight

\the\paperwidth

\the\textheight

\the\textwidth

\paperheight=111pt
\the\paperheight

\end{document}


changing the paper height in the documents body doesn't change the text height

-
Where does \paperheight/\paperwidth come from? –  morbusg Mar 24 '13 at 19:24
defined in latex.ltx and set by the documentclass –  Herbert Mar 24 '13 at 19:27