diff options
author | Karl Berry <karl@freefriends.org> | 2009-08-23 23:35:17 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2009-08-23 23:35:17 +0000 |
commit | 5233802c550f0cc1a8fb76ed9399eb1ce51e9600 (patch) | |
tree | 30e3db8e0a5d05e173fc78a278be7eb08a690eb4 | |
parent | cd80a5bcb9cc333e0a1a3f93f259fbd185d262bb (diff) |
new package threeparttablex 0.03 (23aug09)
git-svn-id: svn://tug.org/texlive/trunk@14832 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/texmf-dist/doc/latex/threeparttablex/README | 31 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/threeparttablex/threeparttablex.pdf | bin | 0 -> 54498 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/threeparttablex/threeparttablex.tex | 232 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/threeparttablex/threeparttablex.sty | 103 | ||||
-rwxr-xr-x | Master/tlpkg/bin/tlpkg-ctan-check | 3 | ||||
-rw-r--r-- | Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc | 1 | ||||
-rw-r--r-- | Master/tlpkg/tlpsrc/threeparttablex.tlpsrc | 0 |
7 files changed, 369 insertions, 1 deletions
diff --git a/Master/texmf-dist/doc/latex/threeparttablex/README b/Master/texmf-dist/doc/latex/threeparttablex/README new file mode 100644 index 00000000000..81b0a0b07d5 --- /dev/null +++ b/Master/texmf-dist/doc/latex/threeparttablex/README @@ -0,0 +1,31 @@ +% (C) Lars Madsen, daleif@imf.au.dk, 2009/08/23 +% This material is subject to the LaTeX Project Public License. +% See http://www.ctan.org/tex-archive/help/Catalogue/licenses.lppl.html +% for the details of that license. + +This small package brings tablenotes to longtable, though using a +slightly different syntax. + +By default it does not change anything in theeparttable. + +If asked for (using the referable package option), we change some +threeparttable internals such that table notes are referable, i.e. + +\item[a] \label{tn:a} some text + +then \ref{tn:a} gives you an 'a' (without any formatting). Instead of +manually keeping track of all the \tnote arguments in the table you +can now do \tnotex{tn:a} to get \tnote{\ref{tn:a}}. + +For information on how to use threeparttable with longtable see the manual. + +* v0.04 + Added \setTableNoteFont + +* v0.03 + First public release. + + + + +/daleif diff --git a/Master/texmf-dist/doc/latex/threeparttablex/threeparttablex.pdf b/Master/texmf-dist/doc/latex/threeparttablex/threeparttablex.pdf Binary files differnew file mode 100644 index 00000000000..a4a79067133 --- /dev/null +++ b/Master/texmf-dist/doc/latex/threeparttablex/threeparttablex.pdf diff --git a/Master/texmf-dist/doc/latex/threeparttablex/threeparttablex.tex b/Master/texmf-dist/doc/latex/threeparttablex/threeparttablex.tex new file mode 100644 index 00000000000..1d7a713b652 --- /dev/null +++ b/Master/texmf-dist/doc/latex/threeparttablex/threeparttablex.tex @@ -0,0 +1,232 @@ +\documentclass[a4paper,article]{memoir} +\usepackage[T1]{fontenc} +%\usepackage[garamond]{mathdesign} + +\usepackage{bera} + +\setsecnumdepth{part} +\pagestyle{plain} + +\usepackage{xspace,listings,xcolor} +\newcommand\pkg{\jobname\xspace} + +\newcommand\tpt{threeparttable\xspace} + +\definecolor{felinesrcbgcolor}{rgb}{1,1,0.85} +\definecolor{austdblue}{cmyk}{1,0.8,0,0.15} +\definecolor{nicered}{rgb}{.647,.129,.149} +\lstset{ + basicstyle=\ttfamily\footnotesize, + columns=fixed, + backgroundcolor=\color{felinesrcbgcolor}, + frame=single, + extendedchars=true, + framexleftmargin=3pt, + numbers=none, + numberstyle=\tiny\ttfamily, + escapeinside={X}{X}, +} + +\usepackage[referable]{threeparttablex} +\usepackage{longtable} + +\usepackage{hyperref} + +\begin{document} + +\title{A small extension to threeparttable \\ -- or bringing + threeparttable to longtable} + +\author{Lars Madsen\thanks{Email: daleif@imf.au.dk}} + +\maketitle + +\section{Introduction} +\label{sec:introduction} + +Because of the measuring nature of the original \tpt +environment, one cannot use it in combination with the longtable +environment. This package makes up for this and brings \tpt +to longtable, at the small cost of having to do things a little +different when adding table notes to longtable. + +If asked for it, the pacakge will also enable the user to label and +refer to table notes. + + +\section{Prerequisites} +\label{sec:prerequisites} + +The \pkg package requires the \tpt and environ packages to +be available on your system. + +\section{Basic usage} +\label{sec:basic-usage} + +The interface for the regular \tpt system has not changed. We add the +following: +\begin{description} +\item[ThreePartTable] a very simple wrapper environment that should + wrap around the entire longtable. (It actually does nothing else but + enable the \cs{tnote} command). +\item[TableNotes] an environment taking the same options as the normal + table\-notes environment, write the table notes in this environment. + It needs to be placed \emph{before} the longtable. It \emph{cannot} + be added inside longtable. +\item[\cs{insertTableNotes}] use this macro to insert the table notes + inside the longtable. It is inserted via a special + \cs{multicolumn}. If you add stuff after the table notes, e.g.\ a + caption, you should remember to use \verb+\insertTableNotes\\+. +\end{description} + +\noindent A longtable example could look like this: +\begin{lstlisting} +\begin{ThreePartTable} + \begin{TableNotes} + \item[a] A note + \item[b] Another note + \end{TableNotes} + \begin{longtable}{l l} + \toprule + Column 1 & Column 2 \\ + \midrule + \endhead + \cmidrule{2-2} + \multicolumn{2}{r}{\textit{continued}} + \endfoot + \bottomrule + \insertTableNotes + \endlastfoot + + % the contents of the table + A & B\tnote{a} \\ + C\tnote{b} & D \\ + \end{longtable} +\end{ThreePartTable} +\end{lstlisting} + + +\section{Extending \tpt} +\label{sec:extending-tpt} + +One thing missing in \tpt is the ability to refer to +individual table notes. And even let \cs{tnote} pickup the note +marker via a label (reducing the error-40 factor). + +By using the package option >>\texttt{referable}<< we will change a +few \tpt internals such that +\begin{enumerate}[(a)] +\item The manually specified note markers issued by \verb+\item[...]+ + is referable, and +\item \cs{tnotex}\marg{label} will refer to the table note identified + by \meta{label}. (We do not want to change \cs{tnote}). In case you + are using hyperref, there is also a \cs{tnotex*} that does not make + the tnote into a hyperlink. +\item \cs{setTableNoteFont}\marg{font commands} can be used to set the + font inside tables notes. (default is empty) +\end{enumerate} + +\section{Example} +\label{sec:example} + +\begin{lstlisting} +\begin{ThreePartTable} + \begin{TableNotes} + \item[a] \label{tn:a} test test test test test test test test + \item[b] \label{tn:b} test2 + \end{TableNotes} + +\begin{longtable}{l l l} + \caption{A long table}\\ + \toprule + Coloum 1 & & Column 2 \\ + \midrule + \endhead + \cmidrule{3-3} + \multicolumn{3}{r}{\textit{continued}} + \endfoot + \bottomrule + \insertTableNotes\\ + \endlastfoot + AAAA\tnotex{tn:a} & XXXXXXXX & BBBB \\ +% \newpage + CC & & DD\tnotex{tn:b} \\ +\end{longtable} +\end{ThreePartTable} + + +\begin{center} + \begin{threeparttable} + \caption{A regular tabular} + \begin{tabular}{l l l} + \toprule + Coloum 1 & & Column 2 \\ + \midrule + AAAA\tnote{c} & XXXXXXXX & BBBB \\ + CC & & DD\tnotex*{tn:c} \\ + \bottomrule + \end{tabular} + \begin{tablenotes} + \footnotesize + \item[c] test test test test test test test test + \item[d] \label{tn:c} the reference to this is not a link + \end{tablenotes} + \end{threeparttable} +\end{center} +\end{lstlisting} + +\noindent Resulting in: + +\begin{ThreePartTable} + \begin{TableNotes} + \item[a] \label{tn:a} test test test test test test test test + \item[b] \label{tn:b} test2 + \end{TableNotes} + +\begin{longtable}{l l l} + \caption{A long table}\\ + \toprule + Coloum 1 & & Column 2 \\ + \midrule + \endhead + \cmidrule{3-3} + \multicolumn{3}{r}{\textit{continued}} + \endfoot + \bottomrule + \insertTableNotes\\ + \endlastfoot + AAAA\tnotex{tn:a} & XXXXXXXX & BBBB \\ +% \newpage + CC & & DD\tnotex{tn:b} \\ +\end{longtable} +\end{ThreePartTable} + + +\begin{center} + \begin{threeparttable} + \caption{A regular tabular} + \begin{tabular}{l l l} + \toprule + Coloum 1 & & Column 2 \\ + \midrule + AAAA\tnote{c} & XXXXXXXX & BBBB \\ + CC & & DD\tnotex*{tn:c} \\ + \bottomrule + \end{tabular} + \begin{tablenotes} + \footnotesize + \item[c] test test test test test test test test + \item[d] \label{tn:c} the reference to this is not a link + \end{tablenotes} + \end{threeparttable} +\end{center} + + + + +\end{document} + +%%% Local Variables: +%%% mode: latex +%%% TeX-master: t +%%% End: 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 diff --git a/Master/tlpkg/bin/tlpkg-ctan-check b/Master/tlpkg/bin/tlpkg-ctan-check index baf6b45eeb1..42d2ce7fd8d 100755 --- a/Master/tlpkg/bin/tlpkg-ctan-check +++ b/Master/tlpkg/bin/tlpkg-ctan-check @@ -243,7 +243,8 @@ my @WorkingTLP = qw( texpower texshade textcase textfit textopo textpath textpos theoremref thesis-titlepage-fhac - thinsp thmbox thmtools thumb thumbpdf thuthesis ticket tikz-inet + thinsp thmbox thmtools threeparttablex + thumb thumbpdf thuthesis ticket tikz-inet tikz-timing timetable tipa titlefoot titlepages titlepic titlesec titling tkz-doc tkz-linknodes tkz-tab diff --git a/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc b/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc index 8640b1bb467..ea6848023c4 100644 --- a/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc +++ b/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc @@ -545,6 +545,7 @@ depend textfit depend textmerg depend textpos depend theoremref +depend threeparttablex depend thinsp depend thmtools depend thumb diff --git a/Master/tlpkg/tlpsrc/threeparttablex.tlpsrc b/Master/tlpkg/tlpsrc/threeparttablex.tlpsrc new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/Master/tlpkg/tlpsrc/threeparttablex.tlpsrc |