![如何给页面内容添加边框](https://linux22.com/image/478573/%E5%A6%82%E4%BD%95%E7%BB%99%E9%A1%B5%E9%9D%A2%E5%86%85%E5%AE%B9%E6%B7%BB%E5%8A%A0%E8%BE%B9%E6%A1%86.png)
\documentclass[letterpaper,10pt]{报告}
\newenvironment{packed_enum}{
\begin{enumerate}
\setlength{\itemsep}{1pt}
\setlength{\parskip}{0pt}
\setlength{\parsep}{0pt}
}{\end{enumerate}}
\begin{document}
\chapter{Movies I need to watch}
Here is a short list of movies \marginpar{Flag A -- This note will appear in the margin.} I need to watch some day:
\begin{packed_enum}
\item The Longest Day
\item Kill Bill 1
\item Kill Bill 2
\item Pretty much every other movie created in the last 30 years. :)
\end{packed_enum}
\end{document}
答案1
您需要运行两次。它将 tikzpicture 位置存储在 aux 文件中。
\documentclass[letterpaper,10pt]{report}
\usepackage{everypage}
\usepackage{tikzpagenodes}
\usetikzlibrary{calc}
\newenvironment{packed_enum}{
\begin{enumerate}
\setlength{\itemsep}{1pt}
\setlength{\parskip}{0pt}
\setlength{\parsep}{0pt}
}{\end{enumerate}}
\newcommand{\myframe}{\begin{tikzpicture}[remember picture, overlay]
\draw[blue,thick] ($(current page text area.south west) + (-2pt,-2pt)$) rectangle
($(current page text area.north east) + (2pt,2pt)$);
\end{tikzpicture}}% easier to debug
\AddEverypageHook{\myframe}
\begin{document}
\chapter{Movies I need to watch}
Here is a short list of movies \marginpar{Flag A -- This note will appear in the margin.} I need to watch some day:
\begin{packed_enum}
\item The Longest Day
\item Kill Bill 1
\item Kill Bill 2
\item Pretty much every other movie created in the last 30 years. :)
\end{packed_enum}
\end{document}
答案2
您可以使用eso-pic
利用 shipout 例程(\AddToShipoutPictureFG
-文档中每一页的F
矿石轮),添加所需宽度:G
\frame
\AtPageCenter
\documentclass{article}
\usepackage{eso-pic,lipsum}
\AddToShipoutPictureFG{%
\AtPageCenter{%
\makebox[0pt]{\raisebox{-.5\height}{%
\frame{%
\rule{.9\paperwidth}{0pt}% Horizontal 0pt-width rule
\rule{0pt}{.9\paperheight}% Vertical 0pt-width rule
}
}}%
}%
}
\begin{document}
\lipsum[1-50]
\end{document}
\makebox[0pt]
确保\frame
水平设置在页面中间,而\raisebox{-.5\height}
确保\frame
垂直设置在页面中间。