diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/datatool/datagidx.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/datatool/datagidx.sty | 120 |
1 files changed, 95 insertions, 25 deletions
diff --git a/Master/texmf-dist/tex/latex/datatool/datagidx.sty b/Master/texmf-dist/tex/latex/datatool/datagidx.sty index 8818f59428e..6c61620a65e 100644 --- a/Master/texmf-dist/tex/latex/datatool/datagidx.sty +++ b/Master/texmf-dist/tex/latex/datatool/datagidx.sty @@ -7,11 +7,11 @@ %% datatool.dtx (with options: `datagidx.sty,package') %% %% datatool.dtx -%% Copyright 2016 Nicola Talbot +%% Copyright 2017 Nicola Talbot %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either version 1.3 -%% of this license of (at your option) any later version. +%% of this license or (at your option) any later version. %% The latest version of this license is in %% http://www.latex-project.org/lppl.txt %% and version 1.3 or later is part of all distributions of LaTeX @@ -39,7 +39,7 @@ %% Grave accent \` Left brace \{ Vertical bar \| %% Right brace \} Tilde \~} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{datagidx}[2016/07/28 v2.27 (NLCT)] +\ProvidesPackage{datagidx}[2017/11/10 v2.28 (NLCT)] \RequirePackage{datatool} \RequirePackage{etoolbox} \RequirePackage{xkeyval} @@ -406,6 +406,9 @@ \@datagidx@warntrue \fi } +\define@choicekey{datatool.sty}{utf8}{true,false}[true]{% + \setbool{@dtl@utf8}{#1}% +} \define@key{datagidx.sty}{columns}% {% \DTLgidxSetColumns{#1}% @@ -1906,11 +1909,15 @@ \define@key{newgloss}{postheading}{% \renewcommand*{\datagidx@postheading}{#1}% } +\newif\ifdatagidxbalance +\datagidxbalancetrue \define@choicekey{newgloss}{balance}[\val\nr]{true,false}[true]{% \ifcase\nr\relax \renewcommand*{\datagidx@multicols}{multicols}% + \datagidxbalancetrue \or \renewcommand*{\datagidx@multicols}{multicols*}% + \datagidxbalancefalse \fi } \define@key{newgloss}{sort}{\renewcommand*{\datagidx@sort}{#1}} @@ -2180,19 +2187,51 @@ \def\Psi{Psi}% \def\Omega{Omega}% } +\newcommand{\datagidxextendedtoascii}{% + \def\AE{AE}% + \def\ae{ae}% + \def\OE{OE}% + \def\oe{oe}% + \def\AA{AA}% + \def\aa{aa}% + \def\L{L}% + \def\l{l}% + \def\O{O}% + \def\o{o}% + \def\SS{SS}% + \def\ss{ss}% + \def\th{th}% + \def\TH{TH}% + \def\dh{dh}% + \def\DH{DH}% +} +\newcommand*{\datagidxconvertchars}{% + \let~\space + \ifdef\andname + {% + \let\&\andname + }% + {% + \def\&{\expandafter\@gobble\string\&}% + }% + \def\_{\string_}% + \def\${\string$}% + \def\#{\expandafter\@gobble\string\#}% + \def\%{\expandafter\@gobble\string\%}% + \def\{{\expandafter\@gobble\string\{}% + \def\}{\expandafter\@gobble\string\}}% +} \newcommand*{\datagidxstripaccents}{% + \let\add@accent@\@secondoftwo + \let\@text@composite@x\@secondoftwo + \let\@tabacckludge\@secondoftwo \expandafter\def\csname \encodingdefault-cmd\endcsname##1##2##3{##3}% \expandafter\def\csname OT1-cmd\endcsname##1##2##3{##3}% \expandafter\def\csname T1-cmd\endcsname##1##2##3{##3}% \expandafter\def\csname PD1-cmd\endcsname##1##2##3{##3}% \def\IeC##1{\@gobbletwo##1}% } -\ifdef\newterm -{% -}% -{% - \newcommand{\newterm}{\datagidx@newterm} -} +\providecommand{\newterm}{\datagidx@newterm} \@onlypreamble\newterm \newcommand{\datagidx@setfieldvalues}[2]{% \def\newterm@name{#2}% @@ -2232,14 +2271,7 @@ \let\textsl\DTLgidxNoFormat \let\emph\DTLgidxNoFormat \let\textsuperscript\DTLgidxNoFormat - \let~\space - \ifdef\andname - {% - \let\&\andname - }% - {% - \def\&{and}% - }% + \datagidxconvertchars \let\ensuremath\DTLgidxNoFormat \let\DTLgidxParen\@gobble \let\DTLgidxName\@secondoftwo @@ -2249,6 +2281,7 @@ \let\DTLgidxParticle\datagidx@bothoftwo \datagidxwordifygreek \datagidxstripaccents + \datagidxextendedtoascii \newtermlabelhook \protected@xdef\newterm@label{\newterm@label}% \let\DTLgidxName\datagidx@person @@ -3013,6 +3046,37 @@ } \newcommand*{\printterms@condition}{\boolean{true}} \define@key{printterms}{condition}{\renewcommand*{\printterms@condition}{#1}} +\newcommand{\printtermsstartpar}{\par} +\newcommand*{\printterms@setupmulticol}{% + \ifdefempty\datagidx@postheading + {% + \edef\datagidx@prestart{% + \noexpand\datagidx@heading{\noexpand\datagidx@title}% + \noexpand\begin{\datagidx@multicols}{\datagidx@columns}% + }% + }% + {% + \edef\datagidx@prestart{% + \noexpand\datagidx@heading{\noexpand\datagidx@title}% + \noexpand\begin{\datagidx@multicols}{\datagidx@columns}% + [\noexpand\datagidx@postheading]% + }% + }% + \edef\datagidx@postend{% + \noexpand\end{\datagidx@multicols}% + }% +} +\newcommand*{\printterms@setuptwocol}{% + \def\datagidx@prestart{% + \twocolumn[\datagidx@heading{\datagidx@title}% + \datagidx@postheading]}% + \if@twocolumn + \def\datagidx@postend{}% + \else + \def\datagidx@postend{\printtermsrestoreonecolumn}% + \fi +} +\newcommand{\printtermsrestoreonecolumn}{\onecolumn} \newcommand{\printterms}[1][]{% \bgroup \let\newterm@database\datagidx@defaultdatabase @@ -3051,12 +3115,15 @@ \edef\dtl@do@setkeys{\noexpand\setkeys{newgloss}{\expandonce\newterm@styles}}% \dtl@do@setkeys \ifnum\datagidx@columns>1\relax - \edef\datagidx@prestart{% - \noexpand\begin{\datagidx@multicols}{\datagidx@columns}% - }% - \edef\datagidx@postend{% - \noexpand\end{\datagidx@multicols}% - }% + \ifnum\datagidx@columns=2\relax + \ifdatagidxbalance + \printterms@setupmulticol + \else + \printterms@setuptwocol + \fi + \else + \printterms@setupmulticol + \fi \else \def\datagidx@prestart{}% \def\datagidx@postend{}% @@ -3065,10 +3132,13 @@ \csuse{datagidxshowgroups\datagidx@showgroups}% \datagidxsetstyle{\datagidx@style}% \def\datagidx@labellist{}% - \datagidx@heading{\datagidx@title}% - \datagidx@postheading + \ifnum\datagidx@columns=1\relax + \datagidx@heading{\datagidx@title}% + \datagidx@postheading + \fi \datagidx@do@sort \datagidx@prestart + \printtermsstartpar \datagidxstart \let\DTLgidxName\datagidx@invert \let\DTLgidxPlace\datagidx@invert |