Debian Codegraph @

test/functional/expected/length_units_xetex.tex

raw
1 \documentclass[a4paper]{article}
2 % generated by Docutils <https://docutils.sourceforge.io/>
3 % rubber: set program xelatex
4 \usepackage{fontspec}
5 % \defaultfontfeatures{Scale=MatchLowercase}
6 % straight double quotes (defined in T1 but missing in TU):
7 \ifdefined \UnicodeEncodingName
8 \DeclareTextCommand{\textquotedbl}{\UnicodeEncodingName}{%
9 {\addfontfeatures{RawFeature=-tlig,Mapping=}\char34}}%
10 \fi
11 \usepackage{float} % extended float configuration
12 \floatplacement{figure}{H} % place figures here definitely
13 \usepackage{graphicx}
14 \setcounter{secnumdepth}{0}
15 \usepackage{longtable,ltcaption,array}
16 \setlength{\extrarowheight}{2pt}
17 \newlength{\DUtablewidth} % internal use in tables
18 \newcommand{\DUcolumnwidth}[1]{\dimexpr#1\DUtablewidth-2\tabcolsep\relax}
19
20 %%% Custom LaTeX preamble
21 % Linux Libertine (free, wide coverage, not only for Linux)
22 \setmainfont{Linux Libertine O}
23 \setsansfont{Linux Biolinum O}
24 \setmonofont[HyphenChar=None,Scale=MatchLowercase]{DejaVu Sans Mono}
25
26 %%% User specified packages and stylesheets
27
28 %%% Fallback definitions for Docutils-specific commands
29
30 % Provide a length variable and set default, if it is new
31 \providecommand*{\DUprovidelength}[2]{%
32 \ifdefined#1
33 \else
34 \newlength{#1}\setlength{#1}{#2}%
35 \fi
36 }
37
38 \ifdefined\DUchdimen % lengh unit "ch": width of a zero char
39 \else
40 \newlength{\DUchdimen}
41 \AtBeginDocument{\settowidth\DUchdimen{0}} % set after font setup,
42 % update with font changes (requires LaTeX > 2021-06-01, see lthooks-doc.pdf)
43 \AddToHook{cmd/selectfont/after}{\settowidth\DUchdimen{0}}
44 \fi
45
46 \DUprovidelength{\pdfpxdimen}{1bp}
47
48 \DUprovidelength{\DUremdimen}{1em}
49
50 \AtBeginDocument{
51 \ifdim\paperwidth>\paperheight\relax
52 \DUprovidelength{\DUvmaxdimen}{0.01\paperwidth}
53 \else
54 \DUprovidelength{\DUvmaxdimen}{0.01\paperheight}
55 \fi
56 }
57
58 \AtBeginDocument{
59 \ifdim\paperwidth>\paperheight\relax
60 \DUprovidelength{\DUvmindimen}{0.01\paperheight}
61 \else
62 \DUprovidelength{\DUvmindimen}{0.01\paperwidth}
63 \fi
64 }
65 % hyperlinks:
66 \ifdefined\hypersetup
67 \else
68 \usepackage[hyperfootnotes=false,
69 colorlinks=true,linkcolor=blue,urlcolor=blue]{hyperref}
70 \usepackage{bookmark}
71 \urlstyle{same} % normal text font (alternatives: tt, rm, sf)
72 \fi
73 \hypersetup{
74 pdftitle={Test length specifications},
75 }
76
77 \title{Test length specifications}
78 \author{}
79 \date{}
80
81 %%% Body
82 \begin{document}
83 \maketitle
84
85
86 \section{Images and Figures}
87
88 \begin{figure}
89 \noindent\makebox[\linewidth][c]{\includegraphics[scale=1]{../input/data/blue square.png}}
90 \caption{scale 100\%, no size specification}
91 \end{figure}
92
93 \begin{figure}
94 \noindent\makebox[\linewidth][c]{\includegraphics[width=0.25\linewidth]{../input/data/blue square.png}}
95 \caption{width 25\%, no height, figure width 50\%}
96 \end{figure}
97
98 \begin{figure}
99 \noindent\makebox[\linewidth][c]{\includegraphics[height=16\pdfpxdimen,width=0.25\linewidth]{../input/data/blue square.png}}
100 \caption{width 25\%, height 16px, figure width 50\%}
101 \end{figure}
102
103 \begin{figure}
104 \noindent\makebox[\linewidth][c]{\includegraphics[height=16\pdfpxdimen,width=10em]{../input/data/blue square.png}}
105 \caption{width 10 em, figure width 20 em}
106 \end{figure}
107
108 \begin{figure}
109 \noindent\makebox[\linewidth][c]{\includegraphics[height=16\pdfpxdimen,width=20ex]{../input/data/blue square.png}}
110 \caption{width 20 ex, figure width 40 ex}
111 \end{figure}
112
113 \begin{figure}
114 \noindent\makebox[\linewidth][c]{\includegraphics[height=16\pdfpxdimen,width=15\DUchdimen]{../input/data/blue square.png}}
115 \caption{width 15 ch, figure width 30 ch}
116 \end{figure}
117
118 \begin{figure}
119 \noindent\makebox[\linewidth][c]{\includegraphics[height=16\pdfpxdimen,width=10\DUremdimen]{../input/data/blue square.png}}
120 \caption{width 10 rem, figure width 20 rem}
121 \end{figure}
122
123 \begin{figure}
124 \noindent\makebox[\linewidth][c]{\includegraphics[height=16\pdfpxdimen,width=0.25\paperwidth]{../input/data/blue square.png}}
125 \caption{width 25 vw, figure width 30 vw}
126 \end{figure}
127
128 \begin{figure}
129 \noindent\makebox[\linewidth][c]{\includegraphics[height=16\pdfpxdimen,width=0.25\paperheight]{../input/data/blue square.png}}
130 \caption{width 25 vh, figure width 30 vh}
131 \end{figure}
132
133 \begin{figure}
134 \noindent\makebox[\linewidth][c]{\includegraphics[height=16\pdfpxdimen,width=25\DUvmindimen]{../input/data/blue square.png}}
135 \caption{width 25 vmin, figure width 30 vmin}
136 \end{figure}
137
138 \begin{figure}
139 \noindent\makebox[\linewidth][c]{\includegraphics[height=16\pdfpxdimen,width=25\DUvmaxdimen]{../input/data/blue square.png}}
140 \caption{width 25 vmax, figure width 30 vmax}
141 \end{figure}
142
143 \begin{figure}
144 \noindent\makebox[\linewidth][c]{\includegraphics[height=16\pdfpxdimen,width=5cm]{../input/data/blue square.png}}
145 \caption{width 5 cm, figure width 10 cm}
146 \end{figure}
147
148 \begin{figure}
149 \noindent\makebox[\linewidth][c]{\includegraphics[height=16\pdfpxdimen,width=50mm]{../input/data/blue square.png}}
150 \caption{width 50 mm, figure width 100 mm}
151 \end{figure}
152
153 \begin{figure}
154 \noindent\makebox[\linewidth][c]{\includegraphics[height=16\pdfpxdimen,width=50.0mm]{../input/data/blue square.png}}
155 \caption{width 200 Q, figure width 400 Q}
156 \end{figure}
157
158 \begin{figure}
159 \noindent\makebox[\linewidth][c]{\includegraphics[height=16\pdfpxdimen,width=2in]{../input/data/blue square.png}}
160 \caption{width 2 in, figure width 4 in}
161 \end{figure}
162
163 \begin{figure}
164 \noindent\makebox[\linewidth][c]{\includegraphics[height=16\pdfpxdimen,width=12pc]{../input/data/blue square.png}}
165 \caption{width 12 pc, figure width 24 pc}
166 \end{figure}
167
168 \begin{figure}
169 \noindent\makebox[\linewidth][c]{\includegraphics[height=16\pdfpxdimen,width=144bp]{../input/data/blue square.png}}
170 \caption{width 144 pt, figure width 288pt}
171 \end{figure}
172
173 \begin{figure}
174 \noindent\makebox[\linewidth][c]{\includegraphics[height=16\pdfpxdimen,width=192\pdfpxdimen]{../input/data/blue square.png}}
175 \caption{width 192 px, figure width 384 px}
176 \end{figure}
177
178 \begin{figure}
179 \noindent\makebox[\linewidth][c]{\includegraphics[height=16\pdfpxdimen,width=192bp]{../input/data/blue square.png}}
180 \caption{width 192 <no unit>, figure width 384 <no unit>}
181 \end{figure}
182
183
184 \section{ch, em, and rem: \includegraphics[height=1\DUchdimen]{../input/data/blue square.png} \includegraphics[height=1em]{../input/data/blue square.png} \includegraphics[height=1\DUremdimen]{../input/data/blue square.png}}
185
186 Image height 1ch, 1em, and 1rem: \includegraphics[height=1\DUchdimen]{../input/data/blue square.png} \includegraphics[height=1em]{../input/data/blue square.png} \includegraphics[height=1\DUremdimen]{../input/data/blue square.png}
187
188 The units \textquotedbl{}em\textquotedbl{} and \textquotedbl{}ch\textquotedbl{} change with the current font size.
189 The unit \textquotedbl{}rem\textquotedbl{} is tied to the document root fontsize.
190
191
192 \section{Tables}
193
194 \setlength{\DUtablewidth}{\dimexpr\linewidth-3\arrayrulewidth\relax}%
195 \begin{longtable*}{|p{\DUcolumnwidth{0.500}}|p{\DUcolumnwidth{0.500}}|}
196 \hline
197
198 value
199 &
200 unit
201 \\
202 \hline
203 \end{longtable*}
204
205 \setlength{\DUtablewidth}{\dimexpr0.25\linewidth-3\arrayrulewidth\relax}%
206 \begin{longtable*}{|p{\DUcolumnwidth{0.500}}|p{\DUcolumnwidth{0.500}}|}
207 \hline
208
209 25
210 &
211 \%
212 \\
213 \hline
214 \end{longtable*}
215
216 \setlength{\DUtablewidth}{\dimexpr10em-3\arrayrulewidth\relax}%
217 \begin{longtable*}{|p{\DUcolumnwidth{0.500}}|p{\DUcolumnwidth{0.500}}|}
218 \hline
219
220 10
221 &
222 em
223 \\
224 \hline
225 \end{longtable*}
226
227 \setlength{\DUtablewidth}{\dimexpr20ex-3\arrayrulewidth\relax}%
228 \begin{longtable*}{|p{\DUcolumnwidth{0.500}}|p{\DUcolumnwidth{0.500}}|}
229 \hline
230
231 20
232 &
233 ex
234 \\
235 \hline
236 \end{longtable*}
237
238 \setlength{\DUtablewidth}{\dimexpr15\DUchdimen-3\arrayrulewidth\relax}%
239 \begin{longtable*}{|p{\DUcolumnwidth{0.500}}|p{\DUcolumnwidth{0.500}}|}
240 \hline
241
242 15
243 &
244 ch
245 \\
246 \hline
247 \end{longtable*}
248
249 \setlength{\DUtablewidth}{\dimexpr10\DUremdimen-3\arrayrulewidth\relax}%
250 \begin{longtable*}{|p{\DUcolumnwidth{0.500}}|p{\DUcolumnwidth{0.500}}|}
251 \hline
252
253 10
254 &
255 rem
256 \\
257 \hline
258 \end{longtable*}
259
260 \setlength{\DUtablewidth}{\dimexpr0.25\paperwidth-3\arrayrulewidth\relax}%
261 \begin{longtable*}{|p{\DUcolumnwidth{0.500}}|p{\DUcolumnwidth{0.500}}|}
262 \hline
263
264 25
265 &
266 vw
267 \\
268 \hline
269 \end{longtable*}
270
271 \setlength{\DUtablewidth}{\dimexpr0.25\paperheight-3\arrayrulewidth\relax}%
272 \begin{longtable*}{|p{\DUcolumnwidth{0.500}}|p{\DUcolumnwidth{0.500}}|}
273 \hline
274
275 25
276 &
277 vh
278 \\
279 \hline
280 \end{longtable*}
281
282 \setlength{\DUtablewidth}{\dimexpr25\DUvmindimen-3\arrayrulewidth\relax}%
283 \begin{longtable*}{|p{\DUcolumnwidth{0.500}}|p{\DUcolumnwidth{0.500}}|}
284 \hline
285
286 25
287 &
288 vmin
289 \\
290 \hline
291 \end{longtable*}
292
293 \setlength{\DUtablewidth}{\dimexpr25\DUvmaxdimen-3\arrayrulewidth\relax}%
294 \begin{longtable*}{|p{\DUcolumnwidth{0.500}}|p{\DUcolumnwidth{0.500}}|}
295 \hline
296
297 25
298 &
299 vmax
300 \\
301 \hline
302 \end{longtable*}
303
304 \setlength{\DUtablewidth}{\dimexpr5cm-3\arrayrulewidth\relax}%
305 \begin{longtable*}{|p{\DUcolumnwidth{0.500}}|p{\DUcolumnwidth{0.500}}|}
306 \hline
307
308 5
309 &
310 cm
311 \\
312 \hline
313 \end{longtable*}
314
315 \setlength{\DUtablewidth}{\dimexpr50mm-3\arrayrulewidth\relax}%
316 \begin{longtable*}{|p{\DUcolumnwidth{0.500}}|p{\DUcolumnwidth{0.500}}|}
317 \hline
318
319 50
320 &
321 mm
322 \\
323 \hline
324 \end{longtable*}
325
326 \setlength{\DUtablewidth}{\dimexpr50.0mm-3\arrayrulewidth\relax}%
327 \begin{longtable*}{|p{\DUcolumnwidth{0.500}}|p{\DUcolumnwidth{0.500}}|}
328 \hline
329
330 200
331 &
332 Q
333 \\
334 \hline
335 \end{longtable*}
336
337 \setlength{\DUtablewidth}{\dimexpr2in-3\arrayrulewidth\relax}%
338 \begin{longtable*}{|p{\DUcolumnwidth{0.500}}|p{\DUcolumnwidth{0.500}}|}
339 \hline
340
341 2
342 &
343 in
344 \\
345 \hline
346 \end{longtable*}
347
348 \setlength{\DUtablewidth}{\dimexpr12pc-3\arrayrulewidth\relax}%
349 \begin{longtable*}{|p{\DUcolumnwidth{0.500}}|p{\DUcolumnwidth{0.500}}|}
350 \hline
351
352 12
353 &
354 pc
355 \\
356 \hline
357 \end{longtable*}
358
359 \setlength{\DUtablewidth}{\dimexpr144bp-3\arrayrulewidth\relax}%
360 \begin{longtable*}{|p{\DUcolumnwidth{0.500}}|p{\DUcolumnwidth{0.500}}|}
361 \hline
362
363 144
364 &
365 pt
366 \\
367 \hline
368 \end{longtable*}
369
370 \setlength{\DUtablewidth}{\dimexpr192\pdfpxdimen-3\arrayrulewidth\relax}%
371 \begin{longtable*}{|p{\DUcolumnwidth{0.500}}|p{\DUcolumnwidth{0.500}}|}
372 \hline
373
374 192
375 &
376 px
377 \\
378 \hline
379 \end{longtable*}
380
381 \setlength{\DUtablewidth}{\dimexpr192bp-3\arrayrulewidth\relax}%
382 \begin{longtable*}{|p{\DUcolumnwidth{0.500}}|p{\DUcolumnwidth{0.500}}|}
383 \hline
384
385 192
386 &
387 <no unit>
388 \\
389 \hline
390 \end{longtable*}
391
392 \end{document}