22.07.2013 Views

ntheorem.pdf. - Mirrors.med.harvard.edu

ntheorem.pdf. - Mirrors.med.harvard.edu

ntheorem.pdf. - Mirrors.med.harvard.edu

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

hyperref-thref When hyperref is active, the handling of thref described above via the<br />

.aux file redefinition of \@newl@bel is not possible (hyperref forces its<br />

definitions at \AtBeginDocument). Instead, an internal identifier of the<br />

form Theorem.1.1 is used in the .aux file for the hypertarget (using the<br />

type of the counter; thus when a theorem type uses another counter, this<br />

does not give the theorem type itself). The same id is stored in the .thm<br />

file for the respective theorem. by this, given the id from the \newlabel in<br />

the .aux file, the .thm file can be searched for the actual type information.<br />

1096 \if@thref<br />

1097 \def\@firstofthree#1#2#3{#1}%<br />

1098 \def\getKeywordOf#1{%<br />

1099 \let\thm@oldcontentsline\contentsline<br />

1100 \def\contentsline##1##2##3##4{%<br />

1101 \ifthenelse{\equal{#1}{##4}}{\@firstofthree##2}{}%<br />

1102 \ignorespaces}%<br />

1103 \@input{\jobname .thm}%<br />

1104 \let\contentsline\thm@oldcontentsline<br />

1105 }<br />

1106 \def\thm@fmt@hyplabel@i#1#2#3#4#5{%<br />

1107 \getKeywordOf{#4}~\thm@fmt@hyplabel@ii#4}<br />

1108 \def\thm@fmt@hyplabel@ii#1.#2{#2}%<br />

1109 \def\thref#1{%<br />

1110 \expandafter\@setref\csname r@#1\endcsname\thm@fmt@hyplabel@i{#1}}%<br />

1111 \fi % end of \if@thref<br />

1112 }% end of option hyperref *********************************************<br />

Lines 1097-1105: given an id #1 of the form Theorem.1.1, scan the .thm file<br />

for a \contentsline whose 4th argument equals the id. If found, the<br />

third component of its second argument gives its theorem type.<br />

Lines 1106-1108: this command must have 5 arguments because it is applied<br />

to the information stored with \newlabel in the .aux file. The 4th<br />

argument is the id #4 of the form Theorem.1.1.<br />

Get the correct keyword by \getKeywordOf{#4} and its number (which<br />

is the part following the first “.”).<br />

Lines 1109-1110: createahyperlinkvia\@setref(seehyperref.sty): \@setref<br />

takes three arguments: r@〈label〉 := arg1 is the information from<br />

\newlabel in the .aux file (consisting of 5 components). The 2nd<br />

argument arg2 must be a command that uses 5 arguments, here<br />

\thm@fmt@hyplabel@i{#1}as definedinLines 1106-1108. The3rd oneis<br />

the label, and is only used for error messages. \@setref then –roughly–<br />

applies arg2 on arg1.<br />

7.1.10 Auxiliary macros<br />

For generating theorem-lists, we need to write information into a separate<br />

file. Beause we don’t want to expand this information, we parse it specially<br />

77

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!