哪个变量存储了文档边距的值?

哪个变量存储了文档边距的值?

我正在尝试创建页眉。我想将信息定位在右侧或左侧边距上。但我不知道哪个命令可以正确存储边距尺寸。该\leftmargin命令没有按我预期的方式工作。我尝试计算\paperwidthless \textwidth,但它也不起作用。

\documentclass[12pt,twoside]{book}
\usepackage[left=5cm, right=3cm]{geometry}
\usepackage[table, svgnames]{xcolor}
\usepackage{tikzpagenodes}
\usepackage{lipsum}
\usepackage{tikz}
\usetikzlibrary{positioning,calc}
\usepackage{tcolorbox}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{} 
\renewcommand{\chaptermark}[1]{\markboth{\thechapter\ #1}{}} 
\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}{}}   
\fancyhead[LO]
{\begin{tikzpicture}[remember picture,overlay]
\node[xshift=-\leftmargin, inner sep=0pt] (a) {aaaaVaaaa}; 
\end{tikzpicture}}

\begin{document}
\lipsum[1-2]
\end{document}

答案1

文本块左侧距纸张内侧的距离为

1in + \hoffset + \oddsidemargin

在奇数页上

1in + \hoffset + \evensidemargin

由于您正在使用该类booktwoside默认类),所以两个参数通常不同。

在正常情况下,\hoffset为零。但是,它可能会被修改以符合某些打印设备,这些设备对于在纸张上放置东西的位置有不同的想法,因此最好将其保留在计算中。

(一英寸)的原因1in是历史性的并且与 TeX 的标准参考点有关(在我看来,这不是最好的决定)。

相关内容