summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/l3experimental/xgalley/xgalley-demo.tex
blob: a2ede159b96af9512373608bf33a9f0e9c5fc323 (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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
\documentclass{article}

\setlength{\parindent}{12 pt}

\usepackage{xgalley}

% Customised templates, etc.: would be in the class for a real document
\ExplSyntaxOn
\DeclareTemplateInterface { parshape } { cutout } { 0 }
  {
    on-left-side  : boolean = true  ,
    no-page-break : boolean = false ,
    normal-lines  : integer = 1     ,
    parshape-list : commalist
  }
\DeclareTemplateCode { parshape } { cutout } { 0 }
  {
    on-left-side  = \l_galley_parshape_on_left_bool  ,
    no-page-break = \l_galley_parshape_no_break_bool ,
    normal-lines  = \l_galley_parshape_lines_int     ,
    parshape-list = \l_galley_parshape_clist
  }
  {
    \AssignTemplateKeys
    \bool_if:NT \l_galley_parshape_no_break_bool
      { \bool_gset_true:N \g_galley_nobreak_next_bool }
    \clist_clear:N \l_tmpa_clist
    \clist_map_inline:Nn  \l_galley_parshape_clist
      { \clist_put_right:Nn \l_tmpa_clist { 0 pt } }
    \bool_if:NTF \l_galley_parshape_on_left_bool
      {
        \galley_parshape_single_par:nVVN
          \l_galley_parshape_lines_int
          \l_galley_parshape_clist
          \l_tmpa_clist
          \c_true_bool
      }
      {
        \galley_parshape_single_par:nVVN
          \l_galley_parshape_lines_int
          \l_tmpa_clist
          \l_galley_parshape_clist
          \c_true_bool
      }
  }
\DeclareInstance { parshape } { staggered } { cutout }
  {
    no-page-break = true                    ,
    parshape-list = { 20 pt, 40 pt, 60 pt }
  }
  
\DeclareInstance { justification } { adjust } { std }
  {
    end-skip   = \fill ,
    left-skip  = 0 pt  ,
    right-skip = 0 pt  ,
    start-skip = 0 pt
  }
\DeclareInstance { justification } { centerfirst } { single }
  {
    end-skip      = 0 pt            ,
    indent-width  = 0 pt            ,
    left-skip     = -\fill          ,
    right-skip    = \fill           ,
    start-skip    = 0 pt plus 2fill
  }
\DeclareInstance { justification } { centerfirst-adjust } { compound }
  {
    first-paragraph  = centerfirst ,
    other-paragraphs = adjust
  }
\ExplSyntaxOff

\begin{document}

Some starting text. Some starting text. Some starting text. Some starting text.
Some starting text. Some starting text. Some starting text. Some starting text.

Some starting text. Some starting text. Some starting text. Some starting text.
Some starting text. Some starting text. Some starting text. Some starting text.

\UseInstance{parshape}{staggered}
\section{This should\\ be\\a really staggered\\heading (but isn't)}

In fact we should not be surprised since the standard \LaTeX{} heading
code is essentially using its own parshape and thus overwriting the
outer parshape declaration.

\UseInstance{parshape}{staggered}
\UseInstance{justification}{ragged-right}

This is a paragraph for testing various justification\\ settings. We have some
text and after the word `word' \\ we just had a forced line break. We
do some more line break testing, e.g., this\\[7pt] one was supposed to
add $7$\,pt of extra space.

And here a paragraph for comparison with some text some text some text
also-containing-a-longer-word some text some text some text some text
some text some text some text.

\section{Linebreaks}

A line break with linebreak\linebreak
and now \ldots

\section{Justified}

some text%
\marginpar
  {%
    \UseInstance{justification}{ragged-right}%
    \fussy
    \fontfamily{pop}\fontsize{7}{9}\selectfont
    ZZZ Some text in Optima. Some text in Optima. Some text in Optima.
    Some text in Optima. Some text in Optima.%
  }
some text some text some text some text some text some text some text
some text some text some text some text some text some text
some text some text some text some text some text some text some text
some text some text some text some text some text some text
some text some text some text some text some text some text some text
some text some text some text some text some text some text.

\section{Ragged-right}

\UseInstance{justification}{ragged-right}
This is a paragraph for testing various justification settings. We have some
text and after the word `word' \\ we just had a forced line break. We
do some more line break testing, e.g., this\\[7pt] one was supposed to
add $7$\,pt of extra space.

And here a paragraph for comparison with some text some text some text
also-containing-a-longer-word some text some text some text some text
some text some text some text.

\section{Ragged-left}

\UseInstance{justification}{ragged-left}
\UseTemplate{hyphenation}{std}{enable = false}
\sloppy
This is a paragraph for testing various justification settings. We have some
text and after the word `word' \\ we just had a forced line break. We
do some more line break testing, e.g., this\\[7pt] one was supposed to
add $7$\,pt of extra space.

And here a paragraph for comparison with some text some text some text
also-containing-a-longer-word some text some text some text some text
some text some text some text.

\section{Adjust}

\UseInstance{justification}{adjust}
\UseTemplate{hyphenation}{std}{enable = true}
\fussy
This is a paragraph for testing various justification settings. We have some
text and after the word `word' \\ we just had a forced line break. We
do some more line break testing, e.g., this\\[7pt] one was supposed to
add $7$\,pt of extra space.

And here a paragraph for comparison with some text some text some text
also-containing-a-longer-word some text some text some text some text
some text some text some text.

\section{Centered}

\UseInstance{justification}{centered}
This is a paragraph for testing various justification settings. We have some
text and after the word `word' \\ we just had a forced line break. We
do some more line break testing, e.g., this\\[7pt] one was supposed to
add $7$\,pt of extra space.

And here a paragraph for comparison with some text some text some text
also-containing-a-longer-word some text some text some text some text
some text some text some text.

\section{Center first}

\UseInstance{justification}{centerfirst-adjust}
This is a paragraph for testing various justification settings. We have some
This is a paragraph for testing various justification settings. We have some
This is a paragraph for testing various justification settings. We have some
This is a paragraph for testing various justification settings. We have some
text and after the word `word' \\ we just had a forced line break. We
do some more line break testing, e.g., this\\[7pt] one was supposed to
add $7$\,pt of extra space.
This is a paragraph for testing various justification settings. We have some
This is a paragraph for testing various justification settings. We have some
This is a paragraph for testing various justification settings. We have some
This is a paragraph for testing various justification settings. We have some

And here a paragraph for comparison with some text some text some text
also-containing-a-longer-word some text some text some text some text
some text some text some text.

\section{Centering}

\UseInstance{justification}{centering}
This is a paragraph for testing various justification settings. We have some
text and after the word `word' \\ we just had a forced line break. We
do some more line break testing, e.g., this\\[7pt] one was supposed to
add $7$\,pt of extra space.

And here a paragraph for comparison with some text some text some text
also-containing-a-longer-word some text some text some text some text
some text some text some text.


\end{document}