diff options
author | Karl Berry <karl@freefriends.org> | 2018-11-03 21:07:14 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2018-11-03 21:07:14 +0000 |
commit | f42bae9a52bba6f3c8bf222555340eefc9ebd981 (patch) | |
tree | 15e91953e2bd27ba2beca9eb7282071c41335b02 /Master/texmf-dist/tex/latex/keyvaltable | |
parent | 352e3dbcfd1c78ac07708000abf8839d4002393b (diff) |
keyvaltable (3nov18)
git-svn-id: svn://tug.org/texlive/trunk@49063 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/keyvaltable')
-rw-r--r-- | Master/texmf-dist/tex/latex/keyvaltable/keyvaltable.sty | 34 |
1 files changed, 23 insertions, 11 deletions
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}}% |