summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/genmisc/pagereference.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/generic/genmisc/pagereference.tex')
-rw-r--r--Master/texmf-dist/tex/generic/genmisc/pagereference.tex67
1 files changed, 67 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/generic/genmisc/pagereference.tex b/Master/texmf-dist/tex/generic/genmisc/pagereference.tex
new file mode 100644
index 00000000000..34ebc44c68c
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/genmisc/pagereference.tex
@@ -0,0 +1,67 @@
+%%%%%%%% PAGEREFERENCE MACROS
+% May 2nd, 1994
+% Peter Ungar, 914 723 7187, laxa@acfcluster.nyu.edu
+% 109 Lee Road, Scarsdale, N.Y. 10583-5229
+%
+\long\def\COMMENT#1!E{}
+%
+% MACROS BEGIN HERE
+\newwrite\inpr
+\message{Is this the second pass? (y or n)}
+\read16 to\answer
+\if n\answer\immediate\openout\inpr=\jobname.pgn%
+\def\wrx{\write\inpr}%
+\def\plbl*#1*{\wrx{\noexpand\let\csname prec#1\endcsname=\folio}}
+\def\pref*#1*{XX}
+\fi
+\if y\answer\closeout\inpr
+\input \jobname.pgn
+\def\plbl*#1*{}
+\def\pref*#1*{\csname prec#1\endcsname}
+\fi
+% MACROS END HERE
+
+\COMMENT
+
+ We use the macros as follow. Suppose you want to refer to a page
+where you say something about Pythagoras. Put at the place to
+which you want to refer
+\plbl*pyth* Where you want to refer to this page, put
+\pref*pyth* Here, in the place of pyth, one may use any sequence
+of small and capital letters. Since the sequence will end up as
+part of a TEX control sequence, digits are unfortunately not
+allowed. (If that is very burdensome, we suggest encoding digits
+as capitals, A for 1 etc.) In the second pass, the macros insert
+a page number where there is a \pref.
+
+ The macro \plbl (pagelabel), as defined when the answer to the
+question, Is this the second pass, was n, writes the page number
+into the file filename.pgn. To be precise, it creates a new
+control sequence, consisting of \prec followed by the letters
+identifying the label, which would result in \precpyth in the
+example we gave, and sets it equal to the page number. In the
+meanwhile, the \pref (page reference) macro is defined to print XX.
+ For the second pass, we input the file of labels and the page
+numbers they signify which we wrote in the first pass. The
+pagenumber recording macro
+\plbl is redefined as vacuous, and the page reference macro \pref
+is set to insert the page number.
+
+!E
+
+
+This is a test of the page reference macro pair,
+$\backslash$plbl (pagelabel) and $\backslash$pref (pagereference)
+control sequences. There is a pagelabel command, with no effect on
+the tpyeset output, just before the period at the end of this
+sentence\plbl*aaa*.
+
+Reference to the page label on the next page: p.\pref*bb*;
+reference to the pgae label on this page: p.\pref*aaa*.
+\vfill
+\eject Here is a second pagelabel, just before the
+period\plbl*bb*. A reference to the first page label:
+p.\pref*aaa*, and a reference to the second page page label:
+p.\pref*bb*.
+
+\end