# How can I determine the actual inner and outer margins

I somehow have the feeling this is a dumb question, but I just can't find anything :-(

How can I determine the actual values of the inner and outer margins of my document, or still better: the right and left margins of the current page?

Background is that I'm working on a package to manage music examples, and one of the kinds these come are multi-page pdf files. Additional to other methods I would like to add an option to automatically offset the included pdf pages depending on being on an odd or even page.

For this I would like to read out the margins of the current page.

-
The packages layouts and layout can help you. –  Marco Daniel Mar 10 at 18:41
Unfortunately neither of these suggestions helps me: I don't need to determine if I'm on an odd side (I have this already), and I don't need to display layout values, but I have to read and use them. So it would be best if these values were stored in counters that I can simply read out. –  uli_1973 Mar 10 at 19:12
@uli_1973: When you use the \layout package, not only does it display the values, but it also tells you the name of the length registers that contain those values. –  Peter Grill Mar 11 at 3:30
@Peter: I'm sorry, obviously I didn't think far enough. Of course \layout doesn't give me directly what I want, but provides me with the tools to do so. –  uli_1973 Mar 11 at 17:59

The reference point (unless changed with \hoffset and \voffset) is 1in in and 1in down from the top left of the page.

Relative to that point the left margin in LaTeX is \oddsidemargin on odd pages and \evensidemargin on even pages. The total paper width is \paperwidth so the right margin on an odd page is \paperwidth - \textwidth - \oddsidemargin - 1in.

-

To read and use margin lengths and the like, check this MWE. The \layoutcommand of the package layout show all the relevant lengths about margins, so IMHO the comment of Marco Daniel it is really a good suggestion. Another could be the use of the package geometry to fix yourself the margin values.

\documentclass[twoside,a4paper]{article}
%\usepackage[margin=2cm]{geometry}
%\usepackage{layout}
\begin{document}
% \layout
The text width is now \the\textwidth

\rule{\textwidth}{0.4pt}

The odd side margin is now \the\oddsidemargin ~
\rule{\oddsidemargin}{0.4pt}

The even side margin is now \the\evensidemargin ~
\rule{\evensidemargin}{0.4pt}

The top margin is now \the\topmargin  ~
\rule{\topmargin}{0.4pt}

\end{document}

-
Sorry, but I can only accept one answer. Yours was more practical to get a feeling for the syntax, but the other one provides important information about the reference point. –  uli_1973 Mar 11 at 18:01