我添加了这一行:
\noindent\makebox[\linewidth]{\rule{\paperwidth}{0.6pt}}
但这涵盖了整个文档。我希望它停止在边距处。有人有什么建议吗?
答案1
以下是一些选项:
\documentclass{article}
\usepackage{showframe}% For reference of the text block margins
\setlength{\parindent}{0pt}% For this example
\begin{document}
A:% Rule across entire text block
\rule{\linewidth}{.4pt}
B: % Rule from left margin across entire page
\makebox[\linewidth][l]{\rule{\paperwidth}{.4pt}}
C: % Rule from left margin across entire text block + 2cm
\makebox[\linewidth][l]{\rule{\dimexpr\textwidth+2cm}{.4pt}}
D:% Rule from right margin across entire page
\makebox[\linewidth][r]{\rule{\paperwidth}{0.4pt}}
E:% Rule from right margin across entire text block + 2em
\makebox[\linewidth][r]{\rule{\dimexpr\textwidth+2em}{0.4pt}}
\end{document}
指某东西的用途\paperwidth
实际上比需要的要广泛得多,制定规则离开这一页。
将规则与边距对齐的主要原则是设置一个l
向左或r
向右对齐的框。然后可以调整规则的长度以达到所需的效果(例如,在右侧或左侧超出范围)。