summaryrefslogtreecommitdiff
path: root/info/examples/ltt/xref.sty
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /info/examples/ltt/xref.sty
Initial commit
Diffstat (limited to 'info/examples/ltt/xref.sty')
-rw-r--r--info/examples/ltt/xref.sty109
1 files changed, 109 insertions, 0 deletions
diff --git a/info/examples/ltt/xref.sty b/info/examples/ltt/xref.sty
new file mode 100644
index 0000000000..218d814f97
--- /dev/null
+++ b/info/examples/ltt/xref.sty
@@ -0,0 +1,109 @@
+% XREF.STY
+% Querverweis-Mechanismus fuer mehrbaendige Werke
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{xref}
+\RequirePackage{ifthen}
+
+% Kennung fuer eigene Bandnummer, Default: Band I
+\newcommand{\@volume}{I}
+
+% Userkommando zum Setzen der Bandzahl
+\newcommand{\volume}[1]
+ {\renewcommand{\@volume}{#1}}
+
+% Vollstaendige Kennzeichnung nach einer
+% externen Referenz
+\newcommand{\volnotation}[1]
+ { (Band~#1)}
+
+% Umdefinition einiger Interna fuer dreiteilige
+% Labelinformationen
+\long\def\@firstofthree#1#2#3{#1}
+\long\def\@secondofthree#1#2#3{#2}
+\long\def\@thirdofthree#1#2#3{#3}
+
+% Analog zu \@setref:
+% #1 ist dreiteilige Liste (Ref, Seite, Band),
+% #2 ist Befehl \@xofthree, #3 ist Labelname
+\def\@setbref#1#2#3{%
+ \ifx#1\relax
+ \else
+ \def\tmp{\expandafter#2#1}%
+ \ifthenelse{\equal{\tmp}{\@volume}}
+ {}
+ {\volnotation{\tmp}}%
+ \fi
+ }
+
+% Label, das neben Referenznummer und Seitenzahl
+% auch die Bandnummer wegschreibt
+\def\label#1{\@bsphack
+ \protected@write\@auxout{}%
+ {\string\newlabel{#1}%
+ {{\@currentlabel}{\thepage}{\@volume}}}%
+ \@esphack}
+
+%% Lies Hilfsfiles fuer die externen Baende ein und
+%% generiere Labelinfos daraus
+%% -- Einige Zeilen aus File `xr.sty'/tools -------
+%% xr.dtx Copyright (C) 1993-1994 David Carlisle
+\def\externalaux#1{\makeatletter
+ \XR@next#1.aux\relax\\}
+\def\XR@next#1\relax#2\\{%
+ \edef\XR@list{#2}%
+ \XR@loop{#1}}
+\def\XR@aux{%
+ \ifx\XR@list\@empty\else\expandafter\XR@explist\fi}
+
+\def\XR@explist{\expandafter\XR@next\XR@list\\}
+\def\XR@loop#1{\openin\@inputcheck#1\relax
+ \ifeof\@inputcheck
+ \PackageWarning{xref}%
+ {^^JNo file #1^^JLABELS NOT IMPORTED.^^J}%
+ \expandafter\XR@aux
+ \else
+ \PackageInfo{xref}{IMPORTING LABELS FROM #1}%
+ \expandafter\XR@read\fi}
+\def\XR@read{%
+ \read\@inputcheck to\XR@line
+ \expandafter\XR@test\XR@line...\XR@}
+\long\def\XR@test#1#2#3#4\XR@{%
+ \ifx#1\newlabel
+ \newlabel{#2}{#3}%
+ \else\ifx#1\@input
+ \edef\XR@list{\XR@list#2\relax}%
+ \fi\fi
+ \ifeof\@inputcheck\expandafter\XR@aux
+ \else\expandafter\XR@read\fi}
+% ----- Ende des xr-Imports --------
+
+% ---- Hauptbefehle ------
+% Zunaechst die normalen Funktionalitaeten: Druck
+% der Referenz, Seitenzahl, Bandzahl
+% r@name enthaelt liste der drei Daten
+\newcommand{\rref}[1]{%
+ \expandafter\@setref%
+ \csname r@#1\endcsname\@firstofthree{#1}}
+\newcommand{\ppageref}[1]{%
+ \expandafter\@setref%
+ \csname r@#1\endcsname\@secondofthree{#1}}
+\newcommand{\bref}[1]{%
+ \expandafter\@setref%
+ \csname r@#1\endcsname\@thirdofthree{#1}}
+
+% Liefert Referenzzahl und ggf. Hinweis auf den
+% zugehoerigen Band, falls extern
+\renewcommand{\ref}[1]{%
+ \expandafter\@setref%
+ \csname r@#1\endcsname\@firstofthree{#1}%
+ \expandafter\@setbref%
+ \csname r@#1\endcsname\@thirdofthree{#1}%
+ }
+
+% dto. fuer Seitenzahlen
+\renewcommand{\pageref}[1]{%
+ \expandafter\@setref%
+ \csname r@#1\endcsname\@secondofthree{#1}%
+ \expandafter\@setbref%
+ \csname r@#1\endcsname\@thirdofthree{#1}%
+ }