summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/fcolumn/fcolumn.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/fcolumn/fcolumn.dtx')
-rw-r--r--macros/latex/contrib/fcolumn/fcolumn.dtx120
1 files changed, 64 insertions, 56 deletions
diff --git a/macros/latex/contrib/fcolumn/fcolumn.dtx b/macros/latex/contrib/fcolumn/fcolumn.dtx
index 41bee63cf1..26aaf7faff 100644
--- a/macros/latex/contrib/fcolumn/fcolumn.dtx
+++ b/macros/latex/contrib/fcolumn/fcolumn.dtx
@@ -14,7 +14,7 @@
% \fi
% \iffalse
%<package>\ProvidesPackage{fcolumn}
-%<package> [2021/01/14 v1.3 Automatic Currency Package (EHTO)]
+%<package> [2021/11/22 v1.4 Automatic Currency Package (EHTO)]
%<package>\NeedsTeXFormat{LaTeX2e}
%<package>\RequirePackage{array}[v2.4k]
%<*driver>
@@ -40,7 +40,7 @@ indention=0pt,labelsep=colon,justification=raggedright}
%</driver>
% \fi
% \RecordChanges
-% \CheckSum{1287}
+% \CheckSum{1292}
% \CharacterTable
% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
@@ -78,6 +78,8 @@ indention=0pt,labelsep=colon,justification=raggedright}
% in math environment are very tricky, but providing colour information works, see the example
% in the main text. This version is now compatible with package longtable. Version~1.3 is
% backwards compatible to~1.2: it only adds functionality.}
+% \changes{v1.4}{2021/11/21}{More robust version on the extra formatting information: alternative
+% formatting after the comma (if any), instead of additional information. Corrected a few typos.}
% \GetFileInfo{fcolumn.sty}
% \DoNotIndex{\@@endpbox,\@@startpbox,\@acol,\@arstrut,\@arstrutbox,\@classiv,\@classz,\@depth}
% \DoNotIndex{\@firstampfalse,\@firstamptrue,\@gobble,\@halignto,\@height,\@mkpream,\@ne,\@nextchar}
@@ -116,7 +118,7 @@ indention=0pt,labelsep=colon,justification=raggedright}
% The f-column in the current version of the package is defined for the
% continental European standard: |\newcolumntype{f}{F{.}{,}{3,2}{}}|. This
% means that a number like 12345,67 will be typeset as $12{.}345{,}67$.
-% People in the Anglo-saxon world would rather code
+% People in the Anglo-Saxon world would rather code
% |\newcolumntype{f}{F{,}{.}{3,2}{}}| for the same input, yielding
% $12{,}345{.}67$ as output for the number given above. The default
% value for |#3| is |3,2|, indicating
@@ -127,7 +129,7 @@ indention=0pt,labelsep=colon,justification=raggedright}
% four digits, that the separator in the source should be the character |p|,
% and there are three digits after the decimal mark---that happens to be a
% |\cdot|---, then simply specify |\newcolumntype{f}{F{\,}{\cdot}{4p3}{}}| in
-% that case. The input could be 12345p678 then, yielding $1{\,}2345{\cdot}678$
+% that case. The input could be 123456p78 then, yielding $12{\,}3456{\cdot}780$
% as output.
%
% By default two digits are used for the decimal part, so if you really
@@ -191,14 +193,14 @@ indention=0pt,labelsep=colon,justification=raggedright}
%
% This package is heavily inspired by the |dcolumn| package by
% David Carlisle~\cite{dcolumn}, some constructions are more or less
-% copied from that package. Version~1.3 (this version) incorporates the idea
+% copied from that package. Version~1.4 (this version) incorporates the idea
% of Christian Hoff of providing additional (formatting) information per column.
% A rather contrived example is given in Table~\ref{tab:ex3}, combining colour and fonts.
% \newcolumntype{q}[1]{F{.}{,}{3,2}{#1}}
% \begin{table}[htb]
% \caption{Example Table with column formatting.}
% \label{tab:ex3}
-% \begin{tabular}{@{}lq{\color{red}\mathsf,{}\mathbf}lq{\color{green}}@{}}
+% \begin{tabular}{@{}lq{\color{red}\mathsf,\mathbf}lq{\color{green}}@{}}
% \multicolumn4c{\bfseries Balance sheet}\\
% \toprule
% properties & \leeg{31 dec 2014} & debts & \leeg{31 dec 2014}\\
@@ -220,7 +222,7 @@ indention=0pt,labelsep=colon,justification=raggedright}
%\begin{table}[htb]
%\caption{Example Table with column formatting.}
%\label{tab:ex3}
-%\begin{tabular}{@{}lq{\color{red}\mathsf,{}\mathbf}lq{\color{green}}@{}}
+%\begin{tabular}{@{}lq{\color{red}\mathsf,\mathbf}lq{\color{green}}@{}}
%\multicolumn4c{\bfseries Balance sheet}\\
%...
%...(same financial contents as in Table 1)
@@ -232,15 +234,13 @@ indention=0pt,labelsep=colon,justification=raggedright}
% The font changing commands like |\mathsf| and |\mathbf| act on an argument, hence require
% braces, but these are already provided internally for this purpose. For that reason this
% type of commands must be given last, without braces (and if you don't specify a font
-% changing command, these extra internal braces are just redundant). The argument to
-% the new columntype may consist of two parts,
-% separated by a comma. In that case, the part to the left of the comma is applied to the
-% whole column and the right part is applied in addition to the result. The example in
-% Table~\ref{tab:ex3} shows this: the bold font is only used in the |\sumline| and the
-% effect of |\mathsf| is annulled by the brace pair before |\mathbf|. You may even change
-% the colour for the |\sumline|, e.g., blue by ``|,{}\color{blue}\mathbf|'', since colour
-% settings do not require braces and the last setting overrides a previous one. If you want
-% bold font for the whole column, leave out the comma (and the |\mathsf{}|).
+% changing command, these extra internal braces are just redundant). The argument to the
+% new columntype may consist of two parts, separated by a comma. In that case, the part to
+% the left of the comma is applied to the data entered by the user and the right part
+% is applied to the result. The example in Table~\ref{tab:ex3} shows this: the bold font
+% is only used in the |\sumline| and also the colour is back to the default (black). If
+% you want formatting for the whole column, like green colour as in the last column of
+% Table~\ref{tab:ex3}, leave out the comma.
%
% Note that changes in font size, e.g., ``|\huge|'' in ``|\huge\color{red}\mathbf|''
% as parameter to column type |q| are ignored by \LaTeX, since the formatting
@@ -270,8 +270,8 @@ indention=0pt,labelsep=colon,justification=raggedright}
%properties & \leeg{31 dec 2014} & debts & \leeg{31 dec 2014}\\
%\midrule
%\endhead
+%\multicolumn4{r@{}}{\small\textit{(Table continues on next page)\/}}\\
%\midrule
-%\multicolumn4{r@{}}{\textit{(Table continues on next page)\/}}\\
%\endfoot
%\bottomrule
%\endlastfoot
@@ -282,7 +282,7 @@ indention=0pt,labelsep=colon,justification=raggedright}
% \end{verbatim}
% \end{table}
%
-% \noindent And here is the result (it's ugly, but it had to be that long to
+% \noindent And here is the result (it's ugly, but it had to be this long to
% demonstrate the page break). Not shown here are the new |fcolumn|
% formatting possibilities (like new fonts and/or colours), but it has been
% checked they do work in combination with |longtable|.
@@ -299,24 +299,28 @@ indention=0pt,labelsep=colon,justification=raggedright}
% properties & \leeg{31 dec 2014} & debts & \leeg{31 dec 2014}\\
% \midrule
% \endhead
+% \multicolumn4{r@{}}{\small\textit{(Table continues on next page)\/}}\\
% \midrule
-% \multicolumn4{r@{}}{\textit{(Table continues on next page)\/}}\\
% \endfoot
% \bottomrule
% \endlastfoot
% house & 200000 & equity capital& 50000 \\
% bank account & -603,23 & mortgage & 150000 \\
-% savings 1 & 2800 \\
-% savings 2 & 2800 \\
-% savings 3 & 2800 \\
-% savings 4 & 2800 \\
-% savings 5 & 2800 \\
-% savings 6 & 2800 \\
-% savings 7 & 2800 \\
-% savings 8 & 2800 \\
-% savings 9 & 2800 \\
-% savings 10 & 2800 \\
-% cash & 145,85 & profit & 27542,62 \\
+% savings 1 & 2000 \\
+% savings 2 & 2000 \\
+% savings 3 & 2000 \\
+% savings 4 & 2000 \\
+% savings 5 & 2000 \\
+% savings 6 & 2000 \\
+% savings 7 & 2000 \\
+% savings 8 & 2000 \\
+% savings 9 & 2000 \\
+% savings 10 & 2000 \\
+% savings 11 & 2000 \\
+% savings 12 & 2000 \\
+% savings 13 & 2000 \\
+% savings 14 & 2000 \\
+% cash & 145,85 & profit & 27542,62 \\
% \sumline
% \end{longtable}
@@ -336,8 +340,8 @@ indention=0pt,labelsep=colon,justification=raggedright}
% than just setting the input decimal mark. By default the input grouping
% character is the dot, except when the dot is specified as input decimal
% mark; in that case the comma is acting as input grouping character. With
-% this convention the continental Europe and Anglo-saxon part of the world
-% is served. And using input grouping markers is optional.
+% this convention the continental Europe and Anglo-Saxon part of the world
+% is served. And using input grouping markers is optional anyway.
% \end{macro}
% \begin{macro}{\sumline}
% The numbers in an |F|-column are typeset as a financial amount, but the real
@@ -400,7 +404,7 @@ indention=0pt,labelsep=colon,justification=raggedright}
% Note that the rules in the first and third |F|-columns of project~1 cover
% $1{.}200{,}00$ whereas in project~2 those rules are narrower since they
% only cover $430{,}00$; still the columns are aligned. The verbatim way
-% of setting up Table~\ref{tab:ex7} is given in Table~\ref{tab:ex6}.
+% of setting up Table~\ref{tab:ex7} is given in Table~\ref{tab:ex8}.
% \begin{table}[htb]
% \caption{Verbatim version of Table~\ref{tab:ex7}.}
% \label{tab:ex8}
@@ -618,9 +622,9 @@ indention=0pt,labelsep=colon,justification=raggedright}
% The maximum then becomes $2^{63}-1$. Even expressed in cents this
% would lead to a maximum of slightly more than 92.2\thinspace P\EUR{};
% about 100 times the current world economy~\cite{world_economy}. Yet
-% another method is to used Heiko Oberdiek's package |bigintcalc|:
+% another method is to use Heiko Oberdiek's package |bigintcalc|:
% then only memory restrictions apply. This, however, requires a major
-% rewrite of |fcolumn|. For now, version~1.3 sticks to the moderate amounts.
+% rewrite of |fcolumn|. For now, version~1.4 sticks to the moderate amounts.
%
% There is no straightforward interpretation of |#1| being zero or
% negative, therefore this is used as an indicator that no grouping
@@ -771,15 +775,16 @@ indention=0pt,labelsep=colon,justification=raggedright}
% \end{macrocode}
% \end{macro}
%
-% The \meta{count}s |\FC@l| captures the part to the left of the decimal
-% mark, |\FC@r| that to the right.
+% The \meta{count}s |\FC@l| and |\FC@r| capture the part to the left and to the
+% right of the decimal mark, respectively.
% \begin{macrocode}
\newcount\FC@l \newcount\FC@r
% \end{macrocode}
% Some auxiliary definitions for capturing compacted information.
% \begin{macrocode}
\def\setucc@de#1#2\relax{\uccode`\~=`#1 }
-\def\assignform@t#1,#2,#3\end{\def\FCform@t{#1}\def\FCform@tt{#1#2}}
+\def\assignform@t#1,#2,#3\assignform@t{\def\FCform@t{#1}%
+ \def\FCform@tt{#2}\ifx\FCform@tt\@empty \def\FCform@tt{#1}\fi}
% \end{macrocode}
% \def\<#1>{\leavevmode\hbox{$\langle$#1\/$\rangle$}}
% \begin{macro}{\b@fi}
@@ -797,8 +802,8 @@ indention=0pt,labelsep=colon,justification=raggedright}
% \begin{macrocode}
\def\sep@xt##1##2\end{\def\sep@rator{{##1}}}%
\sep@xt#1\end\def\decim@lmark{{#2}}%
-\def\sp@l{#3}\assignform@t#4,,\end \global\advance\FCsc@l by \@ne
-\global\FC@l=0 \global\FC@r=1
+\def\sp@l{#3}\assignform@t#4,,\assignform@t\global\advance\FCsc@l by
+ \@ne \global\FC@l=0 \global\FC@r=1
% \end{macrocode}
% The value specified by the user is then captured by |\FC@l| and
% this is done in a special way: |\FC@l| is assigned globally within
@@ -923,7 +928,7 @@ indention=0pt,labelsep=colon,justification=raggedright}
% contain relevant information anyway. Outside the group, the sign
% of |\FC@r| can then be tested. This is a slight misuse of this
% |\count|, but now it's documented. In effect, |\FC@r| can only be~|-1|,
-% |1|, or at least~|10|, so the comparison |\ifnum\FC@r>0| does not mis~0.
+% |1|, or at least~|10|, so the comparison |\ifnum\FC@r>0| does not miss~0.
% \begin{macrocode}
\def\e@fi{\ifnum\mathcode`\0=\mathcode`- \global\FC@r=\m@ne\fi$\egroup
\ifnum\FC@r>0
@@ -932,7 +937,7 @@ indention=0pt,labelsep=colon,justification=raggedright}
% decimal part, |\FC@r| will still be~1, which doesn't parse well with
% |\secd@xt|, so a zero is appended, i.e., yielding~|10|.
% \begin{macrocode}
- \ifnum\FC@r<10 \FC@r=10 \fi
+ \ifnum\FC@r=1 \FC@r=10 \fi
% \end{macrocode}
% Next is a loop for bringing the decimal part in the correct way to
% the integer part. The loop is performed the number of decimal
@@ -940,6 +945,9 @@ indention=0pt,labelsep=colon,justification=raggedright}
% means that if you provided more decimal digits than this, the excess
% digit(s) will not be handled and a |\PackageWarning| will be given,
% showing these excess digits. This is truncation, not rounding!
+% There is one situation in which this code doesn't catch all:
+% when exactly one extra zero was provided. And in that case truncation
+% is a no-op.
% \begin{macrocode}
\def\i@ts##1##2{\count0=##2}
\afterassignment\i@ts\count@\sp@l
@@ -950,7 +958,7 @@ indention=0pt,labelsep=colon,justification=raggedright}
\def\tw@l##1##2\relax{##2}
\PackageWarning{fcolumn}{Excess digit\ifnum\FC@r>100 s\fi\space
``\expandafter\tw@l\number\FC@r\relax'' in decimal part
- \MessageBreak ignored}
+ \MessageBreak ignored near or}
\fi
% \end{macrocode}
% Don't forget to correct for the sign (once this is done, |\FCs@gn|
@@ -963,23 +971,23 @@ indention=0pt,labelsep=colon,justification=raggedright}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\secd@xt}
-% The second digit from the left is needed from a decimal number. The
-% macro |\secd@xt| extracts that digit, provided that the number has at
-% least two digits, but that is guaranteed by |\e@fi|. That second digit
-% is then added to |\FC@l|. A new number is assigned to |\FC@r|, that
-% consists of the digits of |#1#3|. If |#3| was empty, a zero is appended.
-% In this way |\FC@r| is prepared for insertion in the next invocation of
-% |\secd@xt|. In iterating: 1234 yields~134, yields~14, yields~10,
-% stays~10, etc.
+% The second digit from the left is needed from a string of characters
+% representing a decimal number. The macro |\secd@xt| extracts that digit,
+% provided that the number has at least two digits, but that is guaranteed by
+% |\e@fi|. That second digit is then added to |\FC@l|. A new number is
+% assigned to |\FC@r|, that consists of the digits of |#1#3|. If |#3| was
+% empty, 10 is assigned. In this way |\FC@r| is prepared for insertion in
+% the next invocation of |\secd@xt|. In iterating: 1234 yields~134, yields~14,
+% yields~10, stays~10, etc.
% \begin{macrocode}
\def\secd@xt#1#2#3\end{\advance\FC@l by #2
-\FC@r=#1#3 \ifnum\FC@r<10 \multiply\FC@r by 10 \fi}
+\FC@r=#1#3 \ifnum\FC@r=1 \FC@r=10 \fi}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\restorem@thcodes}
% As shown above, once the first digit, or sign, or decimal separator, or
% grouping character is scanned, the decimal digits should loose their
-% activeness. That is done here rather blunt, since the actual
+% activeness. That is done here in a rather blunt way, since the actual
% |\mathcode| is not important---as long as it is not |"8000|---because
% the digits are not used for typesetting (and even if they were; it's
% inside |\box0|, whose contents will be discarded). When the |$|
@@ -1348,8 +1356,8 @@ FCtot@\romannumeral\FCsc@l\endcsname}$}%
\expandafter\fre@t\FC@chklist\end
\ifnum\csname FCtot@\romannumeral\count0\endcsname=
\csname FCtot@\romannumeral\count1\endcsname\else
- \PackageWarningNoLine{fcolumn}{F-columns \number\count0 \space
- and \number\count1 \space do not balance}%
+ \PackageWarning{fcolumn}{F-columns \number\count0 \space
+ and \number\count1 \space do not balance near or}%
\fi
\repeat}
% \end{macrocode}
@@ -1387,7 +1395,7 @@ FCtot@\romannumeral\FCsc@l\endcsname}$}%
% loading of |longtable|.
% \begin{macrocode}
\ifx\longtable\@undefined
- \PackageWarning{fcolumn}{fcolumn is loaded without longtable. That's
+ \PackageWarningNoLine{fcolumn}{fcolumn is loaded without longtable. That's
OK, but\MessageBreak if you want to load longtable as well, make sure
\MessageBreak it is done before loading fcolumn}
\fi