% doc/src/sgml/jadetex.cfg % % This file redefines FlowObjectSetup and some related macros to greatly % reduce the number of control sequence names created, and also to avoid % creation of many useless hyperlink anchors in PDF files. % % The original coding of FlowObjectSetup defined a control sequence x@LABEL % for pretty nearly every flow object in the file, whether that object was % cross-referenced or not. Worse yet, it created a hyperlink anchor for % every such object, which not only bloated the output PDF with useless % anchors but consumed additional control sequence names internally. % % To fix, extend PageLabel's already-existing mechanism whereby a p@LABEL % control sequence is filled in only for labels that are referenced by at % least one \Pageref call. We now also fill in p@LABEL for labels that are % referenced by a \Link. Then, we can drop x@LABEL entirely, and use % p@LABEL to control emission of both a hyperlink anchor and a \PageLabel. % Now, both of those things are emitted for all and only the flow objects % that have either a hyperlink reference or a page-number reference. % % (With a more invasive patch, we could track the need for an anchor and a % page-number label separately, but that would probably require more control % sequences than this way does.) % % % In addition to checking p@LABEL not x@LABEL, this version of FlowObjectSetup % is fixed to clear \Label and \Element whether or not it emits an anchor % and page label. Failure to do that seems to explain some pre-existing bugs % in which certain SGML constructs weren't correctly cross-referenced. % \def\FlowObjectSetup#1{% \ifDoFOBSet \ifLabelElements \ifx\Label\@empty\let\Label\Element\fi \fi \ifx\Label\@empty\else \expandafter\ifx\csname p@\Label\endcsname\relax \else \bgroup \ifNestedLink \else \hyper@anchorstart{\Label}\hyper@anchorend \PageLabel{\Label}% \fi \egroup \fi \let\Label\@empty \let\Element\@empty \fi \fi } % % Adjust PageLabel so that the p@NAME control sequence acquires a correct % value immediately; this seems to be needed to avoid scenarios wherein % additional TeX runs are needed to reach a stable state of the .aux file. % \def\PageLabel#1{% \@bsphack \expandafter\ifx\csname p@#1\endcsname\relax \else \protected@write\@auxout{}% {\string\pagelabel{#1}{\thepage}}% % Ensure the p@NAME control sequence acquires correct value immediately \expandafter\xdef\csname p@#1\endcsname{\thepage}% \fi \@esphack} % % In \Link, add code to emit an aux-file entry if the p@NAME sequence isn't % defined. Much as in @Setref, this ensures we'll process the referenced % item correctly on the next TeX run. % \def\Link#1{% \begingroup \SetupICs{#1}% \ifx\Label\@empty\let\Label\Element\fi % \typeout{Made a Link at \the\inputlineno, to \Label}% \hyper@linkstart{\LinkType}{\Label}% \NestedLinktrue % If p@NAME control sequence isn't defined, emit dummy def to aux file % so it will get defined properly on next run, much as in @Setref \expandafter\ifx\csname p@\Label\endcsname\relax \immediate\write\@mainaux{\string\pagelabel{\Label}{qqq}}% \fi }