| 1 |
\DocumentMetadata{lang=en,tagging=on} |
| 2 |
\documentclass[12pt,a4paper]{article} |
| 3 |
\usepackage[margin=1in]{geometry} |
| 4 |
\usepackage{dcolumn} |
| 5 |
\usepackage{booktabs} |
| 6 |
\usepackage{fcolumn} |
| 7 |
\usepackage{longtable} |
| 8 |
\usepackage[tableposition=top,aboveskip=0pt]{caption} |
| 9 |
% The next lines are a fix to the caption package, as that package is incompatible with tagging. |
| 10 |
\RemoveFromHook{begindocument}[latex-lab-testphase-float] |
| 11 |
\makeatletter \ExplSyntaxOn |
| 12 |
\socket_new_plug:nnn{tagsupport/parbox/before}{caption} |
| 13 |
{\tagpdfparaOn %restart para tagging |
| 14 |
\tl_if_empty:NTF\@current@float@struct{\tag_struct_begin:n{tag=Caption,firstkid}} |
| 15 |
{\tag_struct_begin:n{tag=Caption,parent=\@current@float@struct,firstkid}}} |
| 16 |
\socket_new_plug:nnn{tagsupport/parbox/after}{caption}{\tag_struct_end:} |
| 17 |
\l@addto@macro\caption@beginex@hook{% |
| 18 |
\tagpdfparaOff %leavevmode in parbox should not start paragraph structure |
| 19 |
\AssignSocketPlug{tagsupport/parbox/before}{caption} |
| 20 |
\AssignSocketPlug{tagsupport/parbox/after}{caption}} |
| 21 |
\ExplSyntaxOff \makeatother % End fix |
| 22 |
\DeclareCaptionStyle{normal}{labelfont={rm,bf,small},textfont={rm,small}, |
| 23 |
indention=0pt,labelsep=colon,justification=raggedright} |
| 24 |
\captionsetup[table]{style=normal} |
| 25 |
\captionsetup{singlelinecheck=false} |
| 26 |
\usepackage{color} |
| 27 |
\usepackage[hang,symbol*,perpage]{footmisc} |
| 28 |
\ExplSyntaxOn \makeatletter \def\LT@output{% |
| 29 |
\ifnum\outputpenalty <-\@Mi |
| 30 |
\ifnum\outputpenalty > -\LT@end@pen |
| 31 |
\LT@err{floats~ and~ marginpars~ not~ allowed~ in~ a~ longtable}\@ehc |
| 32 |
\else |
| 33 |
\setbox\z@\vbox{\unvbox\@cclv}% |
| 34 |
\ifdim \ht\LT@lastfoot>\ht\LT@foot |
| 35 |
\dimen@\pagegoal |
| 36 |
\advance\dimen@\ht\LT@foot |
| 37 |
\advance\dimen@-\ht\LT@lastfoot |
| 38 |
\ifdim\dimen@<\ht\z@ |
| 39 |
\setbox\@cclv\vbox{\unvbox\z@\copy\LT@foot |
| 40 |
% \vss % old line |
| 41 |
\vskip 0pt plus \maxdimen minus \normalbaselineskip |
| 42 |
}\@makecol |
| 43 |
\@expl@@@mark@update@singlecol@structures@@ |
| 44 |
\@outputpage \global\vsize\@colroom |
| 45 |
\setbox\z@\vbox{\box\LT@head}% |
| 46 |
\fi |
| 47 |
\fi |
| 48 |
\unvbox\z@\box\ifvoid\LT@lastfoot\LT@foot\else\LT@lastfoot\fi |
| 49 |
\UseTaggingSocket{tbl/longtable/foot} |
| 50 |
\fi |
| 51 |
\else |
| 52 |
\setbox\@cclv\vbox{\unvbox\@cclv\copy\LT@foot |
| 53 |
% \vss % old line |
| 54 |
\vskip 0pt plus \maxdimen minus \normalbaselineskip |
| 55 |
}\UseTaggingSocket{tbl/longtable/foot}\@makecol |
| 56 |
\@expl@@@mark@update@singlecol@structures@@ |
| 57 |
\@outputpage \global\vsize\@colroom \copy\LT@head\nobreak |
| 58 |
\fi} |
| 59 |
\makeatother \ExplSyntaxOff |
| 60 |
\def\cs#1{{\tt #1}} |
| 61 |
\begin{document} |
| 62 |
%\NewHookWithArguments{tbl/init}{2} \NewHook{tbl/row/end} |
| 63 |
\noindent |
| 64 |
Document showing all tables from \cs{fcolumn.pdf} (except the verbatim |
| 65 |
versions) but now without using \cs{\char`\\documentclass\{ltxdoc\}}, |
| 66 |
i.e., in a ``normal'' \LaTeX-file. It is using \cs{\char`\\DocumentMetadata}, |
| 67 |
however. The \cs{caption} package needed to be patched, since without patching |
| 68 |
it is incompatible with tagging. |
| 69 |
|
| 70 |
But first a small equation to trigger some math as proof that the math |
| 71 |
tagging still takes place. |
| 72 |
\begin{equation} |
| 73 |
x^n+y^n=z^n |
| 74 |
\end{equation} |
| 75 |
|
| 76 |
\floatsep=5pt plus 2pt minus 3pt |
| 77 |
\textfloatsep=5pt plus 2pt minus 3pt |
| 78 |
\renewcommand{\bottomfraction}{0.9} |
| 79 |
\renewcommand{\textfraction}{0.1} |
| 80 |
\begin{table}[htb] |
| 81 |
\caption{Example Table.} \label{tab:ex1} |
| 82 |
\begin{tabular}{@{}lflf@{}} |
| 83 |
\multicolumn4{@{}c@{}}{\bfseries Balance sheet}\\ |
| 84 |
\toprule |
| 85 |
properties & \leeg{31 dec 2014} & debts & \leeg{31 dec 2014}\\ |
| 86 |
\midrule |
| 87 |
house & 200000 & equity capital & 50000 \\ |
| 88 |
bank account & -603,23 & mortgage & 150000 \\ |
| 89 |
savings & 28000 \\ |
| 90 |
cash & 145,85 & profit & 27542,62 \\ |
| 91 |
\sumline |
| 92 |
\bottomrule |
| 93 |
\end{tabular} |
| 94 |
\end{table} |
| 95 |
|
| 96 |
\newcolumntype{q}[1]{F.,{3,2}{#1}} |
| 97 |
\begin{table}[htb] |
| 98 |
\caption{Example Table with column formatting.} \label{tab:fcformat} |
| 99 |
\begin{tabular}{@{}lq{\color{blue}\mathsf,\mathbf}lq{\color{magenta}}@{}} |
| 100 |
\multicolumn4{@{}c@{}}{\bfseries Balance sheet}\\ |
| 101 |
\toprule |
| 102 |
properties & \leeg{31 dec 2014} & debts & \leeg{31 dec 2014}\\ |
| 103 |
\midrule |
| 104 |
house & 200000 & equity capital & 50000 \\ |
| 105 |
bank account & -603,23 & mortgage & 150000 \\ |
| 106 |
savings & 28000 \\ |
| 107 |
cash & 145,85 & profit & 27542,62 \\ |
| 108 |
\sumline |
| 109 |
\bottomrule |
| 110 |
\end{tabular} |
| 111 |
\end{table} |
| 112 |
|
| 113 |
\vskip45mm |
| 114 |
\begin{longtable}[l]{@{}lflf@{}} |
| 115 |
\caption{Table showing compatibility of fcolumn and |
| 116 |
longtable.\label{tab:fclong}}\\ |
| 117 |
\multicolumn4{@{}c@{}}{\bfseries Balance sheet}\\ |
| 118 |
\toprule |
| 119 |
properties & \leeg{31 dec 2014} & debts & \leeg{31 dec 2014}\\ |
| 120 |
\midrule |
| 121 |
\endfirsthead |
| 122 |
\caption[]{\textit{(continued from previous page)\/}}\\ |
| 123 |
\toprule |
| 124 |
properties & \leeg{31 dec 2014} & debts & \leeg{31 dec 2014}\\ |
| 125 |
\midrule |
| 126 |
\endhead |
| 127 |
\bottomrule |
| 128 |
\multicolumn4{@{}r@{}}{\small\textit{(Table continues on |
| 129 |
next page)\/}}\\ |
| 130 |
\endfoot |
| 131 |
\bottomrule |
| 132 |
\endlastfoot |
| 133 |
house & 200000 & equity capital & 50000 \\ |
| 134 |
bank account & -603,23 & mortgage & 150000 \\ |
| 135 |
savings 1 & 5600 \\ |
| 136 |
savings 2 & 5600 \\ |
| 137 |
savings 3 & 5600 \\ |
| 138 |
savings 4 & 5600 \\ |
| 139 |
savings 5 & 5600 \\ |
| 140 |
cash & 145,85 & profit & 27542,62 \\ |
| 141 |
\sumline |
| 142 |
\end{longtable} |
| 143 |
|
| 144 |
|
| 145 |
Demonstrating \cs{\char`\\resetsumline}. |
| 146 |
\begin{table}[htb] |
| 147 |
\caption{Example: multiple projects.} \label{tab:fcmult} |
| 148 |
\begin{tabular}{@{}lfflff@{}} |
| 149 |
\multicolumn6{@{}c@{}}{\bfseries Project~1}\\ |
| 150 |
\toprule |
| 151 |
expense & \leeg{actual} & \leeg{budget} & |
| 152 |
income & \leeg{actual} & \leeg{budget} \\ |
| 153 |
\midrule |
| 154 |
food & 450,20 & 500 & tickets & 1200 & 1000 \\ |
| 155 |
drinks & 547,5 & 400 \\ |
| 156 |
music & 180 & 100 \\ |
| 157 |
profit & 22,3 \\ |
| 158 |
\sumline[2pt][10pt] |
| 159 |
\resetsumline |
| 160 |
\multicolumn6{@{}c@{}}{\bfseries Project~2}\\ |
| 161 |
\toprule |
| 162 |
expense & \leeg{actual} & \leeg{budget} & |
| 163 |
income & \leeg{actual} & \leeg{budget} \\ |
| 164 |
\midrule |
| 165 |
food & 250 & 300 & tickets & 400 & 450 \\ |
| 166 |
drinks & 100 & 80 \\ |
| 167 |
music & 80 & 70 & loss & 30 \\ |
| 168 |
\sumline |
| 169 |
\bottomrule |
| 170 |
\end{tabular} |
| 171 |
\end{table} |
| 172 |
|
| 173 |
The contents of Table~\ref{tab:fcoverflow} below will normally generate |
| 174 |
errors---that can be ignored here because that's the whole purpose of this |
| 175 |
demonstration table. In production runs, however, that's annoying, so |
| 176 |
a redefinition of \cs{\char`\\PackageError} is included within the table |
| 177 |
environment. If you want to see the raw errors generated by the tabular, |
| 178 |
remove (or comment) the line redefining it. |
| 179 |
|
| 180 |
\begin{table}[htb] |
| 181 |
\def\PackageError#1#2#3{\PackageWarning{#1}{#2: #3}} |
| 182 |
\caption{Examples on overflow.} |
| 183 |
\label{tab:fcoverflow} |
| 184 |
\begin{tabular}{@{}lfff@{}} |
| 185 |
\multicolumn4{@{}c@{}}{\bfseries Projects}\\ |
| 186 |
\toprule |
| 187 |
income & \leeg{31 dec 2014} & \leeg{31 dec 2015} & \leeg{31 dec 2016} \\ |
| 188 |
\midrule |
| 189 |
item~1 & 20000000 & 20000000 & 20000000 \\ |
| 190 |
item~2 & 10000000 & 2000000 & -1500000 \\ |
| 191 |
item~3 & 5000000 & -1500000 & 2000000 \\ |
| 192 |
\checkfcolumns23 |
| 193 |
\sumline |
| 194 |
\bottomrule |
| 195 |
\end{tabular} |
| 196 |
\end{table} |
| 197 |
|
| 198 |
In Table~\ref{tab:fctrunc} more decimals after the decimal mark are given. |
| 199 |
\newcolumntype{d}{D,,{-1}} |
| 200 |
\begin{table}[htb] |
| 201 |
\caption{Truncating excess digits.} |
| 202 |
\label{tab:fctrunc} |
| 203 |
\begin{tabular}{@{}ldfl@{}} |
| 204 |
\toprule |
| 205 |
composer & \multicolumn1c{raw entry} & \leeg{debt} & remark \\ |
| 206 |
\midrule |
| 207 |
Berg & 123,450 & 123,450 & silently ignoring digit ``0'' \\ |
| 208 |
Eisler & 234,563 & 234,563 & warning: digit ``3'' ignored \\ |
| 209 |
Sch\"onberg & 345,6704 & 345,6704 & warning: digits ``04'' ignored \\ |
| 210 |
Webern & 2,3456 & 2,3456 & warning: digits ``56'' ignored, i.e., \\ |
| 211 |
& & & \quad without rounding this entry to 2,35 \\ |
| 212 |
\sumline |
| 213 |
\bottomrule |
| 214 |
\end{tabular} |
| 215 |
\end{table} |
| 216 |
|
| 217 |
And to end, copies of Table~\ref{tab:ex1}, now with strict accounting |
| 218 |
layout and with red colour for negative numbers, are given in |
| 219 |
Tables~\ref{tab:ex2} and~\ref{tab:ex3} respectively. |
| 220 |
\begin{table}[htb] |
| 221 |
\makeatletter \strict@ccountingtrue |
| 222 |
\caption{Example Table.} \label{tab:ex2} |
| 223 |
\begin{tabular}{@{}lflf@{}} |
| 224 |
\multicolumn4{@{}c@{}}{\bfseries Balance sheet}\\ |
| 225 |
\toprule |
| 226 |
properties & \leeg{31 dec 2014} & debts & \leeg{31 dec 2014}\\ |
| 227 |
\midrule |
| 228 |
house & 200000 & equity capital & 50000 \\ |
| 229 |
bank account & -603,23 & mortgage & 150000 \\ |
| 230 |
savings & 28000 \\ |
| 231 |
cash & 145,85 & profit & 27542,62 \\ |
| 232 |
\sumline |
| 233 |
\bottomrule |
| 234 |
\end{tabular} |
| 235 |
\end{table} |
| 236 |
|
| 237 |
\begin{table}[htb] |
| 238 |
\makeatletter \minusr@dtrue |
| 239 |
\caption{Example Table.} \label{tab:ex3} |
| 240 |
\begin{tabular}{@{}lflf@{}} |
| 241 |
\multicolumn4{@{}c@{}}{\bfseries Balance sheet}\\ |
| 242 |
\toprule |
| 243 |
properties & \leeg{31 dec 2014} & debts & \leeg{31 dec 2014}\\ |
| 244 |
\midrule |
| 245 |
house & 200000 & equity capital & 50000 \\ |
| 246 |
bank account & -603,23 & mortgage & 150000 \\ |
| 247 |
savings & 28000 \\ |
| 248 |
cash & 145,85 & profit & 27542,62 \\ |
| 249 |
\sumline |
| 250 |
\bottomrule |
| 251 |
\end{tabular} |
| 252 |
\end{table} |
| 253 |
\end{document} |