Debian Codegraph @

texmf-dist/doc/latex/xltabular/xltabular-doc.tex

raw
1 %% $Id: xltabular-doc.tex 635 2017-10-24 18:22:59Z herbert $
2 %
3 \listfiles\setcounter{errorcontextlines}{100}
4
5 \DocumentMetadata
6 {
7 lang=en-US,
8 pdfversion=2.0,
9 pdfstandard=ua-2,
10 testphase={latest}
11 }
12 \documentclass[paper=a4,fontsize=11pt,DIV=13,parskip=half-,
13 captions=tableabove,twoside=on]{scrartcl}
14 \usepackage{fontspec}
15 %\usepackage[%usefilenames,
16 % TT={Scale=0.88,FakeStretch=0.9},
17 % SS={Scale=0.9},
18 % RM={Scale=0.9},
19 % DefaultFeatures={Ligatures=TeX}]{lucida-otf} % support opentype math fonts
20 \setmainfont{AccanthisADFStdNo3}[
21 UprightFont =*-Regular,
22 BoldFont =*-Bold,
23 ItalicFont =*-Italic,
24 BoldItalicFont=*-BoldItalic,
25 RawFeature = -rlig,
26 ]
27 \setsansfont{GilliusADF}[
28 UprightFont =*-Regular,
29 BoldFont =*-Bold,
30 ItalicFont =*-Italic,
31 BoldItalicFont=*-BoldItalic,
32 RawFeature = -rlig,
33 ]
34 \setmonofont{Anonymous Pro}[Scale=MatchLowercase,FakeStretch=0.9]
35
36 \usepackage[english]{babel}
37 \usepackage{scrlayer-scrpage}
38 \automark[section]{section}
39 \automark*[subsection]{}
40 \pagestyle{scrheadings}
41
42 %\usepackage{selnolig}
43 %\nolig{oe}{o|e}
44
45 \usepackage{xltabular}
46 \makeatletter
47 %\def\LT@caption{%
48 % \noalign\bgroup
49 % \@ifnextchar[{\egroup\LT@c@ption\@firstofone}\LT@capti@n}
50 \makeatother
51 %\specialLTpagebreak
52
53 \usepackage{fancyvrb}
54 \usepackage{blindtext}
55 \usepackage{dtk-logos} % for Wikipedia W
56 \usepackage{ragged2e}
57
58 \usepackage[bibstyle=dtk]{biblatex}
59 %\addbibresource{\jobname.bib}
60 \addbibresource[location=remote]{https://mirror.ctan.org/biblio/ctan-bibdata/ctan.bib}
61
62 \raggedbottom
63 \usepackage[colorlinks,linktocpage]{hyperref}
64 \newcommand*\cs[1]{\texttt{\textbackslash#1}}
65
66 \makeatletter% from: doc.sty
67 \newcommand*\GetFileInfo[1]{%
68 \def\filename{#1}%
69 \def\@tempb##1 ##2 ##3\relax##4\relax{%
70 \def\filedate{##1}%
71 \def\fileversion{##2}%
72 \def\fileinfo{##3}}%
73 \edef\@tempa{\csname ver@#1\endcsname}%
74 \expandafter\@tempb\@tempa\relax? ? \relax\relax}
75 \makeatother
76
77 \GetFileInfo{xltabular.sty}
78
79 \title{Package \texttt{xltabular} \\--\\ \normalsize \fileversion\ (\filedate)}
80 \author{Rolf Niepraschk\thanks{[email protected]} \and Herbert Voß\thanks{[email protected]}}
81 \begin{document}
82 \maketitle
83 \tableofcontents
84
85 \section{Introduction}
86
87 The package \texttt{ltablex} supports an environment \texttt{tabularx} with
88 the possiblity of pagebreaks and the same header/footer definitions as in
89 the package \texttt{longtable}. But the old bevaviour of the \texttt{tabularx}
90 environment is no more possible.
91
92 The package \texttt{xltabular} defines an environment of the same name
93 which behaves like a \texttt{tabularx} as a \texttt{longtable}. In short:
94 it is a \texttt{longtable} with the column specifier \texttt{X}. But it leaves the
95 \texttt{tabularx} environment with its original behaviour.
96
97 The syntax of the environment is similiar to the one of \texttt{tabularx}:
98
99 \begin{verbatim}
100 \begin{xltabular}[hPos]{width}{ l X ...}
101 \caption{...\label{...}}\\
102 tabular body
103 \end{xltabular}
104 \end{verbatim}
105
106 For the optional argument \texttt{hPos} (horizontal position) the values \texttt{l},
107 \texttt{r} and \texttt{c} (default)
108 are possible. The environment \texttt{xltabular} uses \texttt{longtable} for
109 typesetting the tabular. The original \texttt{longtable} increases the counter
110 \texttt{table} in any case, with or without a caption. This is not the case
111 with \texttt{xltabular}: no \cs{caption}, no counter change.
112
113
114
115
116 \section{Examples}
117
118 \newcommand\B{Some nonsense text which fills at least one line
119 of a tabular called nonsense tabular with text.\\}
120 \newcommand\BB{\B\B\B\B\B\B\B\B\B\B\B\B\B\B\B}
121 \newcommand\BBB{\BB\BB\BB\BB}
122
123 \listoftables
124
125 \markboth{Examples}{}
126 \vspace{1cm}
127
128
129 \subsection{The standard \texttt{tabularx} environment}
130
131 \begin{Verbatim}[frame=lines]
132 \captionaboveof{table}{Using the original \texttt{tabularx} environment:
133 a pagebreak not possible! This is the reason why the tabular moves
134 to the next page.}
135 \begin{tabularx}{0.75\linewidth}{@{} lX @{}}
136 left column & \blindtext\\
137 l & \blindtext\\
138 left column & \blindtext\\
139 l & \blindtext\\
140 \end{tabularx}
141 \end{Verbatim}
142
143 \bigskip
144 \captionaboveof{table}{Using the original \texttt{tabularx} environment:
145 a pagebreak not possible! This is the reason why the tabular moves
146 to the next page.}
147 \begin{tabularx}{0.75\linewidth}{@{} lX @{}}
148 left column & \blindtext\\
149 l & \blindtext\\
150 left column & \blindtext\\
151 l & \blindtext\\
152 \end{tabularx}
153
154
155 %\begin{tabularx}{\linewidth}{@{}X@{}}
156 %\captionaboveof{table}{Another example for the original \texttt{tabularx} environment:
157 %%%pagebreak not possible!}\\
158 %\BBB
159 %\end{tabularx}
160
161 \clearpage
162
163 \subsection{The new environment \texttt{xltabular}}
164 For the demonstration we use a tabular with only one X column. There is no difference
165 to an example with more or other column specifiers. However, there should be at least
166 one \texttt{X} column specifier; it makes no real sense otherwise.
167
168 \begin{Verbatim}[frame=lines]
169 \begin{xltabular}{\linewidth}{@{} X @{}}
170 \caption{the \texttt{xltabular} environment with \texttt{longtable}
171 property}\\[\belowcaptionskip]
172 \BB\\
173 Now a manuel \cs{pagebreak} is used and on the
174 following page an automatic pagebreak is done by \texttt{longtable}.\\
175
176 \pagebreak
177
178 \BBB
179 \end{xltabular}
180 \end{Verbatim}
181
182 \begin{xltabular}{\linewidth}{@{} X @{}}
183 \caption{the \texttt{xltabular} environment with \texttt{longtable}
184 property}\\[\belowcaptionskip]
185 \BB\\
186 Now a manuel \cs{pagebreak} is used and on the
187 following page an automatik pagebreak is done by \texttt{longtable}.\\
188
189 \pagebreak
190
191 \BBB
192 \end{xltabular}
193
194 The command \cs{BBB} does nothing else then printing a lot of lines
195 with nonsense.
196
197
198 \setcapwidth{0.75\linewidth}
199
200 \begin{Verbatim}[frame=lines]
201 \begin{xltabular}[l]{0.75\linewidth}{@{} lX @{}}
202 \caption{The \texttt{xltabular} environment with \texttt{longtable} property
203 and left aligned by setting the optional argument.}\\[\belowcaptionskip]\hline
204 Left column & At first a line with some nonsense text to show how long this line is.
205 The caption has the same width as the text.\\
206 left column & \blindtext\\
207 left column & \blindtext\\
208 left column & \blindtext\\
209 left column & \blindtext\\\hline
210 \end{xltabular}
211 \end{Verbatim}
212
213
214
215 \begin{xltabular}[l]{0.75\linewidth}{@{} lX @{}}
216 \caption{The \texttt{xltabular} environment with \texttt{longtable} property
217 and left aligned by setting the optional argument.}\\[\belowcaptionskip]\hline
218 Left column & At first a line with some nonsense text to show how long this line is.
219 The caption has the same width as the text.\\
220 left column & \blindtext\\
221 left column & \blindtext\\
222 left column & \blindtext\\
223 left column & \blindtext\\\hline
224 \end{xltabular}
225
226
227
228
229 \subsection{\texttt{tabularx} without a caption}
230
231 Here comes another \texttt{tabularx} but without a caption. It should
232 \emph{not} increase the \texttt{table} counter. The following tabular
233 in the last section should have the correct number!
234
235 \begin{tabularx}{\linewidth}{@{} >{\ttfamily}l>{\RaggedRight}X @{}}\hline
236 .ext & Beschreibung\\\hline
237 aux & (auxiliary) Hilfsdatei, enthält Querverweise usw. \\
238 bbl & (bibliography) Hilfsdatei, enthält die Einträge für die Literatur\\
239 bib & (bibtex) enthält die Literaturdaten\\
240 blg & (bibliography log) enthält die Ausgaben eines Bib\TeX-Laufs\\
241 cfg & (config) Konfigurationsdatei\\
242 clo & (class options) Definitionen für die Dokumentenklasse und die entsprechenden
243 Klassen-Optionen\\\hline
244 \end{tabularx}
245
246
247 \subsection{\texttt{xltabular} with the star version of caption}
248
249 Here comes another \texttt{xltabular} with \cs{caption*}. It should
250 \emph{not} increase the \texttt{table} counter. The following tabular
251 in the next section should have the correct number!
252
253 \begin{xltabular}{\linewidth}{@{} >{\ttfamily}l>{\RaggedRight}X @{}}
254 \caption*{A caption as star version: no number no entry in the List of Tables}\\\hline
255 .ext & Beschreibung\\\hline
256 aux & (auxiliary) Hilfsdatei, enthält Querverweise usw. \\
257 bbl & (bibliography) Hilfsdatei, enthält die Einträge für die Literatur\\
258 bib & (bibtex) enthält die Literaturdaten\\
259 blg & (bibliography log) enthält die Ausgaben eines Bib\TeX-Laufs\\
260 cfg & (config) Konfigurationsdatei\\
261 clo & (class options) Definitionen für die Dokumentenklasse und die entsprechenden
262 Klassen-Optionen\\\hline
263 \end{xltabular}
264
265
266
267 \subsection{\texttt{xltabular} with header/footer definitions}
268
269 \begin{Verbatim}[frame=lines]
270 \begin{xltabular}{\linewidth}{@{} >{\ttfamily}l >{\RaggedRight}X @{}}
271 \caption{File endings (only for a demonstration \ldots)}\\\hline
272 .ext & Beschreibung\\\hline
273 \endfirsthead
274 \multicolumn{2}{@{}l}{\ldots\ \small Fortsetzung}\\\hline
275 .ext & Beschreibung\\\hline
276 \endhead
277 \hline
278 \multicolumn{2}{r@{}}{\small Fortsetzung\ldots}\\
279 \endfoot
280 \hline
281 \endlastfoot
282 aux & (auxiliary) Hilfsdatei, enthält Querverweise usw. \\
283 bbl & (bibliography) Hilfsdatei, enthält die Einträge für die Literatur\\
284 bib & (bibtex) enthält die Literaturdaten\\
285 blg & (bibliography log) enthält die Ausgaben eines Bib\TeX-Laufs\\
286 cfg & (config) Konfigurationsdatei\\
287 clo & (class options) Definitionen für die Dokumentenklasse und die entsprechenden
288 [...]
289 Klassen-Optionen\\
290 \end{xltabular}
291 \end{Verbatim}
292
293 \begin{xltabular}{\linewidth}{@{} >{\ttfamily}l >{\RaggedRight}X @{}}
294 \caption{File endings (only for a demonstration \ldots)}\\\hline
295 .ext & Beschreibung\\\hline
296 \endfirsthead
297 \multicolumn{2}{@{}l}{\ldots\ \small Fortsetzung}\\\hline
298 .ext & Beschreibung\\\hline
299 \endhead
300 \hline
301 \multicolumn{2}{r@{}}{\small Fortsetzung\ldots}\\
302 \endfoot
303 \hline
304 \endlastfoot
305 aux & (auxiliary) Hilfsdatei, enthält Querverweise usw. \\
306 bbl & (bibliography) Hilfsdatei, enthält die Einträge für die Literatur\\
307 bib & (bibtex) enthält die Literaturdaten\\
308 blg & (bibliography log) enthält die Ausgaben eines Bib\TeX-Laufs\\
309 cfg & (config) Konfigurationsdatei\\
310 clo & (class options) Definitionen für die Dokumentenklasse und die entsprechenden
311 Klassen-Optionen\\
312 aux & (auxiliary) Hilfsdatei, enthält Querverweise usw. \\
313 bbl & (bibliography) Hilfsdatei, enthält die Einträge für die Literatur\\
314 bib & (bibtex) enthält die Literaturdaten\\
315 blg & (bibliography log) enthält die Ausgaben eines Bib\TeX-Laufs\\
316 cfg & (config) Konfigurationsdatei\\
317 clo & (class options) Definitionen für die Dokumentenklasse und die entsprechenden
318 Klassen-Optionen\\
319 aux & (auxiliary) Hilfsdatei, enthält Querverweise usw. \\
320 bbl & (bibliography) Hilfsdatei, enthält die Einträge für die Literatur\\
321 bib & (bibtex) enthält die Literaturdaten\\
322 blg & (bibliography log) enthält die Ausgaben eines Bib\TeX-Laufs\\
323 cfg & (config) Konfigurationsdatei\\
324 clo & (class options) Definitionen für die Dokumentenklasse und die entsprechenden
325 Klassen-Optionen\\
326 aux & (auxiliary) Hilfsdatei, enthält Querverweise usw. \\
327 bbl & (bibliography) Hilfsdatei, enthält die Einträge für die Literatur\\
328 bib & (bibtex) enthält die Literaturdaten\\
329 blg & (bibliography log) enthält die Ausgaben eines Bib\TeX-Laufs\\
330 cfg & (config) Konfigurationsdatei\\
331 clo & (class options) Definitionen für die Dokumentenklasse und die entsprechenden
332 Klassen-Optionen\\
333 \end{xltabular}
334
335
336 \section{Pagebreaks}
337
338 \texttt{xltabular} is based on \texttt{longtable} which itself has sometimes a problem with the pagebreak.
339 It may be possible, that you'll get a break between a section header and the following \texttt{longtable}/\texttt{xltabular}.
340 Here is an example with \texttt{xltabular}:
341
342 \section{Title above the tabular}
343
344 \begin{xltabular}{\linewidth}{@{} >{\ttfamily}l >{\RaggedRight}X @{}}
345 \caption{File endings (only for a demonstration \ldots)}\\
346 \hline
347 .ext & Beschreibung\\\hline
348 \endfirsthead
349 \multicolumn{2}{@{}l}{\ldots\ \small Fortsetzung}\\\hline
350 .ext & Beschreibung\\\hline
351 \endhead
352 \hline
353 \multicolumn{2}{r@{}}{\small Fortsetzung\ldots}\\
354 \endfoot
355 \hline
356 \endlastfoot
357 aux & (auxiliary) Hilfsdatei, enthält Querverweise usw. \\
358 bbl & (bibliography) Hilfsdatei, enthält die Einträge für die Literatur\\
359 bib & (bibtex) enthält die Literaturdaten\\
360 blg & (bibliography log) enthält die Ausgaben eines Bib\TeX-Laufs\\
361 cfg & (config) Konfigurationsdatei\\
362 clo & (class options) Definitionen für die Dokumentenklasse und die entsprechenden
363 Klassen-Optionen\\
364 aux & (auxiliary) Hilfsdatei, enthält Querverweise usw. \\
365 bbl & (bibliography) Hilfsdatei, enthält die Einträge für die Literatur\\
366 bib & (bibtex) enthält die Literaturdaten\\
367 blg & (bibliography log) enthält die Ausgaben eines Bib\TeX-Laufs\\
368 cfg & (config) Konfigurationsdatei\\
369 clo & (class options) Definitionen für die Dokumentenklasse und die entsprechenden
370 Klassen-Optionen\\
371 aux & (auxiliary) Hilfsdatei, enthält Querverweise usw. \\
372 bbl & (bibliography) Hilfsdatei, enthält die Einträge für die Literatur\\
373 bib & (bibtex) enthält die Literaturdaten\\
374 blg & (bibliography log) enthält die Ausgaben eines Bib\TeX-Laufs\\
375 clo & (class options) Definitionen für die Dokumentenklasse und die entsprechenden
376 Klassen-Optionen\\
377 % aux & (auxiliary) Hilfsdatei, enthält Querverweise usw. \\
378 % bbl & (bibliography) Hilfsdatei, enthält die Einträge für die Literatur\\
379 % bib & (bibtex) enthält die Literaturdaten\\
380 blg & (bibliography log) enthält die Ausgaben eines Bib\TeX-Laufs\\
381 cfg & (config) Konfigurationsdatei\\
382 clo & (class options) Definitionen für die Dokumentenklasse und die entsprechenden
383 Klassen-Optionen\\
384 \end{xltabular}
385
386
387 Package \texttt{xltabular} defines two macros which can be used to modify the behaviour of
388 \texttt{longtable}/ \texttt{xltabular} for pagebreaks.
389
390 \begin{verbatim}
391 \newcommand*\normalLTpagebreak{...}
392 \newcommand*\specialLTpagebreak{...}
393 \end{verbatim}
394
395 With \verb|\specialLTpagebreak| one can get another beaviour which prevents such unwanted pagebreak.
396 With \verb|\normalLTpagebreak| you can set it back to the default behaviour. Here comes an example
397 with the special behaviour by using \verb|\specialLTpagebreak|: \specialLTpagebreak
398
399
400
401 \section{Title above the tabular}
402
403 \begin{xltabular}{\linewidth}{@{} >{\ttfamily}l >{\RaggedRight}X @{}}
404 \caption{File endings (only for a demonstration \ldots)}\\
405 \hline
406 .ext & Beschreibung\\\hline
407 \endfirsthead
408 \multicolumn{2}{@{}l}{\ldots\ \small Fortsetzung}\\\hline
409 .ext & Beschreibung\\\hline
410 \endhead
411 \hline
412 \multicolumn{2}{r@{}}{\small Fortsetzung\ldots}\\
413 \endfoot
414 \hline
415 \endlastfoot
416 aux & (auxiliary) Hilfsdatei, enthält Querverweise usw. \\
417 bbl & (bibliography) Hilfsdatei, enthält die Einträge für die Literatur\\
418 bib & (bibtex) enthält die Literaturdaten\\
419 blg & (bibliography log) enthält die Ausgaben eines Bib\TeX-Laufs\\
420 cfg & (config) Konfigurationsdatei\\
421 clo & (class options) Definitionen für die Dokumentenklasse und die entsprechenden
422 Klassen-Optionen\\
423 aux & (auxiliary) Hilfsdatei, enthält Querverweise usw. \\
424 bbl & (bibliography) Hilfsdatei, enthält die Einträge für die Literatur\\
425 bib & (bibtex) enthält die Literaturdaten\\
426 blg & (bibliography log) enthält die Ausgaben eines Bib\TeX-Laufs\\
427 cfg & (config) Konfigurationsdatei\\
428 clo & (class options) Definitionen für die Dokumentenklasse und die entsprechenden
429 Klassen-Optionen\\
430 aux & (auxiliary) Hilfsdatei, enthält Querverweise usw. \\
431 bbl & (bibliography) Hilfsdatei, enthält die Einträge für die Literatur\\
432 bib & (bibtex) enthält die Literaturdaten\\
433 blg & (bibliography log) enthält die Ausgaben eines Bib\TeX-Laufs\\
434 % cfg & (config) Konfigurationsdatei\\
435 % clo & (class options) Definitionen für die Dokumentenklasse und die entsprechenden
436 % Klassen-Optionen\\
437 % aux & (auxiliary) Hilfsdatei, enthält Querverweise usw. \\
438 % bbl & (bibliography) Hilfsdatei, enthält die Einträge für die Literatur\\
439 % bib & (bibtex) enthält die Literaturdaten\\
440 blg & (bibliography log) enthält die Ausgaben eines Bib\TeX-Laufs\\
441 cfg & (config) Konfigurationsdatei\\
442 clo & (class options) Definitionen für die Dokumentenklasse und die entsprechenden
443 Klassen-Optionen\\
444 \end{xltabular}
445
446
447
448 \pagebreak
449
450 \nocite{ctan-ltablex,ctan-tabularx,ctan-longtable}
451 \printbibliography
452
453
454 \end{document}