summaryrefslogtreecommitdiff
path: root/Master/texmf-dist
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2018-11-03 21:07:14 +0000
committerKarl Berry <karl@freefriends.org>2018-11-03 21:07:14 +0000
commitf42bae9a52bba6f3c8bf222555340eefc9ebd981 (patch)
tree15e91953e2bd27ba2beca9eb7282071c41335b02 /Master/texmf-dist
parent352e3dbcfd1c78ac07708000abf8839d4002393b (diff)
keyvaltable (3nov18)
git-svn-id: svn://tug.org/texlive/trunk@49063 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r--Master/texmf-dist/doc/latex/keyvaltable/README.md2
-rw-r--r--Master/texmf-dist/doc/latex/keyvaltable/keyvaltable.pdfbin317235 -> 328242 bytes
-rw-r--r--Master/texmf-dist/source/latex/keyvaltable/keyvaltable.dtx149
-rw-r--r--Master/texmf-dist/source/latex/keyvaltable/keyvaltable.ins4
-rw-r--r--Master/texmf-dist/tex/latex/keyvaltable/keyvaltable.sty34
5 files changed, 145 insertions, 44 deletions
diff --git a/Master/texmf-dist/doc/latex/keyvaltable/README.md b/Master/texmf-dist/doc/latex/keyvaltable/README.md
index d3b24bce2ed..372e35c20a5 100644
--- a/Master/texmf-dist/doc/latex/keyvaltable/README.md
+++ b/Master/texmf-dist/doc/latex/keyvaltable/README.md
@@ -1,7 +1,7 @@
The keyvaltable Package
=======================
-Copyright (C) 2016 Richard Gay
+Copyright (C) 2016-2018 Richard Grewe
Released under the [LaTeX Project Public License](http://www.latex-project.org/lppl/) version 1.2 or later
diff --git a/Master/texmf-dist/doc/latex/keyvaltable/keyvaltable.pdf b/Master/texmf-dist/doc/latex/keyvaltable/keyvaltable.pdf
index b75bf154923..d27eb190263 100644
--- a/Master/texmf-dist/doc/latex/keyvaltable/keyvaltable.pdf
+++ b/Master/texmf-dist/doc/latex/keyvaltable/keyvaltable.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/latex/keyvaltable/keyvaltable.dtx b/Master/texmf-dist/source/latex/keyvaltable/keyvaltable.dtx
index 130f9cdaab2..f049c78e3cd 100644
--- a/Master/texmf-dist/source/latex/keyvaltable/keyvaltable.dtx
+++ b/Master/texmf-dist/source/latex/keyvaltable/keyvaltable.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-% Copyright (C) 2016 by Richard Gay <gay@mais.informatik.tu-darmstadt.de>
+% Copyright (C) 2016-2018 by Richard Grewe <r-g+tex@posteo.net>
% -------------------------------------------------------
%
% This file may be distributed and/or modified under the
@@ -22,7 +22,7 @@
%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<package>\ProvidesPackage{keyvaltable}
%<*package>
- [2016/05/22 v0.2 Package for filling tables using key-value lists]
+ [2018/11/01 v0.3b Package for filling tables using key-value lists]
%</package>
%
%<*driver>
@@ -54,7 +54,10 @@
% and ref mechanism is otherwise disabled.
\newcommand\FakeRefs{%
\def\ref##1{\csuse{fakelabel@##1}}%
- \def\label##1{\global\csletcs{fakelabel@##1}{@currentlabel}}%
+ \def\cref##1{\csuse{cref@\csuse{fakelname@##1}@name}\ \ref{##1}}%
+ \renewcommand\label[2][]{%
+ \csgdef{fakelname@##2}{##1}%
+ \global\csletcs{fakelabel@##2}{@currentlabel}}%
\let\marginpar=\origmarginpar
}
\let\origmarginpar=\marginpar
@@ -64,6 +67,7 @@
\CodelineIndex
\RecordChanges
% the following packages are for the examples
+\usepackage{cleveref}
\usepackage{xintexpr}
\usepackage{makecell}
\begin{document}
@@ -93,6 +97,7 @@
% Right brace \} Tilde \~}
%
% \changes{v0.1}{2016/03/13}{Initial version}
+% \changes{v0.3b}{2018/11/01}{Package author's name change}
%
% \GetFileInfo{keyvaltable.dtx}
%
@@ -104,7 +109,7 @@
% The package is available online at
% \url{http://www.ctan.org/pkg/keyvaltable} and
% \url{https://github.com/Ri-Ga/keyvaltable}.}}
-% \author{Richard Gay \\ \texttt{gay@mais.informatik.tu-darmstadt.de}}
+% \author{Richard Grewe \\ \texttt{r-g+tex@posteo.net}}
%
% \maketitle
%
@@ -246,6 +251,22 @@
% must then be a comma-separated list of \meta{property}|=|\meta{value}
% pairs. The following \meta{property} names are available:
% \begin{description}\label{page:table-options}
+% \item[|shape|:]
+% This property specifies the table's shape. For \meta{value}, the
+% package currently supports |multipage| (the default) and |onepage|.
+% In case of |multipage|, the table may span multiple pages and on
+% each page, the column header is repeated. In case of |onepage|, the
+% table does not split into multiple pages.
+% \item[|showhead|:]
+% This property specifies whether the head row shall be shown. The
+% \meta{value} must be a Boolean (i.e., |true| or |false|), where
+% |true| (the default) specifies that the head row is shown and
+% |false| specifies that the head row is not shown.
+% \item[|headbg|:]
+% This property specifies the background color of the head row. The
+% \meta{value} must be a single color specification that is understood
+% by the \textsf{xcolor} package.\footnote{The \meta{value} is passed
+% directly to the \cs{rowcolor} macro.} The default is |black!14|.
% \item[|rowbg|:]
% This property specifies the background colors of content rows. The
% format of the \meta{value} for this property must be
@@ -253,18 +274,26 @@
% passed directly to \cs{taburowcolors} of the \textsf{tabu} package.}
% The default is |white..black!10|, i.e., alternatingly white and light
% very gray.
-% \item[|headbg|:]
-% This property specifies the background color of the head row. The
-% \meta{value} must be a single color specification that is understood
-% by the \textsf{xcolor} package.\footnote{The \meta{value} is passed
-% directly to the \cs{rowcolor} macro.} The default is |black!14|.
-% \item[|shape|:]
-% This property specifies the table's shape. For \meta{value}, the
-% package currently supports |multipage| (the default) and |onepage|.
-% In case of |multipage|, the table may span multiple pages and on
-% each page, the column header is repeated. In case of |onepage|, the
-% table does not split into multiple pages.
% \end{description}
+% The following example shows the \meta{options} in action.
+% \begin{LTXexample}
+% \NewKeyValTable[shape=onepage,
+% showhead=false, headbg=blue!25,
+% rowbg=blue!10..blue!15,
+% ]{TabOptions}{
+% opt: align=l, format=\texttt;
+% val: align=l, format=\texttt;}
+% \begin{table}\centering
+% \begin{KeyValTable}{TabOptions}
+% \Row{opt=shape, val=onepage}
+% \Row{opt=showhead, val=false}
+% \Row{opt=headbg, val=blue!25}%invisible
+% \Row{opt=rowbg, val=blue!10..blue!15}
+% \end{KeyValTable}
+% \caption{table options demo}
+% \end{table}
+% \end{LTXexample}
+%
%
% \NiceDescribeMacro{\Row}{\marg{content}}
% A table row is produced by the |\Row| macro. The
@@ -386,7 +415,7 @@
% used for this purpose.
% \begin{LTXexample}[preset=\FakeRefs]
% \NewKeyValTable{Labeled}{
-% label: align=r, head=\#,
+% label: align=r, head=\textbf{\#},
% format=\kvtLabel{kvtRow};
% text: align=l, head=\textbf{Text}}
% \begin{KeyValTable}{Labeled}
@@ -395,7 +424,7 @@
% \end{KeyValTable}
% \end{LTXexample}
%
-% \NiceDescribeMacro{\kvtLabel}{\marg{counter}\marg{label}}
+% \NiceDescribeMacro{\kvtLabel}{\oarg{labelopts}\marg{counter}\marg{label}}
% The |\kvtLabel| macro shows the current value of the \meta{counter} --
% in particular |kvtRow|, |kvtTypeRow|, and |kvtTotalRow| -- and sets
% the \meta{label} to the value of \meta{counter}. When using the macro
@@ -403,8 +432,38 @@
% must be provided, as the above example shows. The second argument
% (\meta{label}) is provided by the respective cell content.
%
+% The |\kvtLabel| macro should work well with packages that change the
+% referencing, like \textsf{cleveref} or \textsf{varioref}. When using a
+% package that add an optional argument to the |\label| command (like
+% \textsf{cleveref} does), the \meta{labelopts} can be used to pass an
+% optional argument to |\label|. This feature is demonstrated in
+% \cref{sec:package-cleveref}.
+%
+%
% \section{Use with Other Packages}
%
+% \subsection{Named References}\label{sec:package-cleveref}
+%
+% The |\kvtLabel| feature of the \textsf{keyvaltable} package can be
+% used together with named references, as provided by the
+% \textsf{cleveref} package. A name to a row label can be given by using
+% the optional first argument to the |\kvtLabel| formatting macro and
+% specifying the name to use using |\crefname|. The following example
+% uses ``row'' for the optional argument and ``line'' for the displayed
+% name of the reference.
+% \begin{LTXexample}[preset=\FakeRefs]
+% \usepackage{cleveref}
+% \crefname{row}{line}{lines}
+% \NewKeyValTable{NamedRef}{
+% label: align=r, head=\textbf{Line},
+% format=\kvtLabel[row]{kvtRow};
+% text: align=l, head=\textbf{Text}}
+% \begin{KeyValTable}{NamedRef}
+% \Row{text=First row, label=one}
+% \Row{text=After \cref{one}}
+% \end{KeyValTable}
+% \end{LTXexample}
+%
% \subsection{Computational Cells}
%
% The mechanism of cell formatting macros enables a simple means for
@@ -568,6 +627,21 @@
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\kvt@addbooltableprop}
+% The |\kvt@addbooltableprop|\marg{name}\marg{default}
+% macro adds a new table option, named \meta{name} and with default
+% value \meta{default} and possible values being booleans (|true|,
+% |false|).
+% \begin{macrocode}
+\newcommand\kvt@addbooltableprop[2]{%
+ \define@boolkey[kvt]{defaults}{#1}{%
+ \kvt@lazypreset{Table}{#1=##1}}%
+ \presetkeys[kvt]{defaults}{#1=#2}{}%
+ \define@boolkey[kvt]{Table}{#1}%
+ {\csdef{cmdkvt@Table@#1}{##1}}%
+ \presetkeys[kvt]{Table}{#1=#2}{}}
+% \end{macrocode}
+% \end{macro}
%
% \begin{macro}{\kvt@addcolumnprop}
% The |\kvt@addcolumnprop|\marg{name}\marg{default} macro adds a new
@@ -626,6 +700,7 @@
% \begin{macrocode}
\kvt@addtableprop{rowbg}{white..black!10}
\kvt@addtableprop{headbg}{black!14}
+\kvt@addbooltableprop{showhead}{true}
\kvt@addchoicetableprop{shape}{multipage}{multipage,onepage}
\kvt@addcolumnprop{default}{}
\kvt@addcolumnprop{format}{\kvt@struttedcell}
@@ -640,8 +715,9 @@
% the argument \meta{arg} with a |\strut|. When used for formatting
% cell content, this makes sure that there is some vertical space
% between the content of a cell and the top and bottom of the row.
+% \changes{v0.3}{2016/06/06}{Fix for cells with vertical material}
% \begin{macrocode}
-\newcommand\kvt@struttedcell[1]{\strut #1\strut}
+\newcommand\kvt@struttedcell[1]{\strut #1\ifhmode\expandafter\strut\fi}
% \end{macrocode}
% \end{macro}
%
@@ -749,24 +825,35 @@
% \end{macro}
%
% \begin{macro}{\kvtLabel}
-% The |\kvtLabel|\marg{counter}\marg{label} macro sets a label, named
-% \meta{label}, for the current value of the \LaTeX{} counter named
-% \meta{counter}.
+% The |\kvtLabel|\oarg{labelopts}\marg{counter}\marg{label} macro sets
+% a label, named \meta{label}, for the current value of the \LaTeX{}
+% counter named \meta{counter}.
% \changes{v0.2}{2016/05/22}{Added macro for row labeling}
+% \changes{v0.3}{2016/06/09}{Robustified for use with, e.g., \textsf{cleveref}}
% \begin{macrocode}
-\newcommand\kvtLabel[2]{%
+\newcommand\kvtLabel[3][]{%
% \end{macrocode}
% The following imitates a |\refstepcounter| in the sense of setting the
-% current label, but it does not touch the \meta{counter}.
+% current label, but it does not touch the \meta{counter} (in case
+% someone added some custom hooks to them).
% \begin{macrocode}
- \protected@edef\@currentlabel
- {\csname p@#1\endcsname\csname the#1\endcsname}%
+ \setcounter{kvt@LabelCtr}{\csname the#2\endcsname}%
+ \addtocounter{kvt@LabelCtr}{-1}%
+ \refstepcounter{kvt@LabelCtr}%
% \end{macrocode}
% Next, define the \meta{label} (if provided) and show the value of
% \meta{counter}.
% \begin{macrocode}
- \ifstrempty{#2}{}{\label{#2}}%
- \csuse{the#1}}
+ \ifstrempty{#3}{}{%
+ \ifstrempty{#1}{\label{#3}}{\label[#1]{#3}}}%
+ \csuse{the#2}}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{kvt@LabelCtr}
+% The |kvt@LabelCtr| counter is an auxiliary counter for setting labels,
+% used by |\kvtLabel|.
+% \begin{macrocode}
+\newcounter{kvt@LabelCtr}
% \end{macrocode}
% \end{macro}
%
@@ -828,15 +915,17 @@
% \end{macrocode}
% The |\kvt@@recenttable| allows the |\AfterEndEnvironment| hook for
% |KeyValTable| to access the most recent table type.
+% \changes{v0.3}{2016/06/05}{Added \texttt{showhead} option}
% \begin{macrocode}
\gdef\kvt@@recenttable{#2}%
\bgroup\edef\kvt@@do{\egroup
- \noexpand\taburowcolors[2] 2{\cmdkvt@Table@rowbg}%
\noexpand\begin{#1}{\csuse{kvt@alignments@#2}}%
\noexpand\toprule
- \noexpand\rowcolor{\cmdkvt@Table@headbg}%
+ \ifbool{kvt@Table@showhead}{%
+ \noexpand\rowcolor{\cmdkvt@Table@headbg}%
+ \unexpanded{\csuse{kvt@headings@#2}\\\midrule}}{}%
+ \noexpand\taburowcolors 2{\cmdkvt@Table@rowbg}%
}\kvt@@do%
- \csuse{kvt@headings@#2}\\\midrule
\iftabu@long\expandafter\endhead\fi
\setcounter{kvtRow}{1}%
\setcounter{kvtTypeRow}{\csuse{kvt@rowcount@#2}}%
diff --git a/Master/texmf-dist/source/latex/keyvaltable/keyvaltable.ins b/Master/texmf-dist/source/latex/keyvaltable/keyvaltable.ins
index ab37848ec76..9c606c8ca5e 100644
--- a/Master/texmf-dist/source/latex/keyvaltable/keyvaltable.ins
+++ b/Master/texmf-dist/source/latex/keyvaltable/keyvaltable.ins
@@ -1,5 +1,5 @@
%%
-%% Copyright (C) 2016 by Richard Gay <gay@mais.informatik.tu-darmstadt.de>
+%% Copyright (C) 2016-2018 by Richard Grewe <r-g+tex@posteo.net>
%%
%% This file may be distributed and/or modified under the conditions of
%% the LaTeX Project Public License, either version 1.2 of this license
@@ -17,7 +17,7 @@
\usedir{tex/latex/keyvaltable}
\preamble
-Copyright (C) 2016 by Richard Gay <gay@mais.informatik.tu-darmstadt.de>
+Copyright (C) 2016-2018 by Richard Grewe <r-g+tex@posteo.net>
This file may be distributed and/or modified under the conditions of
the LaTeX Project Public License, either version 1.2 of this license
diff --git a/Master/texmf-dist/tex/latex/keyvaltable/keyvaltable.sty b/Master/texmf-dist/tex/latex/keyvaltable/keyvaltable.sty
index 1e640fbc777..dce3cbb8973 100644
--- a/Master/texmf-dist/tex/latex/keyvaltable/keyvaltable.sty
+++ b/Master/texmf-dist/tex/latex/keyvaltable/keyvaltable.sty
@@ -6,7 +6,7 @@
%%
%% keyvaltable.dtx (with options: `package')
%%
-%% Copyright (C) 2016 by Richard Gay <gay@mais.informatik.tu-darmstadt.de>
+%% Copyright (C) 2016-2018 by Richard Grewe <r-g+tex@posteo.net>
%%
%% This file may be distributed and/or modified under the conditions of
%% the LaTeX Project Public License, either version 1.2 of this license
@@ -20,7 +20,7 @@
%%
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{keyvaltable}
- [2016/05/22 v0.2 Package for filling tables using key-value lists]
+ [2018/11/01 v0.3b Package for filling tables using key-value lists]
\RequirePackage{etoolbox}
\RequirePackage{xkeyval}
\RequirePackage[table]{xcolor}
@@ -46,6 +46,13 @@
\define@choicekey[kvt]{Table}{#1}{#3}%
{\csdef{cmdkvt@Table@#1}{##1}}%
\presetkeys[kvt]{Table}{#1=#2}{}}
+\newcommand\kvt@addbooltableprop[2]{%
+ \define@boolkey[kvt]{defaults}{#1}{%
+ \kvt@lazypreset{Table}{#1=##1}}%
+ \presetkeys[kvt]{defaults}{#1=#2}{}%
+ \define@boolkey[kvt]{Table}{#1}%
+ {\csdef{cmdkvt@Table@#1}{##1}}%
+ \presetkeys[kvt]{Table}{#1=#2}{}}
\newcommand\kvt@addcolumnprop[2]{%
\define@key[kvt]{defaults}{#1}{%
\kvt@lazypreset{Column}{#1=##1}}%
@@ -64,6 +71,7 @@
}
\kvt@addtableprop{rowbg}{white..black!10}
\kvt@addtableprop{headbg}{black!14}
+\kvt@addbooltableprop{showhead}{true}
\kvt@addchoicetableprop{shape}{multipage}{multipage,onepage}
\kvt@addcolumnprop{default}{}
\kvt@addcolumnprop{format}{\kvt@struttedcell}
@@ -71,7 +79,7 @@
\kvt@addcolumnprop{head}{}
\kvt@addchoicecolumnprop{hidden}{false}{false,true}
\kvtSet{}
-\newcommand\kvt@struttedcell[1]{\strut #1\strut}
+\newcommand\kvt@struttedcell[1]{\strut #1\ifhmode\expandafter\strut\fi}
\newcommand\NewKeyValTable[3][]{%
\csdef{kvt@options@#2}{#1}%
\csdef{kvt@headings@#2}{}%
@@ -103,11 +111,14 @@
\newcounter{kvtTypeRow}
\newcounter{kvtTotalRow}
\setcounter{kvtTotalRow}{1}
-\newcommand\kvtLabel[2]{%
- \protected@edef\@currentlabel
- {\csname p@#1\endcsname\csname the#1\endcsname}%
- \ifstrempty{#2}{}{\label{#2}}%
- \csuse{the#1}}
+\newcommand\kvtLabel[3][]{%
+ \setcounter{kvt@LabelCtr}{\csname the#2\endcsname}%
+ \addtocounter{kvt@LabelCtr}{-1}%
+ \refstepcounter{kvt@LabelCtr}%
+ \ifstrempty{#3}{}{%
+ \ifstrempty{#1}{\label{#3}}{\label[#1]{#3}}}%
+ \csuse{the#2}}
+\newcounter{kvt@LabelCtr}
\newenvironment{KeyValTable}[2][]{%
\bgroup%
\def\Row##1{\kvt@AddKeyValRow{#2}{##1}\kvt@@row\\}%
@@ -130,12 +141,13 @@
\newcommand\kvt@StartTabu[2]{%
\gdef\kvt@@recenttable{#2}%
\bgroup\edef\kvt@@do{\egroup
- \noexpand\taburowcolors[2] 2{\cmdkvt@Table@rowbg}%
\noexpand\begin{#1}{\csuse{kvt@alignments@#2}}%
\noexpand\toprule
- \noexpand\rowcolor{\cmdkvt@Table@headbg}%
+ \ifbool{kvt@Table@showhead}{%
+ \noexpand\rowcolor{\cmdkvt@Table@headbg}%
+ \unexpanded{\csuse{kvt@headings@#2}\\\midrule}}{}%
+ \noexpand\taburowcolors 2{\cmdkvt@Table@rowbg}%
}\kvt@@do%
- \csuse{kvt@headings@#2}\\\midrule
\iftabu@long\expandafter\endhead\fi
\setcounter{kvtRow}{1}%
\setcounter{kvtTypeRow}{\csuse{kvt@rowcount@#2}}%