# Page Borders on Specific Pages, followup to an answer from another question

TeX - LaTeX Asked by Computer Crafter on February 15, 2021

I tried using the answer from Adding a border on each page to create a page border, and it works, but I’m wondering if there’s a way to remove the page border from certain pages?

I would ask this in a comment, but unfortunately I don’t have 50 reputation 🙁

Thanks.

The following is an expanded version of the answer you quote.

% 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

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{[email protected]}
newlength{Pa[email protected]}

% PW modified the AddToShipoutPicture to output nothing for borderon=false
ifthenelse{boolean{borderon}}{%
thinlines
setlength{[email protected]}{paperheight-PageFrameTopMargin-PageFrameBottomMargin}
setlength{[email protected]}{paperwidth-PageFrameLeftMargin-PageFrameRightMargin}
put([email protected],[email protected]){
framebox([email protected]@FrameWidth, [email protected]@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}


This starts off with pages having borders. To stop the bordering put noborders on the page which you want to be borderless. Put borders on the page where you want bordering to start again.

Correct answer by Peter Wilson on February 15, 2021

## Related Questions

### Image path when exporting from Lyx

1  Asked on January 28, 2021 by muzzle

### How to produce bibs of the style used in the figure

0  Asked on January 28, 2021

### Centralized bibliography, build/auxiliary folder, and making sure autocomplete still works

1  Asked on January 28, 2021 by artificial_moonlet

0  Asked on January 28, 2021

### table with siunitx – alignment on precision mode

1  Asked on January 28, 2021

### Compiler says that hbar is invalid in math mode, but I can’t figure out what I should be using instead — all the sources say hbar?

0  Asked on January 28, 2021 by sophibug

### diff against the working directory with git-latexdiff

2  Asked on January 28, 2021 by user2740

### How to disable newpage

1  Asked on January 28, 2021

### How to use title variable inside a class?

1  Asked on January 28, 2021

### Defining -aux-directory for pdflatex breaks citations for natbib

1  Asked on January 28, 2021 by roboreb

### How to prevent latex from removing the margin from a PDF image

2  Asked on January 28, 2021

### TikZ Graph with usebox commands not working

1  Asked on January 28, 2021

### Create an adapted pgfpicture with fixed width for RTL context

1  Asked on January 28, 2021

### Modifying the margins of all slides in Beamer

2  Asked on January 28, 2021 by amin

### How to configure axis on pgfplots?

1  Asked on January 28, 2021 by regis-santos

### Same feature on every page

0  Asked on January 28, 2021 by cwellm

### Error in graphs when passing to pdf

1  Asked on January 28, 2021 by latexlover

### Why isn’t clearfield suppress issue number in footnotes in Biblatex?

1  Asked on January 27, 2021 by ezgranet

### Adding new ligatures to an overleaf-document

0  Asked on January 27, 2021 by aureius