Skip to main content

Control over LaTeX page margins (or borders)

Until recently, page margins in LaTeX had more control over me than I had over them. I already heard that package geometry could be of use here, but quick hacks seemed more fun than going through the docs of that package. I had a closer look now and geometry turned out to be much more convenient than I expected in the end. The code that I experimented with can be reduced to this snippet:

%% Demo by Sebastian Pipping <>
%% Released to the public domain
\usepackage[hmargin=2cm,vmargin=1cm]{geometry}  % !!!

So I am abusing \rule here to draw a filled rectangle that spans the whole content area. I am asking for horizontal margins of 2cm width and vertical ones of 1cm height. Strangely, the output I received did not match my expectations. Look how much bigger the left margin is than the right one. It turns out that indentation of the first line of a paragraph is at work here. The insertion of \noindent solved that problem.