该geometry
包使用长度变量(如tmargin
、、bmargin
等headsep
)规定了页眉、页脚、文本区域、边距等区域。
当您在浏览器中执行“检查元素”时,将鼠标悬停在 HTML 行上,HTML 元素将突出显示,直观地显示边距、填充等。
有没有办法在 LaTeX 中做同样的事情?
答案1
一个选项是使用layout
包装以获取显示相关部件及其尺寸的图表:
\documentclass{article}
\usepackage[a5paper,hmargin=2cm]{geometry}
\usepackage{layout}
\begin{document}
\layout
\end{document}
或者,使用另一种方法tikzpagenodes
获得相关区域的视觉划分:
\documentclass{article}
\usepackage[margin=4cm]{geometry}
\usepackage{tikzpagenodes}
\begin{document}
\begin{tikzpicture}[remember picture,overlay]
\draw[blue,line width=2mm]
(current page.south west)
rectangle
(current page.north east);
\draw[green]
(current page text area.south west)
rectangle
(current page text area.north east);
\draw[yellow]
(current page marginpar area.south west)
rectangle
(current page marginpar area.north east);
\draw[red]
(current page header area.south west)
rectangle
(current page header area.north east);
\draw[orange]
(current page footer area.south west)
rectangle
(current page footer area.north east);
\end{tikzpicture}
\end{document}
另一种可能性是使用layouts
包裹:
\documentclass{article}
\usepackage[marginparwidth=1cm]{geometry}
\usepackage{layouts}
\begin{document}
\currentpage
\oddpagelayouttrue
\pagedesign
\end{document}