Debian Codegraph @

texmf-dist/doc/latex/pagelayout/example-grid.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 option) 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{pagelayout}
16 \usepackage{lipsum}
17
18 \pagewidth=20cm
19 \pageheight=20cm
20 \gutter=10mm
21
22 \grid
23
24 \begin{document}
25
26 \page{
27 \setgrid{
28 {{1}{1}}
29 {{1}{1}}
30 }
31
32 \text{
33 A grid with two rows and two cells in each row.
34 }
35 }
36
37 \page{
38 \setgrid{
39 {{3}{2}}
40 {{2}{3}}
41 }
42
43 \text{
44 A grid with a width relation between cells.
45 }
46 }
47
48 \page{
49 \setgrid{
50 {[3]{1}{1}}
51 {[1]{1}{1}}
52 }
53
54 \text{
55 A grid with a height relation between rows.
56 }
57 }
58
59 \page{
60 \setgrid{
61 {[2]{1}{3!}}
62 {[2]{1}{2!}}
63 }
64
65 \text{
66 A grid with a fixed aspect ratio of some cells.
67 }
68
69 \graphic{3x2}
70
71 \place{1 1 2 2}
72 \graphic{1x1}
73 }
74
75 \page{
76 \setgrid{
77 {[1]{1!}{1!}{1!}}
78 {[2]{4!}{3!}}
79 }
80
81 \text{
82 A grid with a fixed aspect ratio of all cells.
83 }
84
85 \place{0 0 1 1}
86 \graphic{1x1}
87
88 \graphic{1x1}
89
90 \graphic{1x1}
91
92 \graphic{2x1}
93
94 \graphic{3x2}
95 }
96
97 \page{
98 \setgrid{
99 {[2]{2!}{2!}{2!}}
100 {[2!]{4!}{3}}
101 }
102
103 \graphic{1x1}
104
105 \graphic{1x1}
106
107 \graphic{1x1}
108
109 \graphic{2x1}
110
111 \text{
112 A grid with a fixed height relation between rows.
113 }
114 }
115
116 \page[gutter=10mm]{
117 \setgrid[
118 width=0.5\width,
119 x=\margin
120 ]{
121 {{1}}
122 }
123 \text{
124 Multiple grids on one page.
125 }
126 \setgrid[
127 width=0.5\width-\gutter,
128 x=\margin+0.5\width+\gutter
129 ]{
130 {{1}}
131 {{1}}
132 {{1}}
133 }
134 }
135
136 \page{
137 \setgrid[width=\height]{
138 {{1}{1}}
139 {{1}{1}}
140 }
141 \text{
142 A grid with free positioned content. The gutter is preserved.
143 }
144 \place{0.5 0.5 1.5 1.5}
145 \graphic{1x1}
146 \place{1.5 1.5 2 2}
147 \graphic{1x1}
148 }
149
150 \end{document}