summaryrefslogtreecommitdiff
path: root/paper/lua-filters/table-short-captions/expected-sample.tex
blob: 65a2073c1573bbc64b343b30f827cc756ab9509a (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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
% Options for packages loaded elsewhere
\PassOptionsToPackage{unicode=true}{hyperref}
\PassOptionsToPackage{hyphens}{url}
%
\documentclass[
]{article}
\usepackage{lmodern}
\usepackage{amssymb,amsmath}
\usepackage{ifxetex,ifluatex}
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
  \usepackage[T1]{fontenc}
  \usepackage[utf8]{inputenc}
  \usepackage{textcomp} % provides euro and other symbols
\else % if luatex or xelatex
  \usepackage{unicode-math}
  \defaultfontfeatures{Scale=MatchLowercase}
  \defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1}
\fi
% Use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
\IfFileExists{microtype.sty}{% use microtype if available
  \usepackage[]{microtype}
  \UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
}{}
\makeatletter
\@ifundefined{KOMAClassName}{% if non-KOMA class
  \IfFileExists{parskip.sty}{%
    \usepackage{parskip}
  }{% else
    \setlength{\parindent}{0pt}
    \setlength{\parskip}{6pt plus 2pt minus 1pt}}
}{% if KOMA class
  \KOMAoptions{parskip=half}}
