Debian Codegraph @

texmf-dist/doc/latex/pagelayout/pagelayout-manual.tex

raw
1 %%
2 %% Copyright (c) 2022-2024 by Friedemann Bartels
3 %%
4 %% This file may be distributed and/or modified under the
5 %% conditions of the LaTeX Project Public License, either
6 %% version 1.3c of this license or (at your argument) any later
7 %% version. The latest version of this license is in:
8 %%
9 %% http://www.latex-project.org/lppl.txt
10 %%
11 %% and version 1.3c or later is part of all distributions of
12 %% LaTeX version 2008/05/04 or later.
13 %%
14
15 \documentclass[a4paper]{ltxdoc}
16 \usepackage{microtype}
17 \usepackage{hyperref}
18 \usepackage{tikz}
19 \OnlyDescription
20 \hypersetup{pdfborder={0 0 0}}
21 \def\pagelayoutversion{1.1.1}
22
23 \begin{document}
24
25 \title{
26 \Huge The \textsf{pagelayout} class\vskip3mm
27 \Large Manual for Version \pagelayoutversion\vskip3mm
28 \normalsize\url{https://github.com/friedemannbartels/latex-pagelayout}
29 }
30
31 \author{\href{mailto:[email protected]}{Friedemann Bartels}}
32
33 \maketitle
34
35 \tableofcontents
36
37 \newpage
38
39 \section{Introduction}
40
41 When Apple discontinued its photo book feature in Apple Photos, I was missing an easy-to-use photo book application.
42 In 2020, I started to develop my own solution.
43 What started with some SVG templates and shell scripts ended up in the pagelayout class, a declarative desktop publishing approach.
44 \par
45 With the pagelayout class you can create single- and double-sided documents, create pages with margins, safety margins, and bleed, use templates, align text and graphics in a grid, wrap text across multiple pages and use before pages.
46 Automatic grid layout and a simple and consistent user interface make it easier than ever to create graphics-rich documents with \LaTeX.
47 Under the hood the TikZ and tcolorbox packages, ImageMagick and Inkscape are used.
48
49 \section{Document}\label{sec:document}
50
51 The document arguments described in the following can be either set as a document argument (|\documentclass[twoside]{pagelayout}|) or with a command (|\twoside|) in the preamble.
52
53 \DescribeMacro {\documentclass}
54 Use the class with the |\documentclass|\oarg{arguments}|{pagelayout}| command.
55 A single sided document is the default.
56 \begin{figure}[h!]
57 \begin{tikzpicture}
58 \draw[black, thin] (0,0) rectangle (1,1);
59 \draw[black, line width=1.5pt,line cap=round] (0,0) -- (0,1);
60 \draw[black, thin] (1.25,0) rectangle (2.25,1);
61 \draw[black, line width=1.5pt,line cap=round] (1.25,0) -- (1.25,1);
62 \draw[black, thin] (2.5,0) rectangle (3.5,1);
63 \draw[black, line width=1.5pt,line cap=round] (2.5,0) -- (2.5,1);
64 \end{tikzpicture}
65 \end{figure}
66
67 \DescribeMacro {\twoside}
68 Using the document argument |twoside| results in a document with left and right pages.
69 When you create a two-sided document, your document always has an even number of pages.
70 If you create a document with an odd number of pages, an additional page is automatically inserted.
71 Two-sided documents start with a right page by default.
72 \begin{figure}[h!]
73 \begin{tikzpicture}
74 \draw[black, thin] (0,0) rectangle (1,1);
75 \draw[black, line width=1.5pt,line cap=round] (0,0) -- (0,1);
76 \draw[black, thin] (1.25,0) rectangle (2.25,1);
77 \draw[black, line width=1.5pt,line cap=round] (2.25,0) -- (2.25,1);
78 \draw[black, thin] (2.35,0) rectangle (3.35,1);
79 \draw[black, line width=1.5pt,line cap=round] (2.35,0) -- (2.35,1);
80 \draw[black, thin] (3.6,0) rectangle (4.6,1);
81 \draw[black, line width=1.5pt,line cap=round] (4.6,0) -- (4.6,1);
82 \end{tikzpicture}
83 \end{figure}
84
85 \DescribeMacro {\beginleft}
86 Use the argument |beginleft| to begin with a left page.
87 \begin{figure}[h!]
88 \begin{tikzpicture}
89 \draw[black, thin] (0,0) rectangle (1,1);
90 \draw[black, line width=1.5pt,line cap=round] (1,0) -- (1,1);
91 \draw[black, thin] (1.1,0) rectangle (2.1,1);
92 \draw[black, line width=1.5pt,line cap=round] (1.1,0) -- (1.1,1);
93 \draw[black, thin] (2.35,0) rectangle (3.35,1);
94 \draw[black, line width=1.5pt,line cap=round] (3.35,0) -- (3.35,1);
95 \draw[black, thin] (3.45,0) rectangle (4.45,1);
96 \draw[black, line width=1.5pt,line cap=round] (3.45,0) -- (3.45,1);
97 \end{tikzpicture}
98 \end{figure}
99
100 By default, each page is placed on one paper.
101 \DescribeMacro {\fanfold}
102 With the |fanfold| argument you can change this behavior so that a left and a right page are placed on one paper.
103 In this case, the first page is a left one by default.
104 \begin{figure}[h!]
105 \begin{tikzpicture}
106 \draw[black, thin] (0,0) rectangle (1,1);
107 \draw[black, thin] (1,0) rectangle (2,1);
108 \draw[black, line width=1.5pt,line cap=round] (1,0) -- (1,1);
109 \draw[black, thin] (2.25,0) rectangle (3.25,1);
110 \draw[black, thin] (3.25,0) rectangle (4.25,1);
111 \draw[black, line width=1.5pt,line cap=round] (3.25,0) -- (3.25,1);
112 \end{tikzpicture}
113 \end{figure}
114
115 \DescribeMacro {\cover}
116 The |cover| argument is similar to the |fanfold| argument, but only applied to cover pages.
117 Read more about cover pages in section~\ref{sec:pages}.
118 \begin{figure}[h!]
119 \begin{tikzpicture}
120 \draw[black, thin] (0,0) rectangle (2.3,1);
121 \draw[black, line width=1.5pt,line cap=round] (1,0) -- (1,1);
122 (3.25,1);
123 \draw[black, line width=1.5pt,line cap=round] (1.3,0) -- (1.3,1);
124 (3.25,1);
125 \end{tikzpicture}
126 \end{figure}
127
128 \DescribeMacro {\beginright}
129 If you want your fanfold document to start with a right hand page, you can use the argument |beginright|.
130 \begin{figure}[h!]
131 \begin{tikzpicture}
132 \draw[black, thin] (0,0) rectangle (1,1);
133 \draw[black, thin] (0,0) -- (1,1);
134 \draw[black, thin] (0,1) -- (1,0);
135 \draw[black, thin] (1,0) rectangle (2,1);
136 \draw[black, line width=1.5pt,line cap=round] (1,0) -- (1,1);
137 \draw[black, thin] (2.25,0) rectangle (3.25,1);
138 \draw[black, thin] (3.25,0) rectangle (4.25,1);
139 \draw[black, line width=1.5pt,line cap=round] (3.25,0) -- (3.25,1);
140 \draw[black, thin] (4.5,0) rectangle (5.5,1);
141 \draw[black, thin] (5.5,0) rectangle (6.5,1);
142 \draw[black, thin] (5.5,0) -- (6.5,1);
143 \draw[black, thin] (5.5,1) -- (6.5,0);
144 \draw[black, line width=1.5pt,line cap=round] (5.5,0) -- (5.5,1);
145 \end{tikzpicture}
146 \end{figure}
147
148 \subsection{Lengths}\label{subsec:size}
149
150 The document lengths described below can be set either as a document argument (|\documentclass[page width=21cm]{pagelayout}|) or by assigning the dimension directly (|\pagewidth=21cm|) in the preamble or in the document.
151
152 \DescribeMacro {\pagewidth}
153 \DescribeMacro {\pageheight}
154 You can set the lengths |page width| and |page height|.
155 The default page size is |210mm| by |297mm|.
156
157 \DescribeMacro {\bleed}
158 You can set the |bleed| length.
159 It applies to all paper edges.
160 The default bleed is |0mm|.
161 You can override the bleed for each edge separately by defining the lengths |top bleed|, |inner bleed|, |bottom bleed|, |outer bleed|.
162 The paper size results from the page size and the bleed.
163
164 \DescribeMacro {\safetymargin}
165 The |safety margin| is the only length that has no influence on the final result.
166 Its only purpose is to control the safe zone when editing.
167 It is |0mm| by default and can be configured for each edge by defining |top safety margin|, |inner safety margin|, |bottom safety margin| and |outer safety margin|.
168
169 \DescribeMacro {\margin}
170 \DescribeMacro {\gutter}
171 You can set the lengths |margin| and |gutter| for the document, for a page (see section~\ref{sec:pages}) or for a grid (see section~\ref{sec:grid}).
172 The default margin is |20mm|, the default gutter is |0mm|.
173 Similar to bleed and safety margin, the margin can be defined for each edge individually by setting |top margin|, |outer margin|, |bottom margin| and |inner margin|.
174
175 You can create documents with cover pages.
176 \DescribeMacro {\coverwidth}
177 \DescribeMacro {\coverheight}
178 Read more about creating cover pages in section~\ref{sec:pages}.
179 You can set the lengths |coverwidth| and |coverheight|.
180 By default, the cover pages are the same size as the inside pages.
181 If you want to create a cover with a spine, use the |fanfold| or |cover| argument described in section~\ref{sec:document}.
182 In this case the length |spinewidth| takes effect.
183 The default spine width is |3mm|.
184 \par
185 You can overwrite the bleed and the safety margin for cover pages.
186 To do this, prefix the respective lengths described above.
187 For example, define |cover inner bleed| or |cover safety margin|.
188
189 \subsection{Page Graphics and Colors}\label{subsec:colors}
190
191 You can define a page graphic and a page color with the arguments |page graphic| and |page color|.
192 Set the argument |color| to define the text color.
193 These arguments can be defined for the document or for each page (see section~\ref{sec:pages}).
194 \par
195 Read how to set the scale and crop of a page graphic with the |\newgraphic| command in section~\ref{sec:content}.
196
197 \subsection{Layout Guides}
198
199 The layout guides described in the following can be either set as a document argument (|\documentclass[grid]{pagelayout}|) or using a command (|\grid|) in the preamble or the document.
200 Layout guides can be switched on (|\safezone|) or off (|\nosafezone|).
201
202 \DescribeMacro {\grid}
203 The |grid| argument visualizes the margin and the grid gutters with green lines.
204 Read more about the grid in section~\ref{sec:grid}.
205 \DescribeMacro {\safezone}
206 The |safezone| layout guide shows a red border for the bleed and a thin pink line to indicate the safety margin.
207 \DescribeMacro {\cuttingmarks}
208 As an alternative to |safezone|, you can also use |cutting marks| to display cutting marks.
209 \DescribeMacro {\graphpaper}
210 Show a graph paper with the |graph paper| argument.
211
212 \begin{figure}[h]
213 \begin{tikzpicture}
214 \node[anchor=south west,inner sep=0] (image) at (0,0) {\includegraphics[trim={15cm 16.5cm 0cm 0},clip,scale=1,page=1]{pagelayout-manual-layout-guides.pdf}};
215 \node[anchor=south west,text depth=0mm,text width=4cm] (bleed) at (65mm,33mm) {Bleed};
216 \draw (bleed) -- ++(-32mm,0);
217 \node[anchor=south west,text depth=0mm,text width=4cm] (bleed) at (65mm,27mm) {Safety margin};
218 \draw (bleed) -- ++(-35mm,0.0);
219 \node[anchor=south west,text depth=0mm,text width=4cm] (margin) at (65mm,21mm) {Margin};
220 \draw (margin) -- ++(-43mm,0.0);
221 \node[anchor=south west,text depth=0mm,text width=4cm] (gutter) at (65mm,15mm) {Gutter};
222 \draw (gutter) -- ++(-70mm,0.0);
223 \node[anchor=south west,text depth=0mm,text width=4cm] (placeholder) at (65mm,9mm) {Placeholder};
224 \draw (placeholder) -- ++(-50mm,0.0);
225 \node[anchor=south west,text depth=0mm,text width=4cm] (graphpaper) at (65mm,3mm) {Graph paper};
226 \draw (graphpaper) -- ++(-40mm,0.0);
227 \end{tikzpicture}%
228 \end{figure}
229
230 \DescribeMacro {\placeholders}
231 The |placeholders| argument shows template placeholders.
232 Read more about templates in section~\ref{sec:templates}.
233 \DescribeMacro {\fillpages}
234 If you create a document with a cover and a first right hand page, use the |fill pages| argument during editing to add blank pages to get a better impression of the final result.
235
236 \subsection{Draft Mode}\label{subsec:draftmode}
237
238 The |draft| argument is a shortcut to enable the arguments |placeholders|, |cutting marks| and |fill pages|.
239 It also speeds up rebuilding the PDF when changing the document.
240
241 \section{Pages}\label{sec:pages}
242
243 \DescribeMacro {\page}
244 Create a page with the command |\page|\oarg{arguments}\marg{content}.
245 You can overwrite the document arguments |margin|, |top margin|, |bottom margin|, |inner margin|, |outer margin|, |gutter|, |page color|, |page graphic| and |color| for each page.
246
247 Use the argument |double| to create a double page.
248 When creating a double page after a left page, a right page is automatically inserted before the double page.
249 The argument |double| is only recognized for double sided documents.
250 \par
251 Use the arguments |front cover| or |back cover| to create a front or back cover.
252 If you have a back cover and a front cover, the back cover page must be defined first.
253 If no argument is active, the front cover is placed as the first page and the back cover as the last page of the document.
254 In this case, the only difference from normal pages is that the cover pages are not counted in the page numbering.
255 \par
256 If the argument |fanfold| or |cover| is selected, the back and front covers are laid out on one paper so that the cover is suitable for a book with a hard or soft cover (see section~\ref{sec:document}).
257 Space is reserved between the back and front covers for the spine.
258 Set the |spine width| document argument as described in section~\ref{subsec:size}.
259 \par
260 With the arguments |hpos| and |vpos| you can set the default grid alignment for a page.
261 Read more about the grid in the next section.
262
263 \DescribeMacro {\setpagecolor}Alternativly to the argument you can use the command |\setpagecolor|\marg{color} to set the page color for all following pages.
264
265 \DescribeMacro {\setpagegraphic}With the command |\setpagegraphic|\oarg{arguments}\marg{name} you can define a page graphic for all following pages.
266 The name references a graphic version created with the |\newgraphic| command (see section~\ref{sec:content}).
267 If no graphic version with the given name exists, the command uses the name as the file name.
268 You can change the clipping by defining relative decimal values for the arguments |scale| (>1), |hpos| and |vpos| (0-1).
269
270 \DescribeMacro {\newbeforepage}With the command |\newbeforepage|\marg{name}\marg{content} you can create a reusable page layer, that can be set before pages.
271 \DescribeMacro {\setbeforepage}
272 Use the command |\setbeforepage|\marg{name} to define a before page for all following pages or use the page argument |before page| to specify a before page for a individual page.
273
274 \DescribeMacro {\ifleftpage}
275 \DescribeMacro {\ifrightpage}
276 Use the condition |\ifleftpage|\marg{content} and |\ifrightpage|\marg{content} to check for the current page alignment.
277
278 \DescribeMacro {\leftpage}
279 Within a page scope you can use the |\leftpage|\marg{content} command to place content only on a left page.
280 In comparison to the |\ifleftpage|\marg{content} condition, the command sets a grid for a single page.
281 That way you can combine single with double page layouts.
282 \DescribeMacro {\rightpage}
283 Accordingly you can use the |\rightpage|\marg{content} command.
284
285 \section{Grid}\label{sec:grid}
286
287 The grid allows you to create rows with cells.
288 You can define width and height relations between rows and cells.
289 All definitions are relative.
290 The size and position results from these relations and the configured dimensions page width, page height, margin and gutter.
291
292 \DescribeMacro{\setgrid}
293 Create a grid with the command |\setgrid|\oarg{arguments}\marg{config}.
294 The grid configuration is a nested list of rows and cells.
295 A cell is defined by a number that describes the width ratio to the other cells in the row.
296 The default grid describes a row with one cell:
297
298 \begin{verbatim}
299 \setgrid{
300 {{}}}
301 \end{verbatim}
302
303 You can define a width relation between cells by adding a integer value for each cell:
304
305 \begin{verbatim}
306 \setgrid{
307 {{1}{2}}}
308 \end{verbatim}
309
310 With an optional integer value for each row you can set a height relation between rows:
311
312 \begin{verbatim}
313 \setgrid{
314 {[2]{1}{2}}
315 {[1]{1}{2}}}
316 \end{verbatim}
317
318 You can set an aspect ratio for a cell by adding a |!| to the width.
319 This way the aspect ratio is defined by the width of the cell and the height of the row.
320 If all cells in a row have a fixed aspect ratio, the aspect ratio of the row is fixed too.
321 In the following, a row with only fixed cells is named a fixed row.
322 Because the height of a fixed row is determined by the aspect ratios of the cells, the height relation to the flexible rows is broken.
323 In this case, you can force a height relation between flexible and fixed rows by adding a |!| to the height of the flexible row.
324 In the following, a row with a forced height is named a forced row.
325
326 The example defines a first fixed row with one cell and an aspect ratio of 3:2.
327 The height of the second row is forced half of the height of the first row.
328 The cells in the second row share the available width in the ratio one to two:
329
330 \begin{verbatim}
331 \setgrid{
332 {[2]{3!}}
333 {[1!]{1}{2}}}
334 \end{verbatim}
335
336 If the height of fixed and forced rows exceeds the available height, the grid shrinks to fit the available space.
337 The defined aspect ratios of the cells are preserved and the grid is centered horizontally.
338 In this case you can define the |hpos| argument to align the grid horizontally.
339 A value of |0| aligns the grid to the left, a value of |1| aligns the grid to the right.
340 The default is a value of |0.5|.
341
342 If the height of fixed and forced rows is less than the available height, all flexible rows share the excess height.
343 If there are no flexible rows, the grid is centered vertically.
344 In this case you can define the |vpos| argument to align the grid vertically.
345 A value of |0| aligns the grid to the top, a value of |1| aligns the grid to the bottom.
346 The default is a value of |0.5|.
347
348 As for a document or a page you can set |margin| and |gutter| arguments for a specific grid.
349 With the arguments |width|, |height|, |x| and |y| you can override the intrinsic grid size and position.
350 When overriding the grid size and position, you can calculate with the intrinsic values, for example |x=\x-1cm|.
351
352 \subsection{Placing Content}
353
354 The grid aligns content (see section~\ref{sec:content}) automatically in the given grid cells.
355 To set the position of a content box manually use the command |\place|\marg{fromrow fromcell torow tocell}.
356 \DescribeMacro{\place}
357 To place content in the first row and first cell use the command |\place{0 0 1 1}| before the content.
358 The definded place applies only for the following content box.
359 The next boxes are then again placed with auto layout.
360 \par
361 The command accepts decimals.
362 That allows you to place content everywhere within the grid.
363 The |gutter| is taken into account when calculating the positions.
364
365 \section{Content}\label{sec:content}
366
367 \subsection{Text}
368
369 \DescribeMacro{\text}
370 With the command |\text|\oarg{arguments}\marg{text} you can place text.
371 Align the text vertically with the |center| and |bottom| arguments.
372 \par
373 The |\text| command uses the package tcolorbox and accepts tcolorbox arguments, for example to set text, frame or background color and transparency.
374 The tcolorbox behaves slightly diffenrent then the standalone version: spacings, rules and background are removed by default.
375 You can change the behaviour with the tcolorbox command |\tcbset|\marg{arguments}.
376 Also the |arc| arguments behaves different: if you set the |arc| to |0pt| the |outer arc| is also set to |0pt|.
377 \par
378 Add the argument |breakable| to break text over multiple boxes and pages.
379 \DescribeMacro{\usetext}
380 Use the command |\usetext|\oarg{name} to place the following text boxes in the grid.
381 If you want to use multiple breakable text boxes you can initialize the text with the |name| argument and define a name that you then can pass to the |\usetext| argument.
382 Breakable text boxes may have different heights and positions.
383 To align the baselines use the |baselinesnap| argument and set the baseline dimension, for example |baselinesnap=\baselineskip|.
384 \par
385 The |\text| command accepts the arguments |shadow|, |shadow size|, |shadow color|, |shadow opacity|, |shadow xshift|, |shadow yshift|, |border|, |border width|,\break |border color| and |border radius|.
386 Read more about shadows and borders in section~\ref{subsec:borders}.
387
388 \subsection{Graphics}
389
390 \DescribeMacro{\newgraphic}
391 Create a reusable graphic version with the |\newgraphic|\marg{name}\marg{arguments} command.
392 Define the arguments |scale| (>1), |hpos| and |vpos| (0-1) to set the clipping of the graphic.
393 With the argument |file| you can link a file.
394 If no file is defined, the name is used as the file name.
395
396 \DescribeMacro{\graphic}
397 The command |\graphic|\oarg{arguments}\marg{name} places a graphic.
398 The name references a graphic version created with the command |\newgraphic|.
399 If no graphic version with the given name exists, the command uses the name as the file name.
400
401 The graphic is scaled to fit in the content box.
402 If the aspect ratio of the graphic differs from that of the defined content box, the graphic is cropped.
403 You can change the cropping by defining relative decimal values for the arguments |scale| (>1), |hpos| and |vpos| (0-1).
404 With the |orientation| argument you can set the Exif orientation flag (1-8).
405 To flip a graphic horizontally or vertically use the arguments |hflip| or |vflip|.
406 Same as the |\text| command, the |\graphic| command accepts the |border| and |shadow| arguments described in section~\ref{subsec:borders}.
407
408 \DescribeMacro{\graphicspath}
409 You can use the command |\graphicspath|\marg{dir-list} of the graphics package to specify a list of directories in which to search for graphic files.
410
411 \subsection{Other}
412
413 \DescribeMacro{\xput}
414 The command |\xput|\marg{code} is an easy way to place arbitrary content in the grid.
415 Within the code block the dimensions |\width| and |\height| represent the size of the content area and can be used to create graphics, that fit and adapt to the available size.
416 \par
417 \DescribeMacro{\tikzgraphic}
418 The command |\tikzgraphic|\marg{tikz code} works like the |\xput| command, but wraps your input in a |tikzpicture|.
419
420 \subsection{Shadows and Borders}\label{subsec:borders}
421
422 Text and graphic content can be placed with a border or a shadow.
423 You can define a border or shadow for a specific content box by using the arguments |border width|, |border color|, |border radius| to add a border or |shadow size|, |shadow color|, |shadow opacity|, |shadow xshift|, |shadow yshift| to add a shadow.
424 \par
425 \DescribeMacro{\newborder}
426 \DescribeMacro{\newshadow}
427 Define a reusable border or shadow with the |\newborder|\marg{name}\marg{arguments} or |\newshadow|\marg{name}\marg{arguments} commands.
428 Apply the border or shadow to |\text| or |\graphic| with the argument |border| or |shadow|.
429 \par
430 \DescribeMacro{\setborder}
431 \DescribeMacro{\setshadow}
432 To set a border or shadow within a page or document scope, use the commands |\setborder|\oarg{arguments}\marg{name} or |\setshadow|\oarg{arguments}\marg{name}.
433
434 \section{Templates}\label{sec:templates}
435
436 \DescribeMacro{\newtemplate}
437 With the command |\newtemplate|\marg{name}\marg{layout} you can create a reusable layout.
438 Creating a template works the same way as creating a page.
439 In addition to graphics and text you can define placeholders.
440 \DescribeMacro{\placeholder}
441 Use the command |\placeholder|\marg{fromrow fromcell torow tocell} to define a content area that can later be filled with a text or a graphic.
442
443 \DescribeMacro{\template}
444 Use a template with the command |\template|\oarg{arguments}\marg{name}\marg{content}.
445 The available arguments are the same as for pages.
446
447 The command |\template| comes with an easy way to generate templates by using a name pattern.
448 For example the template name \textit{sp} creates a template with a square and a portrait format placeholder.
449 In this case the letter |s| specifies a square (1:1) and the letter |p| a portrait (2:3) format placeholder.
450 Use the letter |l| to define a landscape ratio (3:2), |g| for golden ratio (5:3), |o| for golden upright ratio (3:5), |w| for wide ratio (2:1) or |f| for a flexible ratio.
451 With the character |-| you can start a new row.
452 Within a row you can mix the fixed placeholders (|s|, |p|, |l|, |g|, |o|, |w|) or use only flexible placeholders~(|f|).
453
454 \section{Image Optimization}\label{sec:optimization}
455
456 \DescribeMacro{\optimize}
457 With the command |\optimize|\oarg{arguments} you can enable image optimization.
458 When enabled, JPG and PNG images are croped, resized and cached.
459 This results in fast rebuilds when changing the document.
460 You can set the arguments |density|, |quality|, |unsharp| and |downsample threshold|.
461 The |density| argument takes a number of the pixels per inch (default |300|), the |quality| argument takes numbers between 1 and 100, the |unsharp| argument an ImageMagick unsharp configuration (default |2x1|) and the |downsample threshold| a decimal value greater or equal 1 (default |1.2|).
462 The |unsharp| argument can also be applied for individual graphics.
463 \par
464 If you use image optimization and change the original graphics files, you must delete the cached versions so that the cache will update.
465 \DescribeMacro{\import}
466 The |\import| command helps you to streamline this process.
467 When enabled, you need an import directory in which to place the modified files.
468 When the document is created, the files are moved to your image directory and the corresponding cached versions are automatically regenerated.
469 The import directory is either the directory \emph{import} in your working directory.
470 Or you can set a system wide import directory by defining the shell variable |PAGELAYOUT_IMPORT_DIRECTORY|.
471 \par
472 \DescribeMacro{\preflight}
473 Use the |\preflight| command to proof the image resolution.
474 If images have a final resolution less then 300 ppi you get a warning, if less then 200 ppi you get an error.
475 With preflight enabled the maximum possible resolution is shown next to each graphic.
476
477 \end{document}