With tikz
and eso-pic
. I've defined two commands, \addframe
and \removeframe
which, respectively, add the frame and remove the frame in the page.
MWE:
\documentclass{article}
\usepackage{tikzpagenodes}
\usetikzlibrary{calc}
\usepackage{eso-pic}
\newcommand{\addframe}{%
\AddToShipoutPicture{%
\begin{tikzpicture}[remember picture, overlay]
\draw[line width=1pt]
($(current page text area.north west) +(-5mm,5mm)$)
rectangle
($(current page text area.south east) +(5mm,-5mm)$);
\end{tikzpicture}%
}%
}
\newcommand{\removeframe}{\ClearShipoutPicture}
\usepackage{lipsum} % just for the example
\begin{document}
\addframe
\lipsum[1-10]
\clearpage
\removeframe
\lipsum[1-10]
\clearpage
\addframe
\lipsum[1-10]
\end{document}
Output:

You can adjust the parameters (1pt
for the thickness and 5mm
for the distance from the text) as you want.
Alternatively, you can define \addframe
in this way
\newcommand{\addframe}{%
\begin{tikzpicture}[remember picture, overlay]
\draw[line width=1pt]
($(current page text area.north west) +(-5mm,5mm)$)
rectangle
($(current page text area.south east) +(5mm,-5mm)$);
\end{tikzpicture}%
}
and use \addframe
in every page where you need the frame, as in the following MWE:
\documentclass{article}
\usepackage{tikzpagenodes}
\usetikzlibrary{calc}
\newcommand{\addframe}{%
\begin{tikzpicture}[remember picture, overlay]
\draw[line width=1pt]
($(current page text area.north west) +(-5mm,5mm)$)
rectangle
($(current page text area.south east) +(5mm,-5mm)$);
\end{tikzpicture}%
}
\usepackage{lipsum} % just for the example
\begin{document}
\addframe
\lipsum[1-10]
\clearpage
\lipsum[1-10]
\clearpage
\addframe
\lipsum[1-10]
\end{document}
mdframed
. – Johannes_B Mar 22 '14 at 12:41