官术网_书友最值得收藏!

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:

  1. Open your document or a sample for testing. Here, we will use the very first document from Chapter 1, The Variety of Document Types.
  2. Add the following line at the end of your preamble:
    \usepackage{showframe}
  3. Compile the document. You will see frames around text body, margin note area, and header and footer:
    How to do it...
  4. 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.

Using geometry

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 the geometry package has already been loaded, but also in the preamble:
    \geometry{showframe}

Examining the page layout details

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:

  1. Load the layout package:
    \usepackage{layout}
  2. Insert the command \layout right after the \begin{document} command.
  3. Take a look at the output, here done with our very first recipe in Chapter 1, The Variety of Document Types:
    Examining the page layout details

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.

主站蜘蛛池模板: 庆阳市| 敦煌市| 高雄县| 桐梓县| 河南省| 萍乡市| 静安区| 苏尼特左旗| 盘山县| 贺兰县| 大竹县| 濮阳县| 盐山县| 浠水县| 香河县| 博白县| 海宁市| 本溪| 望城县| 宁陵县| 洪雅县| 基隆市| 遂平县| 离岛区| 朝阳市| 化州市| 桑日县| 黄冈市| 枝江市| 威信县| 深水埗区| 宜兰县| 鄯善县| 鄂伦春自治旗| 门头沟区| 淄博市| 景德镇市| 池州市| 苏州市| 鹿泉市| 仁布县|