- LaTeX Cookbook
- Stefan Kottwitz
- 417字
- 2021-07-09 21:25:00
Visualizing the layout
At the time of designing a document, one may like to have an exact view of the dimensions and position of the text body, the header and footer, and the space for the margin notes. LaTeX can print help lines for you so you can examine the layout and use it to position extra elements.
How to do it...
Load the showframe
package. This means the following steps:
- Open your document or a sample for testing. Here, we will use the very first document from Chapter 1, The Variety of Document Types.
- Add the following line at the end of your preamble:
\usepackage{showframe}
- Compile the document. You will see frames around text body, margin note area, and header and footer:
- Examining the layout can give you ideas about making adjustments, such as changing the margins or other page dimensions. If you don't need these help lines any more, you can disable the package by commenting out
\usepackage{showframe}
or by deleting it.
How it works...
We simply loaded the showframe
package. It prints the desired help lines on all pages of the document. This package belongs to the eso-pic
bundle, which will help us in the recipe Absolute positioning of text later in the current chapter. As the showframe
package visualizes layout dimensions, it can help with positioning in relation to margins or text body.
There's more...
There are alternatives to the showframe
package. Let's take a look at them.
If you have already loaded the geometry
package to specify page dimensions such as paper size and margin, you could add the option showframes
, instead of loading the separate package with the same name, in the following ways:
- You can add it while loading the package, as follows:
\usepackage[a4paper,bindingoffset=5mm,showframe]{geometry}
- You can load it by calling the
\geometry
command after thegeometry
package has already been loaded, but also in the preamble:\geometry{showframe}
The layout
package provides a command that prints an overview of the layout, and, in addition, the values of various page layout variables. Let's take a look at the following steps:
- Load the
layout
package:\usepackage{layout}
- Insert the command
\layout
right after the\begin{document}
command. - Take a look at the output, here done with our very first recipe in Chapter 1, The Variety of Document Types:
This image is completely generated by the \layout
command, so it can be seen in the manual and on websites. But it shows the current values of the specific document.
- Learning Scala Programming
- R語言數(shù)據(jù)分析從入門到精通
- Building Modern Web Applications Using Angular
- C#編程入門指南(上下冊(cè))
- Visual FoxPro 程序設(shè)計(jì)
- C語言程序設(shè)計(jì)(第2版)
- Python Network Programming Cookbook(Second Edition)
- GeoServer Beginner's Guide(Second Edition)
- 軟件項(xiàng)目管理實(shí)用教程
- SQL 經(jīng)典實(shí)例
- Machine Learning in Java
- Extreme C
- Python+Tableau數(shù)據(jù)可視化之美
- Python大學(xué)實(shí)用教程
- Hack與HHVM權(quán)威指南