diff options
author | Karl Berry <karl@freefriends.org> | 2018-12-16 21:52:40 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2018-12-16 21:52:40 +0000 |
commit | 332be36167bd1f4eb97b2892b61d320218cf2459 (patch) | |
tree | cb9182daf561e7036ebf5b733a78190117c63dc9 | |
parent | 5baa8b8ec1df21574547cd1d1bcb43b7e395923f (diff) |
xltabular (16dec18)
git-svn-id: svn://tug.org/texlive/trunk@49427 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/texmf-dist/doc/latex/xltabular/Changes | 1 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/xltabular/xltabular-doc.pdf | bin | 70996 -> 71305 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/xltabular/xltabular-example-hyp.tex | 10 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/xltabular/xltabular-example.inp | 80 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/xltabular/xltabular-example.tex | 9 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/xltabular/xltabular.sty | 98 |
6 files changed, 173 insertions, 25 deletions
diff --git a/Master/texmf-dist/doc/latex/xltabular/Changes b/Master/texmf-dist/doc/latex/xltabular/Changes index 8fd7a67551d..05b615fc279 100644 --- a/Master/texmf-dist/doc/latex/xltabular/Changes +++ b/Master/texmf-dist/doc/latex/xltabular/Changes @@ -1,3 +1,4 @@ +2.0a 2018/12/16 - better hyperref support; example files 1.0a 2018/05/23 - restore original tabularx must not be statically 0.05 2017-10-26 - set \keepXColumns 0.04 2017-10-23 - wrong references (RN) diff --git a/Master/texmf-dist/doc/latex/xltabular/xltabular-doc.pdf b/Master/texmf-dist/doc/latex/xltabular/xltabular-doc.pdf Binary files differindex 2315513133b..97b550a6602 100644 --- a/Master/texmf-dist/doc/latex/xltabular/xltabular-doc.pdf +++ b/Master/texmf-dist/doc/latex/xltabular/xltabular-doc.pdf diff --git a/Master/texmf-dist/doc/latex/xltabular/xltabular-example-hyp.tex b/Master/texmf-dist/doc/latex/xltabular/xltabular-example-hyp.tex new file mode 100644 index 00000000000..2d477d13658 --- /dev/null +++ b/Master/texmf-dist/doc/latex/xltabular/xltabular-example-hyp.tex @@ -0,0 +1,10 @@ + +%--------------------------- +\setcounter{errorcontextlines}{100} +\listfiles +\documentclass{scrbook} +\usepackage{caption} +\usepackage{xltabular} +\usepackage{hyperref} +\input{xltabular-example.inp} +%--------------------------- diff --git a/Master/texmf-dist/doc/latex/xltabular/xltabular-example.inp b/Master/texmf-dist/doc/latex/xltabular/xltabular-example.inp new file mode 100644 index 00000000000..f61cc620658 --- /dev/null +++ b/Master/texmf-dist/doc/latex/xltabular/xltabular-example.inp @@ -0,0 +1,80 @@ + +\newcommand*\showCounterTable{% + \noindent The Counter \textbf{table:~\arabic{table}}% +} + +\begin{document} + +\chapter{Chapter 1} +\section{Section 1 of Chapter 1} + +\showCounterTable +\begin{xltabular}[l]{.7\linewidth}{|c|X|X|} +\caption{A table with a caption\label{tab:A}} \\ +\hline +1 & \hrulefill 2 \hrulefill & \hrulefill 3 \hrulefill \\ +4 & \hrulefill 5 \hrulefill & \hrulefill 6 \hrulefill \\ +\hline +\end{xltabular} +\showCounterTable + +\section{Section 2 of Chapter 1} + +\showCounterTable +\begin{xltabular}[r]{.7\linewidth}{|c|X|X|} +\hline +1 & \hrulefill 2 \hrulefill & \hrulefill 3 \hrulefill \\ +4 & \hrulefill 5 \hrulefill & \hrulefill 6 \hrulefill \\ +\hline +\end{xltabular} +\showCounterTable + +\section{Section 3 of Chapter 1} + +\showCounterTable +\begin{xltabular}[r]{.7\linewidth}{|c|X|X|} +\caption{A table with a caption\label{tab:B}} \\ +\hline +1 & \hrulefill 2 \hrulefill & \hrulefill 3 \hrulefill \\ +4 & \hrulefill 5 \hrulefill & \hrulefill 6 \hrulefill \\ +\hline +\end{xltabular} +\showCounterTable + +\chapter{Chapter 2} +\section{Section 1 of Chapter 2} + +\showCounterTable +\begin{xltabular}[c]{.7\linewidth}{|c|X|X|} +\caption{A table with a caption\label{tab:C}} \\ +\hline +1 & \hrulefill 2 \hrulefill & \hrulefill 3 \hrulefill \\ +4 & \hrulefill 5 \hrulefill & \hrulefill 6 \hrulefill \\ +\hline +\end{xltabular} +\showCounterTable + +\section{Section 2 of Chapter 2} + +\showCounterTable +\begin{xltabular}[c]{.7\linewidth}{|c|X|X|} +\caption{A table with a caption\label{tab:D}} \\ +\hline +1 & \hrulefill 2 \hrulefill & \hrulefill 3 \hrulefill \\ +4 & \hrulefill 5 \hrulefill & \hrulefill 6 \hrulefill \\ +\hline +\end{xltabular} +\showCounterTable + +\section{Section 3 of Chapter 2 -- some references} + +\begin{itemize} + \item Table~\ref{tab:A} is on page~\pageref{tab:A} + \item Table~\ref{tab:B} is on page~\pageref{tab:B} + \item Table~\ref{tab:C} is on page~\pageref{tab:C} + \item Table~\ref{tab:D} is on page~\pageref{tab:D} +\end{itemize} + +\end{document} + +\endinput diff --git a/Master/texmf-dist/doc/latex/xltabular/xltabular-example.tex b/Master/texmf-dist/doc/latex/xltabular/xltabular-example.tex new file mode 100644 index 00000000000..fbeb87ae01e --- /dev/null +++ b/Master/texmf-dist/doc/latex/xltabular/xltabular-example.tex @@ -0,0 +1,9 @@ + +%--------------------------- +\setcounter{errorcontextlines}{100} +\listfiles +\documentclass{scrbook} +\usepackage{caption} +\usepackage{xltabular} +\input{xltabular-example.inp} +%--------------------------- diff --git a/Master/texmf-dist/tex/latex/xltabular/xltabular.sty b/Master/texmf-dist/tex/latex/xltabular/xltabular.sty index ff18911fe40..329ea83c17b 100644 --- a/Master/texmf-dist/tex/latex/xltabular/xltabular.sty +++ b/Master/texmf-dist/tex/latex/xltabular/xltabular.sty @@ -6,28 +6,35 @@ % Copyright 2018 Herbert Voss <hvoss@tug.org> % Rolf Niepraschk <Rolf.Niepraschk@gmx.de> %% -\ProvidesPackage{xltabular}[2018/05/23 v0.1a `xltabular' package (hv,RN)] +\ProvidesPackage{xltabular}[2018/12/16 v0.2a `xltabular' package (hv,RN)] \RequirePackage{tabularx} -\let\ORIGi@tabularx=\tabularx -\let\ORIGi@endtabularx=\endtabularx -\let\ORIGi@TX@endtabularx=\TX@endtabularx +\let\XLT@i@tabularx=\tabularx +\let\XLT@i@endtabularx=\endtabularx +\let\XLT@i@TX@endtabularx=\TX@endtabularx % \RequirePackage{ltablex} \keepXColumns% xltabular behaves like tabularx % -\let\ORIGii@tabularx=\tabularx -\let\ORIGii@TX@endtabularx=\TX@endtabularx -% -\let\ORIG@longtable=\longtable +\let\XLT@ii@tabularx=\tabularx +\let\XLT@ii@TX@endtabularx=\TX@endtabularx +\let\XLT@longtable=\longtable +\let\XLT@LT@start=\LT@start +\let\XLT@LT@array=\LT@array +\@ifundefined{scr@LT@array}{% + \AtBeginDocument{% + \@ifundefined{adl@LT@array}{}{\let\XLT@adl@LT@array=\adl@LT@array} + } +}{\let\XLT@scr@LT@array=\scr@LT@array}% + % % restore original tabularx \renewenvironment{tabularx}% -{\let\TX@endtabularx=\ORIGi@TX@endtabularx\ORIGi@tabularx} -{\ORIGi@endtabularx} +{\let\TX@endtabularx=\XLT@i@TX@endtabularx\XLT@i@tabularx} +{\XLT@i@endtabularx} % % define a new tabularx like the one from "ltablex" % -\newenvironment{xltabular}[1][x] +\newenvironment{xltabular}[1][x]% {\if l#1% \LTleft\z@ \LTright\fill \else\if r#1% @@ -35,31 +42,72 @@ \else\if c#1% \LTleft\fill \LTright\fill \fi\fi\fi - \let\TX@endtabularx=\ORIGii@TX@endtabularx + \let\TX@endtabularx=\XLT@ii@TX@endtabularx \let\endtabularx\endxltabular - \ORIGii@tabularx} + \XLT@ii@tabularx} {\def\@currenvir{tabularx}} -% In "longtable" increase the counter "table" only if "\caption" is used +% in "longtable" increase the counter "table" only if "\caption" is used \AtBeginDocument{% - \let\ORIG@LT@capti@n=\LT@capti@n + \let\XLT@LT@capti@n=\LT@capti@n \def\LT@capti@n{% - \@ifstar{\ORIG@LT@capti@n*}{% - % We use the following instead of "\refstepcounter" - \stepcounter{\LTcaptype}% - % We are inside a group: edef -> xdef - \protected@xdef\@currentlabel - {\csname p@\LTcaptype\endcsname\csname the\LTcaptype\endcsname}% - \ORIG@LT@capti@n + \@ifstar{\XLT@LT@capti@n*}{% + \XLT@refstepcounter{\LTcaptype}% + % because we are inside a group + \global\let\@currentlabel=\@currentlabel + \ifXLT@HypRef + % revert to the patched version + \global\let\LT@start=\XLT@Hy@LT@start + \hyper@makecurrent{\LTcaptype}% + \global\let\Hy@LT@currentHref\@currentHref + \fi + \XLT@LT@capti@n }% }% } % \providecommand*\LTcaptype{table}% support of package "caption" \def\longtable{% - \addtocounter{\LTcaptype}\m@ne - \ORIG@longtable -} + \ifXLT@HypRef + % revert to the unpatched version when \caption is not used + \global\let\LT@start=\XLT@LT@start + \fi + \XLT@longtable +} + +% is not the hyperref version if hyperref is loaded after this package +\AtEndOfPackage{\let\XLT@refstepcounter=\refstepcounter} +\newif\ifXLT@HypRef +\AtBeginDocument{% + % is the hyperref version if hyperref is loaded + \let\XLT@@refstepcounter=\refstepcounter + \@ifpackageloaded{hyperref}{\XLT@HypReftrue}{\XLT@HypReffalse}% + \ifXLT@HypRef + % save the patched version + \let\XLT@Hy@LT@start=\LT@start + % revert to the unpatched versions + \@ifundefined{scr@LT@array}{% + \@ifundefined{adl@LT@array}{% + % hyperref has \LT@array patched + \let\LT@array=\XLT@LT@array + }{% + % hyperref has \adl@LT@array patched, not \LT@array + \let\adl@LT@array=\XLT@adl@LT@array + }% + }{% + % hyperref has \scr@LT@array patched, not \LT@array + \let\scr@LT@array=\XLT@scr@LT@array + }% + \fi + \let\XLT@@LT@array=\LT@array + \def\LT@array{% + % make the call of \refstepcounter in \XLT@@LT@array ineffective + \def\refstepcounter##1{% + \let\refstepcounter=\XLT@@refstepcounter + }% + \XLT@@LT@array + }% +} % \endinput %% |