From 5233802c550f0cc1a8fb76ed9399eb1ce51e9600 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 23 Aug 2009 23:35:17 +0000 Subject: new package threeparttablex 0.03 (23aug09) git-svn-id: svn://tug.org/texlive/trunk@14832 c570f23f-e606-0410-a88d-b1316a301751 --- .../tex/latex/threeparttablex/threeparttablex.sty | 103 +++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 Master/texmf-dist/tex/latex/threeparttablex/threeparttablex.sty (limited to 'Master/texmf-dist/tex/latex') diff --git a/Master/texmf-dist/tex/latex/threeparttablex/threeparttablex.sty b/Master/texmf-dist/tex/latex/threeparttablex/threeparttablex.sty new file mode 100644 index 00000000000..277e3a18e10 --- /dev/null +++ b/Master/texmf-dist/tex/latex/threeparttablex/threeparttablex.sty @@ -0,0 +1,103 @@ +\ProvidesPackage{threeparttablex}[2009/08/23 v0.04 by daleif] + +%% +%% This package can be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3 +%% 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 +%% version 2003/12/01 or later. +%% +%% This work has the LPPL maintenance status "maintained". +%% +%% The Current Maintainer of this work is Lars Madsen (daleif@imf.au.dk). +%% + + +\newif\ifTPTL@referable +\DeclareOption{referable}{\TPTL@referabletrue} +\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{threeparttable}} + +\ProcessOptions\relax + +\RequirePackage{threeparttable} +\RequirePackage{environ} + + +\newcommand\TPTL@font{} +\newcommand\setTableNoteFont[1]{\renewcommand\TPTL@font{#1}} + +% length to store the longtable width in +\newlength\TPTL@width +% macro to store the optional argument for tablenotes +\def\TPTL@optarg{} +% wrapper env used to collect the tablenotes for later use +\newenvironment{TableNotes}[1][]{ + \gdef\TPTL@optarg{#1}% + \Collect@Body\TPTL@collector}{} +\newcommand\TPTL@collector[1]{% + \long\gdef\TPTL@body{#1}} +% the macro used to store the tablenotes contents +\gdef\TPTL@body{} +\newcommand\insertTableNotes{% + % first we need to know the width of the longtable, remember that it + % will only settle after a few compilations + \noalign{\begingroup + \setlength\TPTL@width{0pt} + \renewcommand\LT@entry[2]{\global\advance\TPTL@width by ##2} + \@nameuse{LT@\roman{LT@tables}} + \ifdim\TPTL@width<\TPTminimum\relax\global\TPTL@width=\TPTminimum\fi + \endgroup} + % then add the table notes inside a \parbox of the required width + \multicolumn{\LT@cols}{c}{% + \makebox[0pt][c]{\parbox{\TPTL@width}{% + \begin{tablenotes}[\TPTL@optarg]% + \TPTL@font% + \TPTL@body + \end{tablenotes} + }}}} + +% the alternative threeparttable env, it only enables \TPToverlap +\newenvironment{ThreePartTable}{\let\TPToverlap\TPTrlap}{} + + + +\ifTPTL@referable\else\endinput\fi + +% we only come here if we need to make tablenotes referable + + +% define an extra \tnote command that table a label instead of a string +\newcommand\tnotex{\@ifstar{\TPTL@tnotex{01}}{\TPTL@tnotex{00}}} + +\newcommand\TPTL@tnotex[2]{\tnote{\ref{#2}}} + +% if hyperref is loaded we activat a starred version +\AtBeginDocument{% + \@ifpackageloaded{hyperref}{% + \renewcommand\TPTL@tnotex[2]{% + \if#1\relax% + \tnote{\ref{#2}}% + \else% + \tnote{\ref*{#2}} + \fi}}{}} + +\let\TPTL@tablenotes=\tablenotes + +% \makelabel (i.e. \item) hides its argument inside a group, making it +% difficult to set \@currentlabel, so we locally overload \item to get +% the argument and set \@currentlabel AFTER \item[...] +\renewcommand\tablenotes{% + \let\TPTL@item=\item + \renewcommand\item[1][]{\TPTL@item[##1]% + \phantomsection\protected@edef\@currentlabel{##1}} + \TPTL@font\TPTL@tablenotes} + +% just in case it is not already there +\providecommand\phantomsection{} + + +\endinput + +The End -- cgit v1.2.3