diff options
author | Karl Berry <karl@freefriends.org> | 2012-01-27 00:06:07 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2012-01-27 00:06:07 +0000 |
commit | 8f4cafb6e83086f58a5a3d3a10a3d5352d703033 (patch) | |
tree | e5ddc602f6cb6ea4333fc4ff99a0b27d7d9df8f1 /Master/texmf-dist/tex/latex/tabfigures/tabfigures.sty | |
parent | 17fb5726fcee9d249b63b0553ea585ab6f5d1b48 (diff) |
tabfigures (25jan12)
git-svn-id: svn://tug.org/texlive/trunk@25202 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/tabfigures/tabfigures.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/tabfigures/tabfigures.sty | 159 |
1 files changed, 95 insertions, 64 deletions
diff --git a/Master/texmf-dist/tex/latex/tabfigures/tabfigures.sty b/Master/texmf-dist/tex/latex/tabfigures/tabfigures.sty index 7e72abe4d67..8cea7056a4a 100644 --- a/Master/texmf-dist/tex/latex/tabfigures/tabfigures.sty +++ b/Master/texmf-dist/tex/latex/tabfigures/tabfigures.sty @@ -7,7 +7,7 @@ %% tabfigures.dtx (with options: `package') %% %% Copyright (c) 2007 by Andreas Buehmann -%% Copyright (c) 2011 by Michael Ummels <michael.ummels@rwth-aachen.de> +%% Copyright (c) 2012 by Michael Ummels <michael.ummels@rwth-aachen.de> %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either version 1.3c @@ -25,106 +25,137 @@ %% the derived files tabfigures.sty and tabfigures.pdf. %% \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{tabfigures}[2011/09/17 v1.0 Patches for using tabular figures] -\newcommand*\tabfig@@[1]{tabfig@@\expandafter\@cdr\string #1\@nil} -\newcommand*\tabfig@[1]{\csname \tabfig@@{#1}\endcsname} -\newcommand*\tabfig@name{} -\newcommand*\tabfig@save[1]{% - \edef\tabfig@name{\expandafter\expandafter\expandafter - \noexpand\tabfig@{#1}}% - \expandafter\newcommand\tabfig@name{}% - \expandafter\let\tabfig@name #1% -} -\newcommand*\tabfig@def[1]{% - \tabfig@save{#1}% - \def#1% -} -\newcommand*\tabfig@pname{} -\newcommand*\tabfig@patch@l[1]{% - \@ifundefined{l@#1}{}{% - \edef\tabfig@pname{\expandafter\noexpand\csname l@#1\endcsname}% - \expandafter\tabfig@save\tabfig@pname - \expandafter\edef\tabfig@pname##1##2{% - \noexpand\tabfig@ - \expandafter\noexpand\tabfig@pname - {##1}{\noexpand\tabfig@font ##2}% - }% - }% -} -\newif\iftabfig@debug \tabfig@debugfalse +\ProvidesPackage{tabfigures}[2012/01/24 v1.1 Patches for using tabular figures] +\RequirePackage{etoolbox} +\newcommand*\tabfig@warning[1]{% + \PackageWarningNoLine{tabfigures}{Command \string#1 could not be patched}} +\newif\iftabfig@debug\tabfig@debugfalse \DeclareOption{debug}{\tabfig@debugtrue} \DeclareOption{eqno}{% \AtBeginDocument{% \@ifpackageloaded{amsmath}{% - \tabfig@def\maketag@@@#1{\tabfig@\maketag@@@{\tabfig@font #1}}% + \let\tabfig@maketag@@@\maketag@@@ + \def\maketag@@@#1{\tabfig@maketag@@@{\tabfig@ttbf{#1}}}% }{% - \CheckCommand*\@eqnnum{{\normalfont \normalcolor (\theequation)}}% - \def\@eqnnum{{\normalfont \tabfig@font \normalcolor (\theequation)}}% + \expandafter\def\expandafter\tabfig@eqnnum\@eqnnum + \patchcmd{\tabfig@eqnnum}% + {\theequation}{\tabfig@ttbf{\theequation}}% + {\def\@eqnnum{{\tabfig@eqnnum}}}% + {\tabfig@warning{\@eqnnum}}% }% }% } \DeclareOption{toc}{% \AtBeginDocument{% - \tabfig@def\@dottedtocline#1#2#3#4#5{% - \tabfig@\@dottedtocline{#1}{#2}{#3}{#4}{\tabfig@font #5}% + \let\tabfig@@dottedtocline\@dottedtocline + \def\@dottedtocline#1#2#3#4#5{% + \tabfig@@dottedtocline{#1}{#2}{#3}{#4}{\tabfig@ttbf{#5}}% }% - \tabfig@def\numberline#1{% - \tabfig@\numberline{\tabfig@font #1}% - }% - \tabfig@patch@l{part}% - \tabfig@patch@l{chapter}% - \tabfig@patch@l{section}% - \tabfig@patch@l{subsection}% - \tabfig@patch@l{subsubsection}% - \tabfig@patch@l{paragraph}% - \tabfig@patch@l{subparagraph}% - \tabfig@patch@l{figure}% - \tabfig@patch@l{table}% + \let\tabfig@numberline\numberline + \def\numberline#1{\tabfig@numberline{\tabfig@ttbf{#1}}}% + \let\tabfig@l@part\l@part + \def\l@part#1#2{\tabfig@l@part{#1}{\tabfig@ttbf{#2}}} + \let\tabfig@l@chapter\l@chapter + \def\l@chapter#1#2{\tabfig@l@chapter{#1}{\tabfig@ttbf{#2}}} + \let\tabfig@l@section\l@section + \def\l@section#1#2{\tabfig@l@section{#1}{\tabfig@ttbf{#2}}} + \let\tabfig@l@subsection\l@subsection + \def\l@subsection#1#2{\tabfig@l@subsection{#1}{\tabfig@ttbf{#2}}} + \let\tabfig@l@subsubsection\l@subsubsection + \def\l@subsubsection#1#2{\tabfig@l@subsubsection{#1}{\tabfig@ttbf{#2}}} + \let\tabfig@l@paragraph\l@paragraph + \def\l@paragraph#1#2{\tabfig@l@paragraph{#1}{\tabfig@ttbf{#2}}} + \let\tabfig@l@subparagraph\l@subparagraph + \def\l@subparagraph#1#2{\tabfig@l@subparagraph{#1}{\tabfig@ttbf{#2}}} + \let\tabfig@l@figure\l@figure + \def\l@figure#1#2{\tabfig@l@figure{#1}{\tabfig@ttbf{#2}}} + \let\tabfig@l@table\l@table + \def\l@table#1#2{\tabfig@l@table{#1}{\tabfig@ttbf{#2}}} \@ifclassloaded{memoir}{% - \tabfig@def\cftchapterpresnum{\tabfig@font \tabfig@\cftchapterpresnum}% - \tabfig@def\cftpartpresnum{\tabfig@font \tabfig@\cftpartpresnum}% + \apptocmd{\cftpartpresnum}% + {\tabfig@tbf}{}{\tabfig@warning{\cftpartpresnum}}% + \apptocmd{\cftchapterpresnum}% + {\tabfig@tbf}{}{\tabfig@warning{\cftchapterpresnum}}% }{}% }% } \DeclareOption{enum}{% \AtBeginDocument{% - \tabfig@def\labelenumi{\tabfig@font \tabfig@\labelenumi}% - \tabfig@def\labelenumii{\tabfig@font \tabfig@\labelenumii}% - \tabfig@def\labelenumiii{\tabfig@font \tabfig@\labelenumiii}% - \tabfig@def\labelenumiv{\tabfig@font \tabfig@\labelenumiv}% + \patchcmd{\labelenumi}% + {\theenumi}{\tabfig@ttbf{\theenumi}}% + {}{\tabfig@warning{\labelenumi}}% + \patchcmd{\labelenumii}% + {\theenumii}{\tabfig@ttbf{\theenumii}}% + {}{\tabfig@warning{\labelenumii}}% + \patchcmd{\labelenumiii}% + {\theenumiii}{\tabfig@ttbf{\theenumiii}}% + {}{\tabfig@warning{\labelenumiii}}% + \patchcmd{\labelenumiv}% + {\theenumiv}{\tabfig@ttbf{\theenumiv}}% + {}{\tabfig@warning{\labelenumiv}}% }% } \DeclareOption{bib}{% \AtBeginDocument{% - \tabfig@def\@biblabel{\tabfig@font \tabfig@\@biblabel}% + \let\tabfig@@biblabel\@biblabel + \def\@biblabel#1{\tabfig@@biblabel{\tabfig@ttbf{#1}}}% \@ifpackageloaded{biblatex}{% - \DeclareFieldFormat{labelnumberwidth}{\mkbibbrackets{\tabfig@font #1}}% - \DeclareFieldFormat{labelalphawidth}{\mkbibbrackets{\tabfig@font #1}}% + \DeclareFieldFormat{labelnumberwidth}{\mkbibbrackets{\tabfig@ttbf{#1}}}% + \DeclareFieldFormat{labelalphawidth}{\mkbibbrackets{\tabfig@ttbf{#1}}}% }{}% }% } \DeclareOption{lineno}{% \AtBeginDocument{% - \@ifpackageloaded{doc}{% - \CheckCommand*\theCodelineNo{% - \reset@font\scriptsize\arabic{CodelineNo}}% - \def\theCodelineNo{% - \reset@font\tabfig@font\scriptsize\arabic{CodelineNo}}% + \@ifpackageloaded{hypdoc}{% + \ifpatchable{\theCodelineNo}{\HDorg@theCodelineNo}{% + \patchcmd{\HDorg@theCodelineNo}% + {\arabic{CodelineNo}}% + {\tabfig@ttbf{\arabic{CodelineNo}}}% + {}{\tabfig@warning{\HDorg@theCodelineNo}}% + }{% + \patchcmd{\theCodelineNo}% + {\arabic{CodelineNo}}% + {\tabfig@ttbf{\arabic{CodelineNo}}}% + {}{\tabfig@warning{\theCodelineNo}}% + }% + }{% + \@ifpackageloaded{doc}{% + \patchcmd{\theCodelineNo}% + {\arabic{CodelineNo}}% + {\tabfig@ttbf{\arabic{CodelineNo}}}% + {}{\tabfig@warning{\theCodelineNo}}% + }{}% + }% + \@ifpackageloaded{listings}{% + \apptocmd{\lst@numberstyle}{\tabfig@tbf}% + {}{\tabfig@warning{\lst@numberstyle}}% }{}% + \@ifpackageloaded{fancyvrb}{% + \patchcmd{\theFancyVerbLine}% + {\arabic{FancyVerbLine}}% + {\tabfig@ttbf{\arabic{FancyVerbLine}}}% + {}{\tabfig@warning{\theFancyVerbLine}}% + }{} }% } \ProcessOptions\relax -\newcommand*\tabfig@font{\tbfigures} +\newcommand*\tabfig@tbf{\tbfigures} +\DeclareTextFontCommand{\tabfig@ttbf}{\tabfig@tbf} \iftabfig@debug \RequirePackage{xcolor}% \colorlet{tabfig@debug}{green!50!black}% - \renewcommand\tabfig@font{\tbfigures\color{tabfig@debug}}% + \renewcommand\tabfig@tbf{\tbfigures\color{tabfig@debug}}% \fi \AtBeginDocument{% \@ifundefined{tbfigures}{% - \PackageWarning{tabfigures}{There is no command - \string\tbfigures\space to support tabular figures}% - \let\tabfig@font\@empty + \@ifpackageloaded{fontspec}{% + \def\tbfigures{\addfontfeatures{Numbers=Monospaced}}% + }{% + \PackageWarningNoLine{tabfigures}{There is no command + \string\tbfigures\space to support tabular figures}% + \let\tabfig@tbf\@empty + }% }{}% } %% |