Place a ruler somewhere on a page
Maybe package layout
will help. It provides the command \layout
which inserts one (onesided document) or two (twosided documents) pages that show the relevant sizes of the current page layout.
\documentclass{book}
\usepackage{geometry}% needed if the format of the document differs from the settings of your TeX system
\usepackage{layout}
\begin{document}
\layout
\end{document}
Odd page:
Even page:
Or you can use package scrlayer
. Then you can define a new page style using a layer with contents=\layercontentsmeasure
.
\documentclass[a4paper]{book}
%\usepackage{geometry}
\usepackage{blindtext}
\usepackage{scrlayer}
\DeclareNewLayer[
foreground,
innermargin,
contents=\layercontentsmeasure
]{measurelayer}
\DeclareNewPageStyleByLayers{measurestyle}{measurelayer}
\begin{document}
\chapter{A Chapter}
\Blindtext
\pagestyle{measurestyle}
\clearpage
\Blindtext
\clearpage
\pagestyle{headings}
\blinddocument
\clearpage
\end{document}
There are other predefined layer areas like topmargin
, head
, headsep
, textarea
,... But you can also define the size and the position of a layer:
\DeclareNewLayer[
foreground,
hoffset=1cm,
voffset=.5cm,
width=2cm,
height=10cm,
contents=\layercontentsmeasure
]{measurelayer}
Or you can modify a predefined layer area:
\DeclareNewLayer[
foreground,
topmargin,
addheight=\dimexpr\headheight+\headsep\relax,
contents=\layercontentsmeasure
]{measurelayer}
Instead of a ruler you could put a grid behind the text with eso-pic
package:
\documentclass{article}
\usepackage[grid,
gridcolor=red!20,
subgridcolor=green!20,
gridunit=in]{eso-pic}
\usepackage{lipsum}
\begin{document}
\lipsum
\end{document}
There is a new package for this aim, namely fgruler
:
http://www.ctan.org/pkg/fgruler
For example, try the following simple code:
\documentclass{article}
\usepackage[type=none]{fgruler}
\begin{document}
\fgruler{upperleft}{1cm}{2cm}
text
\ruler{rightup}{3cm}
text
\end{document}