diff options
author | Karl Berry <karl@freefriends.org> | 2013-05-22 23:12:35 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2013-05-22 23:12:35 +0000 |
commit | fcb85af9df475453dec233df300e23d07c20205a (patch) | |
tree | ce40d838f2e44da9065ca0f5d24e109122e0b149 /Master | |
parent | 8720829c9cba68ab04a8d8e4f0e6e0fd31cabed7 (diff) |
theoremref (22may13)
git-svn-id: svn://tug.org/texlive/trunk@30640 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/doc/latex/theoremref/theoremref-doc.pdf | bin | 254451 -> 351316 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/theoremref/theoremref-doc.tex | 16 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/theoremref/theoremref.sty | 64 |
3 files changed, 66 insertions, 14 deletions
diff --git a/Master/texmf-dist/doc/latex/theoremref/theoremref-doc.pdf b/Master/texmf-dist/doc/latex/theoremref/theoremref-doc.pdf Binary files differindex 07de45d6eed..3aa0159bc0c 100644 --- a/Master/texmf-dist/doc/latex/theoremref/theoremref-doc.pdf +++ b/Master/texmf-dist/doc/latex/theoremref/theoremref-doc.pdf diff --git a/Master/texmf-dist/doc/latex/theoremref/theoremref-doc.tex b/Master/texmf-dist/doc/latex/theoremref/theoremref-doc.tex index cba8ec44aef..e4602668279 100644 --- a/Master/texmf-dist/doc/latex/theoremref/theoremref-doc.tex +++ b/Master/texmf-dist/doc/latex/theoremref/theoremref-doc.tex @@ -1,5 +1,7 @@ \documentclass[pagesize=auto]{scrartcl} +% Many thanks to whoever generated this documentation file. --E.J. + \usepackage{fixltx2e} \usepackage{etex} \usepackage{lmodern} @@ -22,7 +24,7 @@ \title{The \pkg{theoremref} package} \author{Emil Jeřábek\thanks{\mail{jerabek@math.spam.cz} (replace \texttt{spam} with \texttt{cas})}} -\date{2008/05/13} +\date{2013/05/22} \begin{document} @@ -143,15 +145,25 @@ described above. typesetting macros. It is compatible with the \pkg{theorem} and \pkg{amsthm} packages, as well as the default theorem system in base \LaTeX. It may fail for other theorem-like packages. + + The package is compatible with \pkg{hyperref}, but not with other + packages that change the syntax of \cmd{\newlabel} commands written + to the \texttt{.aux} file. \end{itemize} +\section{History} + +\begin{itemize} +\item 2008-05-13: Initial public release. +\item 2013-05-22: Added support for hyperref. +\end{itemize} \section{License} The \pkg{theoremref} package is dually licensed under GPL or LPPL at your option: -Copyright © 2008 Emil Jeřábek +Copyright © 2008, 2013 Emil Jeřábek This package may be distributed and/or modified under the conditions of the \LaTeX\ Project Public License, either version 1.3 diff --git a/Master/texmf-dist/tex/latex/theoremref/theoremref.sty b/Master/texmf-dist/tex/latex/theoremref/theoremref.sty index aac31ecd9b3..c7d56e3f6aa 100644 --- a/Master/texmf-dist/tex/latex/theoremref/theoremref.sty +++ b/Master/texmf-dist/tex/latex/theoremref/theoremref.sty @@ -1,12 +1,12 @@ % see the bottom of the file for a description and usage notes \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{theoremref} - [2008/05/13 References with automatic theorem names] + [2013/05/22 References with automatic theorem names] +\def\thmref@lc#1{#1} \DeclareOption{lowercase}{\let\thmref@lc\lowercase} \DeclareOption{reftex} - {\renewcommand\th[1]{\csname th\expandafter\@gobble\string#1\endcsname}} -\def\thmref@lc#1{#1} + {\def\thmref@th#1{\csname th\expandafter\@gobble\string#1\endcsname}} \ProcessOptions\relax %hook in \@thm to get the name @@ -14,10 +14,12 @@ \thmref@oldthm{#1}{#2}} \def\thmref@amsthm#1#2#3{\thmref@lc{\def\thmref@currname{#3}}% \thmref@oldthm{#1}{#2}{#3}} -\def\thmref@setup{\let\thmref@oldthm\@thm - \@ifpackageloaded{amsthm}{\let\@thm\thmref@amsthm}% - {\let\@thm\thmref@newthm}} -\AtBeginDocument{\thmref@setup} + +%\let\thnameref\pageref fails miserably when the ref is undefined +\DeclareRobustCommand\thnameref[1] + {\expandafter\thmref@setref\csname r@#1\endcsname} +\def\thmref@setref#1{\ifx#1\relax?THM?\else\expandafter\@secondoftwo#1\fi} +\def\thmref@sethyp#1{\ifx#1\relax?THM?\else\expandafter\@secondoffive#1\fi} %hacked version of \label from the kernel \DeclareRobustCommand\thlabel[1]{\@bsphack @@ -25,10 +27,26 @@ {\string\newlabel{#1}{{\@currentlabel}{\thmref@currname}}}% \@esphack} -%\let\thnameref\pageref fails miserably when the ref is undefined -\DeclareRobustCommand\thnameref[1] - {\expandafter\thmref@setref\csname r@#1\endcsname} -\def\thmref@setref#1{\ifx#1\relax?THM?\else\expandafter\@secondoftwo#1\fi} +%... or from hyperref/nameref.sty +\def\thlabel@hyperref#1{% + \@bsphack + \begingroup + \let\label\@gobble + \def\ref{\protect\ref}% + \edef\@currentlabstr{% + \expandafter\strip@prefix\meaning\@currentlabelname + }% + \protected@write\@auxout{}{% + \string\newlabel{#1}{% + {\@currentlabel}% + {\thmref@currname}% <-- + {\expandafter\strip@period\@currentlabstr\relax.\relax\@@@}% + {\@currentHref}{}% + }% + }% + \endgroup + \@esphack +} \newif\ifthmref@comma \newif\ifthmref@final \newcount\thmref@num \DeclareRobustCommand\thref[1]{\let\thmref@last\empty \let\thmref@stack\empty @@ -52,6 +70,18 @@ \def\thmref@one#1{\ifnum\thmref@num>0,\fi \space$\ref{#1}$\advance\thmref@num 1\relax} +\AtBeginDocument{\thmref@setup} +\def\thmref@setup{% + \let\thmref@oldthm\@thm + \@ifpackageloaded{amsthm}{\let\@thm\thmref@amsthm}% + {\let\@thm\thmref@newthm}% + \@ifpackageloaded{hyperref}{% + \expandafter\let\csname thlabel\space\endcsname\thlabel@hyperref + \let\thmref@setref\thmref@sethyp + }\relax + \ifx\thmref@th\@undefined\else\let\th\thmref@th\fi% +} + \endinput package: theoremref @@ -158,13 +188,23 @@ CAVEATS ``amsthm'' packages, as well as the default theorem system in base LaTeX. It may fail for other theorem-like packages. + The package is compatible with ``hyperref'', but not with other + packages that change the syntax of ``\newlabel'' commands written + to the aux file. + + +HISTORY + +2008-05-13: Initial public release. +2013-05-22: Added support for hyperref. + LICENSE The theoremref package is dually licensed under GPL or LPPL at your option: -Copyright (C) 2008 Emil Je\v{r}\'abek +Copyright (C) 2008, 2013 Emil Je\v{r}\'abek This package may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3 |