I would like to know what are the margins (top, right,bottom and left; in meters) that are by default assigned for thebook
class. Is there a command or a way to know them?
2 Answers
To produce an overview of the layout of the current document, you can use the \layout
command from the layout package:
\documentclass{book}
\usepackage{layout}
\begin{document}
\layout
\end{document}
The ouput is a two page document showing this:
Another option would be to use the layouts package:
\documentclass{book}
\usepackage{layouts}
\newcommand\DocLength[1]{%
The value for \texttt{#1} is \printinunitsof{mm}\prntlen{\csname#1\endcsname}\par}
\begin{document}
\DocLength{evensidemargin}
\DocLength{oddsidemargin}
\end{document}
Using the \pagevalues
command you will obtain a table of the values
of the current document’s page layout parameters; this, together with the showframe
option for the geometry
package, can be useful when designing a new page layout. A little example with some "extreme" values just for illustration:
\documentclass{article}
\usepackage[paperheight=12cm,paperwidth=18cm,includehead,includefoot,showframe]{geometry}
\usepackage{layouts}
\printinunitsof{cm}
\begin{document}
\pagevalues
\end{document}
-
But If I'm not satisfied of margins of my document how can I set them to myself using cm as unit of measure?– MazzyMar 31, 2012 at 21:57
-
1@Mazzy: if you are talking about changing the predefined layout, then use the geometry package. For example,
\usepackage[margin=3cm]{geometry}
will give you 3cm margins. Mar 31, 2012 at 21:59 -
Suppose I would change the margin in this way: odd pages=margin top,bottom,left=3cm and right=3.5cm.even pages=margin top,right,bottom=3cm and left=3.5cm.– MazzyMar 31, 2012 at 22:01
-
@Mazzy Then you could use something like
\usepackage[vmargin=3cm,rmargin=3.5cm,lmargin=3cm]{geometry}
and probably you'll need some other options depending on whether the header/footer are to be included or not in the margins. Read the package documentation to learn all the options it offers. Mar 31, 2012 at 22:10 -
4@Mazzy I think you are leaving that
3.5cm
margin for binding. If so use\usepackage[bindingoffset=0.5cm,margin=3cm]{geometry}
– user11232Mar 31, 2012 at 23:15
It depends on whether you want to include the header/footer and possibly even if you use twoside
document. Perhaps the following minimal working example can be a start:
\documentclass{book}
\usepackage{layouts}% http://ctan.org/pkg/layouts
\begin{document}
\pagevalues
\end{document}
uses the layouts
package to produce
All units are printed in points by default, and there are 0.0351459 points per cm. Note that LaTeX does not use metres as a valid length.
layout
package suggested by Gonzalo Medina you'll see those dimensions. The unit is "printer points": 72.27pt = 1in = 2.54cm10pt
(default),11pt
, and12pt
) and on whether the output is set in single-column or two-column format. To find LaTeX's default values of the margins for each combination of these main options, either use thelayout
package (as is explained in @GonzaloMedina's answer) or open the filesbk10.clo
,bk11.clo
, andbk12.clo
files (.clo
is short for "class option") manually and search for the relevant parameters. I recommend using thelayout
package...