\makeatother
\usepackage{xcolor}
\IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available
\IfFileExists{bookmark.sty}{\usepackage{bookmark}}{\usepackage{hyperref}}
\hypersetup{
  pdftitle={Tests for table-short-captions.lua},
  hidelinks,
}
\urlstyle{same} % disable monospaced font for URLs
\usepackage{longtable,booktabs}
% Allow footnotes in longtable head/foot
\IfFileExists{footnotehyper.sty}{\usepackage{footnotehyper}}{\usepackage{footnote}}
\makesavenoteenv{longtable}
\setlength{\emergencystretch}{3em} % prevent overfull lines
\providecommand{\tightlist}{%
  \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\setcounter{secnumdepth}{-\maxdimen} % remove section numbering
% Redefines (sub)paragraphs to behave more like sections
\ifx\paragraph\undefined\else
  \let\oldparagraph\paragraph
  \renewcommand{\paragraph}[1]{\oldparagraph{#1}\mbox{}}
\fi
\ifx\subparagraph\undefined\else
  \let\oldsubparagraph\subparagraph
  \renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\mbox{}}
\fi

% Set default figure placement to htbp
\makeatletter
\def\fps@figure{htbp}
\makeatother

% -- begin:latex-table-short-captions --
\makeatletter\AtBeginDocument{%
\def\LT@c@ption#1[#2]#3{%                 % Overwrite the workhorse macro used in formatting a longtable caption.
  \LT@makecaption#1\fnum@table{#3}%
  \ifdefined\pandoctableshortcapt         % If pandoctableshortcapt is defined (even if blank), we should override default behaviour.
     \let\@tempa\pandoctableshortcapt%    % (Use let, we don't want to expand pandoctableshortcapt!)
  \else                                   % If not, fall back to default behaviour
     \def\@tempa{#2}%                     % (Use the argument in square brackets)
  \fi
  \ifx\@tempa\@empty\else                 % If @tempa is blank, no lot entry! Otherwise, @tempa becomes the lot title.
     {\let\\\space
     \addcontentsline{lot}{table}{\protect\numberline{\thetable}{\@tempa}}}%
  \fi}
}\makeatother
% -- end:latex-table-short-captions --
\makeatletter
\@ifpackageloaded{subfig}{}{\usepackage{subfig}}
\@ifpackageloaded{caption}{}{\usepackage{caption}}
\captionsetup[subfloat]{margin=0.5em}
\AtBeginDocument{%
\renewcommand*\figurename{Figure}
\renewcommand*\tablename{Table}
}
\AtBeginDocument{%
\renewcommand*\listfigurename{List of Figures}
\renewcommand*\listtablename{List of Tables}
}
\@ifpackageloaded{float}{}{\usepackage{float}}
\floatstyle{ruled}
\@ifundefined{c@chapter}{\newfloat{codelisting}{h}{lop}}{\newfloat{codelisting}{h}{lop}[chapter]}
\floatname{codelisting}{Listing}
\newcommand*\listoflistings{\listof{codelisting}{List of Listings}}
\makeatother

\title{Tests for table-short-captions.lua}
\date{}

\begin{document}
\maketitle

\listoftables
These tests are written so that if \textbf{bold font} appears in the
LOT, something is wrong.

The tests are split into two: expected uses, and non-standard
uses/errors.\\
The non-standard uses are presented in this document for troubleshooting
purposes, and to ensure the filter doesn't crash in corner cases.

\hypertarget{standard-usage}{%
\section{Standard usage}\label{standard-usage}}

\begin{longtable}[]{@{}ll@{}}
\caption{This is the \emph{italicised long caption} of tbl1, which does
not have a label.}\tabularnewline
\toprule
cola & colb\tabularnewline
\midrule
\endfirsthead
\toprule
cola & colb\tabularnewline
\midrule
\endhead
a1 & b1\tabularnewline
a2 & b2\tabularnewline
\bottomrule
\end{longtable}

\hypertarget{tbl:tbl-label2}{}
\begin{longtable}[]{@{}ll@{}}
\caption{\label{tbl:tbl-label2}This is the \emph{italicised long
caption} of tbl2, in standard \texttt{pandoc-crossref}
form.}\tabularnewline
\toprule
cola & colb\tabularnewline
\midrule
\endfirsthead
\toprule
cola & colb\tabularnewline
\midrule
\endhead
a1 & b1\tabularnewline
a2 & b2\tabularnewline
\bottomrule
\end{longtable}

\def\pandoctableshortcapt{}  % .unlisted

\hypertarget{tbl:tbl-label3}{}
\begin{longtable}[]{@{}ll@{}}
\caption{\label{tbl:tbl-label3}This is the \emph{italicised long
caption} of tbl3, which is \textbf{unlisted}.}\tabularnewline
\toprule
cola & colb\tabularnewline
\midrule
\endfirsthead
\toprule
cola & colb\tabularnewline
\midrule
\endhead
a1 & b1\tabularnewline
a2 & b2\tabularnewline
\bottomrule
\end{longtable}

\undef\pandoctableshortcapt

\def\pandoctableshortcapt{Table 4 \emph{short} capt.}

\hypertarget{tbl:tbl-label4}{}
\begin{longtable}[]{@{}ll@{}}
\caption{\label{tbl:tbl-label4}This is the \emph{italicised long
caption} of tbl4, which has an \textbf{overriding} short-caption. This
is the expected usage.}\tabularnewline
\toprule
cola & colb\tabularnewline
\midrule
\endfirsthead
\toprule
cola & colb\tabularnewline
\midrule
\endhead
a1 & b1\tabularnewline
a2 & b2\tabularnewline
\bottomrule
\end{longtable}

\undef\pandoctableshortcapt

\hypertarget{non-standard-usageerrors}{%
\section{Non-standard usage/errors}\label{non-standard-usageerrors}}

\begin{longtable}[]{@{}ll@{}}
\caption{This is the \emph{italicised long caption} of tbl5, which does
not have a label, but does have empty braces at the end.
\{\}}\tabularnewline
\toprule
cola & colb\tabularnewline
\midrule
\endfirsthead
\toprule
cola & colb\tabularnewline
\midrule
\endhead
a1 & b1\tabularnewline
a2 & b2\tabularnewline
\bottomrule
\end{longtable}

\begin{longtable}[]{@{}ll@{}}
\caption{This is the \emph{italicised long caption} of tbl6, which does
not have a label, but does have an empty span at the end.
}\tabularnewline
\toprule
cola & colb\tabularnewline
\midrule
\endfirsthead
\toprule
cola & colb\tabularnewline
\midrule
\endhead
a1 & b1\tabularnewline
a2 & b2\tabularnewline
\bottomrule
\end{longtable}

\begin{longtable}[]{@{}ll@{}}
\caption{This is the \emph{italicised long caption} of tbl7, which is
improperly formatted, and will appear in the list of tables. This filter
requires that \texttt{.unlisted} is placed in a span. \{\#tbl:tbl-label7
.unlisted\}}\tabularnewline
\toprule
cola & colb\tabularnewline
\midrule
\endfirsthead
\toprule
cola & colb\tabularnewline
\midrule
\endhead
a1 & b1\tabularnewline
a2 & b2\tabularnewline
\bottomrule
\end{longtable}

\hypertarget{tbl:tbl-label8}{}
\begin{longtable}[]{@{}ll@{}}
\caption{\label{tbl:tbl-label8}This is the \emph{italicised long
caption} of tbl8, which has an empty short-caption. An empty
short-caption does nothing. The long caption will still be
used.}\tabularnewline
\toprule
cola & colb\tabularnewline
\midrule
\endfirsthead
\toprule
cola & colb\tabularnewline
\midrule
\endhead
a1 & b1\tabularnewline
a2 & b2\tabularnewline
\bottomrule
\end{longtable}

\def\pandoctableshortcapt{}  % .unlisted

\hypertarget{tbl:tbl-label9}{}
\begin{longtable}[]{@{}ll@{}}
\caption{\label{tbl:tbl-label9}This is the \emph{italicised long
caption} of tbl9, which is \textbf{unlisted}, yet has a
short-caption.}\tabularnewline
\toprule
cola & colb\tabularnewline
\midrule
\endfirsthead
\toprule
cola & colb\tabularnewline
\midrule
\endhead
a1 & b1\tabularnewline
a2 & b2\tabularnewline
\bottomrule
\end{longtable}

\undef\pandoctableshortcapt

\end{document}