[Tex/LaTex] How to get exact value of \leftmargin

geometrymargins

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?

Best Answer

\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}

enter image description here