diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/t2/etc/citehack.sty |
Initial commit
Diffstat (limited to 'macros/latex/contrib/t2/etc/citehack.sty')
-rw-r--r-- | macros/latex/contrib/t2/etc/citehack.sty | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/macros/latex/contrib/t2/etc/citehack.sty b/macros/latex/contrib/t2/etc/citehack.sty new file mode 100644 index 0000000000..4e44dc5417 --- /dev/null +++ b/macros/latex/contrib/t2/etc/citehack.sty @@ -0,0 +1,88 @@ +% This is the file citehack.sty of the T2 package. +% +% Allow inputenc-generated characters as references in \cite and \bibitem. +% Also in \label and \ref. + +\ProvidesPackage{citehack} + +\let\org@IeC\IeC +\def\tmp@IeC#1{\string\IeC\space{\string#1 }} + +% This is a modified \@bibitem command; +% we added \let\protect\noexpand, like in \@lbibitem, +% because the item may include, e.g., \IeC {...} +% or some other protected commands. +\def\@bibitem#1{\item\if@filesw {\let\protect\noexpand\immediate\write\@auxout + {\string\bibcite{#1}{\the\value{\@listctr}}}}\fi\ignorespaces} +%\def\@lbibitem[#1]#2{\item[\@biblabel{#1}\hfill]\if@filesw +% {\let\protect\noexpand\let\IeC\tmp@IeC +% \immediate +% \write\@auxout{\string\bibcite{#2}{#1}}}\fi\ignorespaces} +%\def\@bibitem#1{\item\if@filesw \let\IeC\tmp@IeC\immediate\write\@auxout +% {\string\bibcite{#1}{\the\value{\@listctr}}}\let\IeC\org@IeC\fi\ignorespaces} + +\def\@citex[#1]#2{\let\IeC\tmp@IeC\edef\CH@temp{#2}\let\IeC\org@IeC + \let\@citea\@empty + \@cite{\@for\@citeb:=\CH@temp\do + {\@citea\def\@citea{,\penalty\@m\ }% + \edef\@citeb{\expandafter\@firstofone\@citeb\@empty}% + \if@filesw\immediate\write\@auxout{\string\citation{\@citeb}}\fi + \@ifundefined{b@\@citeb}{\mbox{\reset@font\bfseries ?}% + \G@refundefinedtrue + \@latex@warning + {Citation `\@citeb' on page \thepage \space undefined}}% + {\hbox{\csname b@\@citeb\endcsname}}}}{#1}} + +\def\nocite#1{\@bsphack + \let\IeC\tmp@IeC\edef\CH@temp{#1}\let\IeC\org@IeC + \@for\@citeb:=\CH@temp\do{% + \edef\@citeb{\expandafter\@firstofone\@citeb}% + \if@filesw\immediate\write\@auxout{\string\citation{\@citeb}}\fi + \@ifundefined{b@\@citeb}{\G@refundefinedtrue + \@latex@warning{Citation `\@citeb' undefined}}{}}% + \@esphack} + +\def\@newl@bel#1#2#3{\let\IeC\tmp@IeC + \@ifundefined{#1@#2}% + \relax + {\gdef \@multiplelabels {% + \@latex@warning@no@line{There were multiply-defined labels}}% + \@latex@warning@no@line{Label `#2' multiply defined}}% + \global\@namedef{#1@#2}{#3}\let\IeC\org@IeC} + +% This is a modified \@testdef command taken from Babel: +\def\@testdef #1#2#3{% + \let\IeC\tmp@IeC + \expandafter\let\expandafter\bbl@tempa\csname #1@#2\endcsname + \def\bbl@tempb{#3}% + \ifx\bbl@tempa\relax\else + \edef\bbl@tempa{\expandafter\strip@prefix\meaning\bbl@tempa}\fi + \edef\bbl@tempb{\expandafter\strip@prefix\meaning\bbl@tempb}% + \ifx \bbl@tempa \bbl@tempb + \else \@tempswatrue \fi\let\IeC\org@IeC} + +% \ref, \pageref and \label support: +\DeclareRobustCommand\ref[1]{\let\IeC\tmp@IeC + \expandafter\let\expandafter\CH@temp\csname r@#1\endcsname + \let\IeC\org@IeC\@setref\CH@temp\@firstoftwo{#1}} +\DeclareRobustCommand\pageref[1]{\let\IeC\tmp@IeC + \expandafter\let\expandafter\CH@temp\csname r@#1\endcsname + \let\IeC\org@IeC\@setref\CH@temp\@secondoftwo{#1}} +\def\label#1{\let\IeC\tmp@IeC + \@bsphack\protected@write\@auxout{}{\string\newlabel{#1}{{\@currentlabel}{\thepage}}}\@esphack + \let\IeC\org@IeC} + +% varioref package support: +\def\vref@pagenum#1#2{\let\IeC\tmp@IeC + \@ifundefined{r@#2}{\@namedef{r@#2}{{??}{??}}}{}% + \edef#1{\expandafter\expandafter\expandafter + \@cdr\csname r@#2\endcsname + \@nil}% + \let\IeC\org@IeC} +\def\vrefpagenum#1#2{\let\IeC\tmp@IeC + \@ifundefined{r@#2}% + {\G@refundefinedtrue + \@latex@warning{Reference `#2' on page \thepage \space + undefined}}{}% + \let\IeC\org@IeC + \vref@pagenum{#1}{#2}} |