I am working on a report and I want a border on all pages. I have managed to have a border by using the solution provided here: https://tex.stackexchange.com/a/808/205277

But it won't work on all pages. Any ideas on how to do it? I so wanted to comment on the question itself for help but since I am new here I don't have enough reputation to do that so I had to post this as a separate question

LaTeX preamble:

\setmainfont[Mapping=tex-text]{Times New Roman}
\setsansfont[Scale=0.95,Mapping=tex-text]{Times New Roman}

\usepackage{lipsum} %Just a package for generating garbage text which is not otherwise required 

    logical pages=1,%
    border code=\pgfsetlinewidth{0.5pt}\pgfstroke,%
    border shrink=\pgfpageoptionborder,%
    resized width=.95\pgfphysicalwidth,%
    resized height=.95\pgfphysicalheight,%

  • Is this what you want? \usepackage[margin=3cm]{geometry}
    – Black Mild
    Jan 21, 2020 at 18:02
  • @BlackMild I added my code so hope that helps you have a better understanding of what is going on. I am not setting a margin, I just want a border around my pages Jan 22, 2020 at 12:07
  • you added some code but it is incomplete so no one can run it, and it does not give an example of a page where it does not work. Jan 22, 2020 at 12:29
  • I sent just the LaTeX preamble and not the whole document because it's really big and wouldn't make much sense. I have seen most of these errors are caused by how packages are used, because sometimes these pages inherit properties from the ones above them. After the preamble for each page I just use \pgfpagesuseslayout{boxed}. It worked for the first page but not on others. Jan 23, 2020 at 1:28
  • Hi, I think I have managed to make some progress over finding a solution. Earlier I thought that the reason the borders weren't present was the way the packages were written but now I now it is because of XeLaTeX. For some reason because of it 'pgfpages' is not working as usual. Can someone please suggest a solution to this? Jan 23, 2020 at 15:09

1 Answer 1


I'm not sure that this is an answer, certainly not pertaining to the specifics of your question, but to a generally wider question.

For some years I wrote a column for TUGboat, one of which considered putting borders around pages ( https:/tug.org/TUGboat/tb32-2/tb101glister.pdf ). In particular page 3 of this shows a (fancy) bordered page and on page 4 the macro \goddfoot that was used to create the border.

  • That's some really good LaTeX... I'm just a beginner at all this. But I'll see if your approach towards borders helps me and let you know if it works Jan 23, 2020 at 1:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .