如何才能使页面边缘靠近黑色边框?
答案1
\documentclass[12pt]{article}
\usepackage[a4paper,margin=20mm]{geometry}
\usepackage{eso-pic,xcolor,lipsum,calc}
\newlength\myborder
\myborder=10pt%please adjust the border width :-)
\pagecolor{red}%please change it back to black :-)
\AddToShipoutPictureBG
{%
\AtPageLowerLeft
{%
\color{white}%
\hspace{\myborder}%
\rule[\myborder]{\paperwidth-2\myborder}{\paperheight-2\myborder}%
}%
}
\begin{document}
\lipsum
\end{document}
答案2
另一种方法是使用以下形式的 TikZ:
\documentclass[letterpaper]{article}
\usepackage{tikz}
\usepackage{lipsum}
\definecolor{bordercolor}{cmyk}{1,.60,0,.40}
\begin{document}
\tikz[remember picture,overlay] {%
\draw [bordercolor,line width=3mm]
(current page.south west)
rectangle
(current page.north east)
;}
\lipsum[1-3]
\end{document}
TikZ 允许我们使用特殊节点访问当前页面的所有边和中心currentpage
。