今天我想知道如何在页面中添加边框?
\documentclass[10pt, twoside]{book}
\usepackage{amsmath,amsfonts,amssymb}
\setlength{\topmargin}{-.3in}
\setlength{\headsep}{0in}
\setlength{\textheight}{10.2in}
\setlength{\textwidth}{7in}
\setlength{\oddsidemargin}{-.3in}
\setlength{\evensidemargin}{-.3in}
\setlength{\topskip}{.2in}
\begin{document}
Text text text. Text text text text. Text text text text. Text text text. \\
Text text text text. Text text text text. Text text text. Text text text text. Text
text text text. Text text text. Text text text text. Text text text text. Text text
text. Text text text text. Text text text text. Text text text. Text text text text.
Text text text text. Text text text. Text text text text. Text text text text. Text
text text. Text text text text. Text text text text. Text text text. Text text text
text. Text text text text. Text text text. Text text text text. Text text text text.
Text text text. Text text text text. Text text text text. Text text text. Text text
text text. Text text text text. Text text text. Text text text text. Text text text
text. Text text text. Text text text text. Text text text text. Text text text. Text
text text text. Text text text text. Text text text. Text text text text. Text text
text text. Text text text. Text text text text. Text text text text. Text text text.
Text text text text. Text text text text. Text text text. Text text text text. Text
text text text. Text text text. Text text text text. Text text text text. Text text
text. Text text text text. Text text text text. Text text text. Text text text text.
Text text text text. Text text text. Text text text text. Text text text text. Text
text text. Text text text text. Text text text text. Text text text. Text text text
text. Text text text text. Text text text. Text text text text. Text text text text.
Text text text. Text text text text. Text text text text. Text text text. Text text
text text. Text text text text. Text text text. Text text text text. Text text text
text. Text text text. Text text text text. Text text text text. Text text text. Text
text text text. Text text text text. Text text text. Text text text text. Text text
text text. Text text text. Text text text text. Text text text text. Text text text.
Text text text text. Text text text text. Text text text. Text text text text. Text
text text text. Text text text. Text text text text. Text text text text. Text text
text. Text text text text. Text text text text. Text text text. Text text text text.
Text text text text.
\end{document}
如何在页面周围添加边框?其他所有页面也应该如此。请帮助我,提前谢谢
答案1
您可以使用或tikzpagenodes
包来完成这项工作。示例如下:eso-pic
background
eso-pic
\documentclass[10pt, twoside]{book}
\usepackage{amsmath,amsfonts,amssymb}
\usepackage{lipsum} %% for dummy text
\usepackage[a4paper,margin=0.8in, headsep=0in, heightrounded, nomarginpar]{geometry}
\usepackage{eso-pic}
\usepackage{tikzpagenodes}
\AddToShipoutPictureBG{
\AtPageUpperLeft{
\begin{tikzpicture}[remember picture,overlay]
\draw [red!80,very thick]
([shift={(-5mm,-5mm)}]current page text area.south west)
rectangle
([shift={(5mm,5mm)}]current page text area.north east);
\end{tikzpicture}
}
}
\begin{document}
\lipsum[1-50]
\end{document}
和background
:
\documentclass[10pt, twoside]{book}
\usepackage{amsmath,amsfonts,amssymb}
\usepackage{lipsum} %% for dummy text
\usepackage[a4paper,margin=0.8in, headsep=0in, heightrounded, nomarginpar]{geometry}
\usepackage{background}
\usepackage{tikzpagenodes}
\backgroundsetup{
scale=1,
opacity=1,
angle=0,
color=black,
contents={%
\begin{tikzpicture}[remember picture,overlay]
\draw [red!80,very thick]
([shift={(-5mm,-5mm)}]current page text area.south west)
rectangle
([shift={(5mm,5mm)}]current page text area.north east);
\end{tikzpicture}
}
}
\begin{document}
\lipsum[1-50]
\end{document}
这两者都需要 2-3 次编译才能稳定下来。
答案2
你可以有一个框架文本用framed
包。在这段代码中,我用几何包重现了你的布局,它清楚地显示了一个问题:最后一行位于物理页面的底部。
\documentclass[10pt, twoside]{book}
\usepackage{amsmath,amsfonts,amssymb}
\setlength{\topskip}{.2in}
\usepackage[top=0.87in, left=0.7in, headsep=0in, height=10.2in, width=7in, nomarginpar]{geometry}
\usepackage[x11names]{xcolor}
\usepackage{lipsum}
\usepackage{framed}
\colorlet{framecolor}{LightSalmon1}
\setlength\FrameRule{2pt}
\newenvironment{colourframed}{%
\def\FrameCommand{\fboxrule=\FrameRule\fboxsep=\FrameSep \fcolorbox{framecolor}{white}}%
\MakeFramed {\FrameRestore}}%
{\endMakeFramed}
\newenvironment{colourframed*}{%
\def\FrameCommand{\fboxrule=\FrameRule\fboxsep=\FrameSep \fcolorbox{framecolor}{white}}%
\MakeFramed {\advance\hsize-\width \FrameRestore}}%
{\endMakeFramed}
\begin{document}
\begin{colourframed*}
Text text text. Text text text text. Text text text text. Text text text. \\
Text text text text. Text text text text. Text text text. Text text text text. Text
text text text. Text text text. Text text text text. Text text text text. Text text
text. Text text text text. Text text text text. Text text text. Text text text text.
Text text text text. Text text text. Text text text text. Text text text text. Text
text text. Text text text text. Text text text text. Text text text. Text text text
text. Text text text text. Text text text. Text text text text. Text text text text.
Text text text. Text text text text. Text text text text. Text text text. Text text
text text. Text text text text. Text text text. Text text text text. Text text text
text. Text text text. Text text text text. Text text text text. Text text text. Text
text text text. Text text text text. Text text text. Text text text text. Text text
text text. Text text text. Text text text text. Text text text text. Text text text.
Text text text text. Text text text text. Text text text. Text text text text. Text
text text text. Text text text. Text text text text. Text text text text. Text text
text. Text text text text. Text text text text. Text text text. Text text text text.
Text text text text. Text text text. Text text text text. Text text text text. Text
text text. Text text text text. Text text text text. Text text text. Text text text
text. Text text text text. Text text text. Text text text text. Text text text text.
Text text text. Text text text text. Text text text text. Text text text. Text text
text text. Text text text text. Text text text. Text text text text. Text text text
text. Text text text. Text text text text. Text text text text. Text text text. Text
text text text. Text text text text. Text text text. Text text text text. Text text
text text. Text text text. Text text text text. Text text text text. Text text text.
Text text text text. Text text text text. Text text text. Text text text text. Text
text text text. Text text text. Text text text text. Text text text text. Text text
text. Text text text text. Text text text text. Text text text. Text text text text.
Text text text text.
\lipsum[1-12]
\end{colourframed*}
\end{document}