summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/pagelayout/doc/example-grid.tex
blob: 6bc3573867eef442bb784cd22b09a9322680965a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
%%
%% Copyright (c) 2022-2023 by Friedemann Bartels
%%
%% This file may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either
%% version 1.3c of this license or (at your option) any later
%% version.  The latest version of this license is in:
%%
%%    http://www.latex-project.org/lppl.txt
%%
%% and version 1.3c or later is part of all distributions of
%% LaTeX version 2008/05/04 or later.
%%

\documentclass{pagelayout}
\usepackage{lipsum}

\pagewidth=20cm
\pageheight=20cm
\gutter=10mm

\grid

\begin{document}

  \page{
    \setgrid{
      {{1}{1}}
      {{1}{1}}
    }

    \text{
      A grid with two rows and two cells in each row.
    }
  }

  \page{
    \setgrid{
      {{3}{2}}
      {{2}{3}}
    }

    \text{
      A grid with a width relation between cells.
    }
  }

  \page{
    \setgrid{
      {[3]{1}{1}}
      {[1]{1}{1}}
    }

    \text{
      A grid with a height relation between rows.
    }
  }

  \page{
    \setgrid{
      {[2]{1}{3!}}
      {[2]{1}{2!}}
    }

    \text{
      A grid with a fixed aspect ratio of some cells.
    }

    \graphic{3x2}

    \place{1 1 2 2}
    \graphic{1x1}
  }

  \page{
    \setgrid{
      {[1]{1!}{1!}{1!}}
      {[2]{4!}{3!}}
    }

    \text{
      A grid with a fixed aspect ratio of all cells.
    }

    \place{0 0 1 1}
    \graphic{1x1}

    \graphic{1x1}

    \graphic{1x1}

    \graphic{2x1}

    \graphic{3x2}
  }

  \page{
    \setgrid{
      {[2]{2!}{2!}{2!}}
      {[2!]{4!}{3}}
    }

    \graphic{1x1}

    \graphic{1x1}

    \graphic{1x1}

    \graphic{2x1}

    \text{
      A grid with a fixed height relation between rows.
    }
  }

  \page[gutter=10mm]{
    \setgrid[
      width=0.5\width,
      x=\margin
    ]{
      {{1}}
    }
    \text{
      Multiple grids on one page.
    }
    \setgrid[
      width=0.5\width-\gutter,
      x=\margin+0.5\width+\gutter
    ]{
      {{1}}
      {{1}}
      {{1}}
    }
  }

  \page{
    \setgrid[width=\height]{
      {{1}{1}}
      {{1}{1}}
    }
    \text{
      A grid with free positioned content. The gutter is preserved.
    }
    \place{0.5 0.5 1.5 1.5}
    \graphic{1x1}
    \place{1.5 1.5 2 2}
    \graphic{1x1}
  }

\end{document}