What is the easiest way to get borders around a page in LaTeX?

You're right that it can be done with TikZ, but it's not necessary to load in the whole of TikZ to get the bits required for this. The part that is needed is pgfpages. You can do a lot of page manipulation with this package, but here's some to get you started:

\documentclass{article}
\usepackage{pgf}
\usepackage{pgfpages}

\pgfpagesdeclarelayout{boxed}
{
  \edef\pgfpageoptionborder{0pt}
}
{
  \pgfpagesphysicalpageoptions
  {%
    logical pages=1,%
  }
  \pgfpageslogicalpageoptions{1}
  {
    border code=\pgfsetlinewidth{2pt}\pgfstroke,%
    border shrink=\pgfpageoptionborder,%
    resized width=.95\pgfphysicalwidth,%
    resized height=.95\pgfphysicalheight,%
    center=\pgfpoint{.5\pgfphysicalwidth}{.5\pgfphysicalheight}%
  }%
}

\pgfpagesuselayout{boxed}
\begin{document}

Something simple

\end{document}

Of course, if you're going to use the same layout again and again, put it in a separate style file and \usepackage{mylayouts} in each document.

Note: the package pgf is only needed to provide the command \pgfstroke. As all this does is draw a line, it may be possible to remove this in favour of a \rule of some sort.


Memoir class has option showtrims and commands \trimFrame, \settrimmedsize, \settrims. Example:

\documentclass[10pt,a4paper,showtrims]{memoir}
\trimFrame  
\settrimmedsize{210mm}{145mm}{*} 
\settrims{20mm}{34mm}

I think the easiest way would be to use the crop package. Tikz is not exactly the easiest way, but with tikzpagenodes you can do fancy things.

\documentclass{scrartcl}
\usepackage{tikz}
\usepackage{tikzpagenodes}
\usepackage{scrlayer-scrpage}
\usepackage{lipsum}

\pagestyle{scrheadings}


\newcommand{\jamanta}{\tikz[remember picture,overlay] 
    \draw [blue,line width=2mm]
    (current page.south west)
    rectangle
    (current page.north east)
    ;}

\newcommand{\greenborders}{\tikz[remember picture,overlay] \draw [green]
    (current page text area.south west)
    rectangle
    (current page text area.north east)
    ;}

\chead[\jamanta]{\jamanta} % for page borders

%\chead[\greenborders]{\greenborders} %for margin borders

\begin{document}


\section{A}
\lipsum[1-10]
\section{B}
\lipsum[1-10]

\end{document}

Tags:

Margins

Framed