# How to get exact value of \leftmargin

I need to extract the exact length of my left margin at a specific page in the document but \leftmargin doesn't seem to provide the correct value.

\documentclass{article}
\usepackage[letterpaper,margin=1in,footskip=0.25in]{geometry}
\newlength{\oneinch}
\setlength{\oneinch}{1in}
\begin{document}
\the\leftmargin\par
\the\oneinch
\end{document}


When testing, although I set it to 1in with geometry when I print \the\leftmargin I end up with 25.00003pt whereas one inch should be 72.26999pt. What am I doing wrong?

\leftmargin is the wrong length. That is used for lists. You either need to calculate it from \oddsidemargin, or use the macro from geometry:

\documentclass{article}
\usepackage[letterpaper,margin=1in,footskip=0.25in]{geometry}
\newlength{\oneinch}
\setlength{\oneinch}{1in}
\begin{document}
\the\dimexpr1in+\oddsidemargin\relax
\makeatletter \Gm@lmargin\makeatother
\the\oneinch
\end{document}


• Maybe you should mention that the "leftmargin" is \oddsidemargin plus 1in (as you do in the code), users who may never have seen the drawing of the layout settings in LaTeX might not understand it. Otherwise +1 for a god answer May 11 '16 at 11:55
• Thank you for the swift reply! Maybe I wasn't clear in my post, but I was looking for a way to figure out the current margin without "knowing" what the margin is, and whether it was declared with geometry or some other way.
– jan
May 11 '16 at 11:57
• @daleif Oh, I just saw your comment. So the \the\dimexpr1in+\oddsidemargin\relax does exactly that?
– jan
May 11 '16 at 12:00
• Just one more follow-up to make sure I understand correctly: So the \oddsidemargin plus 1in always gives me the distance from left paper margin to text, wherever I am, even if odd/even pages have different margins, correct?
– jan
May 11 '16 at 12:07
• No, \oddsidemargin is for odd pages. On even pages you should use \evensidemargin. Also while the 1in is traditional, it can be changed (the value is stored in \hoffset). May 11 '16 at 14:41