特定頁面上的頁面邊框,另一個問題的答案的後續內容

特定頁面上的頁面邊框,另一個問題的答案的後續內容

我嘗試使用來自的答案在每個頁面上新增邊框建立頁面邊框,它可以工作,但我想知道是否有辦法從某些頁面刪除頁面邊框?

我會在評論中問這個問題,但不幸的是我沒有 50 聲望:(

謝謝。

答案1

以下是您引用的答案的擴展版本。

% noborderprob.tex SE 559677

% the following code mainly from SE 404749
\documentclass{article}

% PW added the folowing code
\usepackage{lipsum} 
\usepackage{ifthen}
\newboolean{borderon} 
\newcommand{\borders}{\setboolean{borderon}{true}}    % have borders
\newcommand{\noborders}{\setboolean{borderon}{false}} % no borders
\borders
% end of addition

\usepackage{calc}
\usepackage{eso-pic}

\newlength{\PageFrameTopMargin}
\newlength{\PageFrameBottomMargin}
\newlength{\PageFrameLeftMargin}
\newlength{\PageFrameRightMargin}

\setlength{\PageFrameTopMargin}{1cm}
\setlength{\PageFrameBottomMargin}{1cm}
\setlength{\PageFrameLeftMargin}{1cm}
\setlength{\PageFrameRightMargin}{1cm}

\makeatletter

\newlength{\Page@FrameHeight}
\newlength{\Page@FrameWidth}

% PW modified the \AddToShipoutPicture to output nothing for borderon=false
\AddToShipoutPicture{
  \ifthenelse{\boolean{borderon}}{%
  \thinlines
  \setlength{\Page@FrameHeight}{\paperheight-\PageFrameTopMargin-\PageFrameBottomMargin}
  \setlength{\Page@FrameWidth}{\paperwidth-\PageFrameLeftMargin-\PageFrameRightMargin}
  \put(\strip@pt\PageFrameLeftMargin,\strip@pt\PageFrameTopMargin){
    \framebox(\strip@pt\Page@FrameWidth, \strip@pt\Page@FrameHeight){}}}
{}}

\makeatother

\begin{document}

\section{Test}

% PW added the following code

\lipsum 

\lipsum 

\noborders % stop page borders

\lipsum

\borders % start page borders

\lipsum

\end{document}

這從有邊框的頁面開始。要停止邊框,請將其放在\noborders您想要無邊框的頁面上。將其放在\borders您想要重新開始邊框的頁面上。

相關內容