1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28\writestatus{loading}{ConTeXt Structure Macros Cross Referencing}
29
30\registerctxluafile{strcrsc}{}
31\registerctxluafile{strcref}{}
32\registerctxluafile{noderef}{optimize}
33
34\unprotect
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61\let\referenceprefix\empty
62
63\installcorenamespace{referencing}
64
65\installdirectcommandhandler \??referencing {referencing}
66
67\newif\ifreferencing \referencingtrue
68
69\appendtoks
70 \edef\p_state{\referencingparameter\c!state}
71 \ifx\p_state\v!start
72 \referencingtrue
73 \else
74 \referencingfalse
75 \fi
76\to \everysetupreferencing
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99\unexpanded\def\textreference {\dosingleargument\strc_references_text_reference}
100\unexpanded\def\pagereference {\dosingleargument\strc_references_page_reference}
101\unexpanded\def\reference {\dosingleargument\strc_references_full_reference}
102\unexpanded\def\setreference {\dodoubleargument\strc_references_set_reference }
103
104
105
106\unexpanded\def\showreferences
107 {\enabletrackers[nodes.references.show,nodes.destinations.show]}
108
109
110
111\unexpanded\def\strc_references_text_reference [#labels]{\strc_references_set_named_reference\s!text{#labels}{}}
112\unexpanded\def\strc_references_page_reference [#labels]{\strc_references_set_named_reference\s!page{#labels}{}{}}
113\unexpanded\def\strc_references_full_reference [#labels]{\strc_references_set_named_reference\s!full{#labels}{}}
114\unexpanded\def\strc_references_set_reference[#labels][#settings]{\strc_references_set_named_reference\s!user{#labels}{#settings}{}}
115
116\unexpanded\def\dosetdirectpagereference#1{\strc_references_set_named_reference\s!page{#1}{}{}}
117
118\unexpanded\def\usereferenceparameter#1
119 {\edef\m_strc_references_asked{#1\c!reference}
120 \ifx\m_strc_references_asked\empty\else
121 \dosetdirectpagereference\m_strc_references_asked
122 \fi}
123
124
125
126
127\newcount\lastreferenceattribute
128\newcount\lastdestinationattribute
129
130\def\strc_references_finish#prefix#reference#internal
131 {\normalexpanded{\clf_deferredenhancereference{#prefix}{#reference}}}
132
133\let\dofinishreference\strc_references_finish
134
135
136
137
138
139
140
141\setnewconstant\c_strc_references_bind_state\plusone
142
143\def\strc_references_inject_before
144 {}
145
146\def\strc_references_inject_after
147 {\ifcase\c_strc_references_bind_state
148
149 \or
150 \prewordbreak
151 \fi}
152
153
154\unexpanded\def\strc_references_set_named_reference
155 {\ifreferencing
156 \expandafter\strc_references_set_named_reference_indeed
157 \else
158 \expandafter\gobblefourarguments
159 \fi}
160
161\newbox\b_strc_destination_nodes
162
163\unexpanded\def\strc_references_flush_destination_nodes
164 {\ifvoid\b_strc_destination_nodes \else
165 \unhbox\b_strc_destination_nodes
166 \fi}
167
168\def\strc_references_placeholder
169 {\ifx\dotaggedplaceholder\empty\else
170 \c_attr_destination\lastdestinationattribute
171 \dotaggedplaceholder
172 \fi}
173
174\unexpanded\def\strc_references_destination_point_yes
175 {\strc_references_inject_before
176 \dostarttagged\t!reference\empty
177 \dontleavehmode\hbox attr \destinationattribute\lastdestinationattribute\bgroup
178 \strc_references_flush_destination_nodes
179 \strc_references_placeholder
180 \egroup
181 \dostoptagged
182 \strc_references_inject_after}
183
184\unexpanded\def\strc_references_destination_point_nop
185 {\strc_references_inject_before
186 \dostarttagged\t!reference\empty
187 \dontleavehmode\hbox \bgroup
188 \strc_references_flush_destination_nodes
189 \strc_references_placeholder
190 \egroup
191 \dostoptagged
192 \strc_references_inject_after}
193
194\unexpanded\def\strc_references_start_destination_nodes
195 {\setbox\b_strc_destination_nodes\hbox\bgroup}
196
197\unexpanded\def\strc_references_stop_destination_nodes
198 {\normalexpanded{\egroup\lastdestinationattribute\the\lastdestinationattribute\relax}}
199
200\unexpanded\def\strc_references_set_named_reference_indeed#kind#labels#userdata#text
201 {\ifreferencing
202
203
204 \edef\currentreferencekind {#kind}
205 \edef\currentreferencelabels {#labels}
206 \edef\currentreferenceuserdata {#userdata}
207 \edef\currentreferenceexpansion{\referencingparameter\c!expansion}
208 \ifx\currentreferencelabels\empty
209 \lastdestinationattribute\attributeunsetvalue
210 \else
211 \ifx\currentreferenceexpansion\s!xml
212 \xmlstartraw
213 \xdef\currentreferencedata{#text}
214 \xmlstopraw
215 \glet\currentreferencecoding\s!xml
216 \else
217 \ifx\currentreferenceexpansion\v!yes
218 \xdef\currentreferencedata{#text}
219 \else
220 \xdef\currentreferencedata{\detokenize{#text}}
221 \fi
222 \glet\currentreferencecoding\s!tex
223 \fi
224
225 \setnextinternalreference
226 \strc_references_start_destination_nodes
227 \clf_setdestinationattribute
228 {
229 references {
230 internal \locationcount
231
232 view {\interactionparameter\c!focus}
233 \ifx\referenceprefix\empty\else
234 prefix {\referenceprefix}
235 \fi
236 reference {\currentreferencelabels}
237 }
238 metadata {
239 kind {\currentreferencekind}
240 \ifx\currentreferencekind\s!page\else
241 \ifx\currentreferencecoding\s!xml
242 xmlroot {\xmldocument}
243 \fi
244 catcodes \catcodetable
245 \fi
246 }
247 \ifx\currentreferencedata\empty\else
248 entries {
249 text {\currentreferencedata}
250 }
251 \fi
252 \ifx\currentreferenceuserdata\empty\else
253 userdata {\detokenize{#userdata}}
254 \fi
255 }
256 \relax
257 \strc_references_stop_destination_nodes
258 \fi
259 \else
260 \setbox\b_strc_destination_nodes\emptyhbox
261 \lastdestinationattribute\attributeunsetvalue
262 \fi
263
264 \xdef\currentdestinationattribute{\number\lastdestinationattribute}
265
266 \ifnum\lastdestinationattribute>\zerocount
267 \strc_references_destination_point_yes
268 \else\ifvoid\b_strc_destination_nodes\else
269 \strc_references_destination_point_nop
270 \fi\fi}
271
272\def\strc_references_set_page_only_destination_attribute#labels
273 {\ifreferencing
274 \edef\currentreferencelabels{#labels}
275 \ifx\currentreferencelabels\empty
276 \setbox\b_strc_destination_nodes\emptyhbox
277 \lastdestinationattribute\attributeunsetvalue
278 \else
279 \strc_references_start_destination_nodes
280 \setnextinternalreference
281 \clf_setdestinationattribute
282 {
283 references {
284 internal \locationcount
285
286 view {\interactionparameter\c!focus}
287 \ifx\referenceprefix\empty\else
288 prefix {\referenceprefix}
289 \fi
290 reference {\currentreferencelabels}
291 }
292 metadata {
293 kind {page}
294 }
295 }
296 \relax
297 \strc_references_stop_destination_nodes
298 \fi
299 \else
300 \setbox\b_strc_destination_nodes\emptyhbox
301 \lastdestinationattribute\attributeunsetvalue
302 \fi}
303
304\unexpanded\def\strc_references_direct_full_user#user#labels#text
305 {\ifreferencing
306 \strc_references_start_destination_nodes
307 \setnextinternalreference
308 \edef\m_strc_references_user{#user}
309 \edef\m_strc_references_text{#text}
310 \clf_setdestinationattribute
311 {
312 references {
313 internal \locationcount
314
315 view {\interactionparameter\c!focus}
316 \ifx\referenceprefix\empty\else
317 prefix {\referenceprefix}
318 \fi
319 reference {#labels}
320 }
321 metadata {
322 kind {\s!full}
323 }
324 \ifx\m_strc_references_text\empty \else
325 entries {
326 text {\m_strc_references_text}
327 }
328 \fi
329 \ifx\m_strc_references_user\empty \else
330 userdata {\m_strc_references_user}
331 \fi
332 }
333 \relax
334 \strc_references_stop_destination_nodes
335 \else
336 \setbox\b_strc_destination_nodes\emptyhbox
337 \lastdestinationattribute\attributeunsetvalue
338 \fi
339
340 \xdef\currentdestinationattribute{\number\lastdestinationattribute}
341
342 \ifnum\lastdestinationattribute>\zerocount
343 \strc_references_destination_point_yes
344 \else\ifvoid\b_strc_destination_nodes\else
345 \strc_references_destination_point_nop
346 \fi\fi}
347
348\unexpanded\def\strc_references_direct_full
349 {\strc_references_direct_full_user\empty}
350
351\let\dodirectfullreference\strc_references_direct_full
352
353\def\strc_references_set_page_only_destination_box_attribute#cs#labels
354 {\strc_references_set_page_only_destination_attribute{#labels}
355 \ifnum\lastdestinationattribute>\zerocount
356 \edef#cs{attr \destinationattribute\number\lastdestinationattribute}
357 \else
358 \let#cs\empty
359 \fi}
360
361
362
363\unexpanded\def\boxreference[#1]
364 {\begingroup
365 \dowithnextbox
366 {\strc_references_set_page_only_destination_attribute{#1}
367 \hpack
368 \ifnum\lastdestinationattribute=\attributeunsetvalue\else attr \destinationattribute \lastdestinationattribute \fi
369 {\box\b_strc_destination_nodes\box\nextbox}
370 \endgroup}}
371
372\unexpanded\def\hboxreference[#1]{\boxreference[#1]\hbox}
373\unexpanded\def\vboxreference[#1]{\boxreference[#1]\vbox}
374
375
376
377
378
379\def\defaultreferencepage#text{[[[#text]]]}
380\def\defaultreferencetext#text{[[[#text]]]}
381
382
383
384\def\strc_references_set_simple_reference#label
385 {\iflocation
386 \strc_references_start_destination_nodes
387 \setnextinternalreference
388 \clf_setdestinationattribute
389 {
390 references {
391 view {\interactionparameter\c!focus}
392 \ifx\referenceprefix\empty\else
393 prefix {\referenceprefix}
394 \fi
395 reference {#label}
396 internal \locationcount
397 }
398 metadata {
399 kind {\s!page}
400 }
401 }
402 \relax
403 \strc_references_stop_destination_nodes
404 \xdef\currentdestinationattribute{\number\lastdestinationattribute}
405 \else
406 \setbox\b_strc_destination_nodes\emptyhbox
407 \xdef\currentdestinationattribute{\number\attributeunsetvalue}
408 \fi}
409
410\def\strc_references_set_simple_internal_reference#label
411 {\iflocation
412 \strc_references_start_destination_nodes
413 \setnextinternalreference
414 \clf_setdestinationattribute
415 {
416 references {
417 view {\interactionparameter\c!focus}
418 reference {#label}
419 internal \locationcount
420 }
421 metadata {
422 kind {\s!page}
423 }
424 }
425 \relax
426 \strc_references_stop_destination_nodes
427 \xdef\currentdestinationattribute{\number\lastdestinationattribute}
428 \else
429 \setbox\b_strc_destination_nodes\emptyhbox
430 \xdef\currentdestinationattribute{\number\attributeunsetvalue}
431 \fi}
432
433\def\strc_references_get_simple_reference#label
434 {\iflocation
435 \clf_injectreference
436 {\referenceprefix}
437 {#label}
438 {
439 height \ht\strutbox
440 depth \dp\strutbox
441 \extrareferencearguments
442 }
443 \relax
444 \xdef\currentreferenceattribute{\number\lastreferenceattribute}
445 \else
446 \xdef\currentreferenceattribute{\number\attributeunsetvalue}
447 \fi}
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469\unexpanded\def\contentreference
470 {\hbox\bgroup
471 \dodoubleempty\strc_references_content_pickup}
472
473\def\strc_references_content_pickup
474 {\ifsecondargument
475 \expandafter\strc_references_content_pickup_yes
476 \else
477 \expandafter\strc_references_content_pickup_nop
478 \fi}
479
480\def\strc_references_content_pickup_yes[#1][#2]
481 {\dowithnextbox{\strc_references_content_yes_finish{#1}{#2}}\hbox}
482
483\def\strc_references_content_pickup_nop[#1][#2]
484 {\dowithnextbox{\strc_references_content_nop_finish{#1}{#2}}\hbox}
485
486\def\strc_references_content_yes_finish#1#2
487 {\scratchwidth \wd\nextbox
488 \scratchheight\ht\nextbox
489 \scratchdepth \dp\nextbox
490 \setbox\nextbox\hpack
491 {\framed[\c!frame=\v!off,#2]{\box\nextbox}}
492 \strc_references_set_simple_reference{#1}
493 \setbox\nextbox\hpack attr \destinationattribute \currentdestinationattribute
494 {\strc_references_flush_destination_nodes
495 \box\nextbox}
496 \setbox\nextbox\hpack{\box\nextbox}
497 \wd\nextbox\scratchwidth
498 \ht\nextbox\scratchheight
499 \dp\nextbox\scratchdepth
500 \box\nextbox
501 \egroup}
502
503\def\strc_references_content_nop_finish#1#2
504 {\strc_references_set_simple_reference{#1}
505 \hpack attr \destinationattribute \currentdestinationattribute
506 {\strc_references_flush_destination_nodes
507 \box\nextbox}
508 \egroup}
509
510
511
512
513
514
515
516\newevery \everyreference \relax
517
518
519
520
521\appendtoks
522 \cleanupfeatures
523\to \everyreference
524
525
526
527
528
529
530
531\let\referenceprefix\empty
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546\unexpanded\def\usereferences[#filename]{}
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569\let\currentrealreference \empty
570\let\currentpagereference \empty
571\let\currenttextreference \empty
572\let\currentreferenceorder \empty
573\let\currentsubtextreference \empty
574\let\currentsubsubtextreference\empty
575
576\newcount\referencehastexstate
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653\unexpanded\def\definereference
654 {\dodoubleempty\strc_references_define_reference}
655
656\def\strc_references_define_reference[#name][#specification]
657 {\clf_definereference{\referenceprefix}{#name}{\detokenize{#specification}}}
658
659\unexpanded\def\resetreference[#name]
660 {\clf_resetreference{\referenceprefix}{#name}}
661
662\def\setpagereference#name#specification
663 {\clf_definereference{}{#name}{\v!page(\detokenize{#specification}}}
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680\newconditional\highlighthyperlinks \settrue\highlighthyperlinks
681
682
683
684
685
686
687
688
689\newconditional\gotonewwindow \setfalse\gotonewwindow
690
691\def\expandtexincurrentreference
692 {\ifcase\referencehastexstate\else\clf_expandcurrentreference\fi}
693
694\def\expandreferenceoperation#tag#content{\clf_setreferenceoperation#tag{#content}}
695\def\expandreferencearguments#tag#content{\clf_setreferencearguments#tag{#content}}
696
697\def\doifelsereferencefound#label#yes#nop
698 {\clf_doifelsereference{\referenceprefix}{#label}{\extrareferencearguments}
699 {\expandtexincurrentreference
700 #yes}
701 {#nop}}
702
703\let\doifreferencefoundelse \doifelsereferencefound
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732\let\unknownreference\gobbleoneargument
733
734
735
736
737\def\dummyreference{{\tttf ??}}
738\def\emptyreference{{\tttf !!}}
739
740\installtextracker
741 {structures.referencing.show}
742 {\let\strc_references_dummy\strc_references_dummy_yes}
743 {\let\strc_references_dummy\strc_references_dummy_nop}
744
745\def\strc_references_dummy_nop
746 {\dummyreference}
747
748\def\strc_references_dummy_yes
749 {\dummyreference
750 \margindata
751 [\referencingparameter\c!labelalternative]
752 [\c!style=\referencingparameter\c!labelstyle,
753 \c!color=\referencingparameter\c!labelcolor]
754 {\askedreference}}
755
756\let\strc_references_dummy\strc_references_dummy_nop
757
758\setupreferencing
759 [\c!labelalternative=\v!inleft,
760 \c!labelcolor=darkred,
761 \c!labelstyle=\smallinfofont]
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795\ifdefined\buttonheight \else \newdimen\buttonheight \fi
796\ifdefined\buttonwidth \else \newdimen\buttonwidth \fi
797
798
799
800
801
802
803
804
805
806
807
808\newif \iflocation
809\newcount\locationcount
810\newcount\locationorder
811\newbox \locationbox
812
813\def\nextinternalreference {\the\locationcount}
814\def\nextinternalorderreference{\the\locationorder}
815
816\def\setnextinternalreference
817 {\global\advance\locationcount\plusone}
818
819\def\setnextinternalreferences#kind#name
820 {\clf_setnextinternalreference{#kind}{#name}}
821
822\def\getinternalorderreference#kind#name
823 {\clf_currentreferenceorder{#kind}{#name}}
824
825\def\thisissomeinternal#kind#name
826 {\begingroup
827 \clf_setinternalreference
828 reference {#kind:#name}
829 \relax
830 \hpack attr \destinationattribute\lastdestinationattribute{}
831 \endgroup}
832
833\installcorenamespace{savedinternalreference}
834
835\letvalue{\??savedinternalreference\s!default}\!!zerocount
836
837\unexpanded\def\storeinternalreference#1#2
838 {\setxvalue{\??savedinternalreference\currentstructurename}{\number#2}}
839
840\newconditional\preferpagereferences
841
842\def\gotosomeinternal#kind#name#target#text
843 {\ifconditional\preferpagereferences
844 \directgoto{#text}[page(#target)]
845 \else
846 \directgoto{#text}[#kind:#name]
847 \fi}
848
849\def\gotonextinternal#text#target
850 {\directgoto{#text}[internal(#target)]}
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873\newcount\prefixcounter
874
875\newconditional\autocrossfilereferences
876
877\appendtoks
878 \edef\p_autofile{\referencingparameter\c!autofile}
879 \ifx\p_autofile\v!yes
880 \settrue \autocrossfilereferences
881 \else
882 \setfalse\autocrossfilereferences
883 \fi
884\to \everysetupreferencing
885
886\appendtoks
887 \edef\p_export{\referencingparameter\c!export}
888 \ifx\p_export\v!yes
889 \clf_exportreferences
890 \fi
891\to \everygoodbye
892
893\unexpanded\def\setupglobalreferenceprefix[#prefix]
894 {\xdef\referenceprefix{#prefix}}
895
896\unexpanded\def\globalpushreferenceprefix#prefix
897 {\xdef\referenceprefix{\clf_pushreferenceprefix{#prefix}}}
898
899\unexpanded\def\globalpopreferenceprefix
900 {\xdef\referenceprefix{\clf_popreferenceprefix}}
901
902\unexpanded\def\pushreferenceprefix#prefix
903 {\edef\referenceprefix{\clf_pushreferenceprefix{#prefix}}}
904
905\unexpanded\def\popreferenceprefix
906 {\edef\referenceprefix{\clf_popreferenceprefix}}
907
908\def\m_strc_references_prefix_yes{}
909\def\m_strc_references_prefix_nop{}
910
911\unexpanded\def\setupreferenceprefix[#prefix]
912 {\edef\p_prefix{#prefix}
913 \ifx\p_prefix\empty
914 \let\referenceprefix\empty
915 \else\ifx\p_prefix\m_strc_references_prefix_yes
916 \letreferencingparameter\c!prefix\s!unknown
917 \global\advance\prefixcounter\plusone
918 \edef\referenceprefix{\the\prefixcounter}
919 \else\ifx\p_prefix\m_strc_references_prefix_nop
920 \letreferencingparameter\c!prefix\s!unknown
921 \let\referenceprefix\empty
922 \else\ifx\p_prefix\s!unknown
923
924 \else
925 \let\referenceprefix\p_prefix
926 \fi\fi\fi\fi}
927
928\appendtoks
929 \setupreferenceprefix[\referencingparameter\c!prefix]
930\to \everysetupreferencing
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972\appendtoks
973 \ifdefined\in \let\normalmathin \in \unexpanded\def\in {\mathortext\normalmathin \strc_references_in } \else \let\in \strc_references_in \fi
974 \ifdefined\at \let\normalmathat \at \unexpanded\def\at {\mathortext\normalmathat \strc_references_at } \else \let\at \strc_references_at \fi
975 \ifdefined\about \let\normalmathabout\about \unexpanded\def\about{\mathortext\normalmathabout\strc_references_about} \else \let\about\strc_references_about \fi
976 \ifdefined\from \let\normalmathfrom \from \unexpanded\def\from {\mathortext\normalmathfrom \strc_references_from } \else \let\from \strc_references_from \fi
977 \ifdefined\over \let\normalmathover \over \unexpanded\def\over {\mathortext\normalmathover \strc_references_about} \else \let\over \strc_references_about \fi
978\to \everydump
979
980 \def\filterreference #key{\clf_filterreference{#key}}
981\unexpanded\def\getreferenceentry#key{\clf_filterreference{#key}}
982
983\def\currentreferencenumber {\clf_filterreference{number}}
984\def\currentreferencepage {\clf_filterreference{page}}
985\def\currentreferencetitle {\clf_filterreference{title}}
986\def\currentreferencetext {\clf_filterreference{text}}
987\def\currentreferencedefault {\clf_filterreference{default}}
988\def\currentreferencerealpage{\clf_filterreference{realpage}}
989
990
991
992\unexpanded\def\getreference
993 {\dodoubleargument\strc_references_get_reference}
994
995\def\strc_references_get_reference[#key][#label]
996 {\ifsecondargument
997 \doifelsereferencefound{#label}{\clf_filterreference{#key}}\strc_references_dummy
998 \else
999 \strc_references_dummy
1000 \fi}
1001
1002\let\ref\getreference
1003
1004
1005
1006\unexpanded\def\strc_references_about[#label]
1007 {\dontleavehmode
1008 \begingroup
1009 \enforced\let\crlf\space
1010 \enforced\let\\\space
1011 \postponenotes
1012 \referencingparameter\c!left
1013 \doifelsereferencefound{#label}
1014 {\goto{\limitatetext\currentreferencetitle{\referencingparameter\c!width}\unknown}[#label]}
1015 {}
1016 \flushnotes
1017 \referencingparameter\c!right
1018 \endgroup}
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063\newcount \nofreferencestates
1064\newconditional\pagestatespread
1065
1066\appendtoks
1067 \doifelse{\referencingparameter\c!doublesided}\v!yes\settrue\setfalse\pagestatespread
1068\to \everysetupreferencing
1069
1070\setupreferencing
1071 [\c!doublesided=\v!yes]
1072
1073\def\referencepagestate
1074 {\numexpr\clf_referencepagestate
1075 {rst::\number\nofreferencestates}
1076 \relax}
1077
1078\def\referencepagedetail
1079 {\numexpr\clf_referencepagedetail
1080 {rst::\number\nofreferencestates}
1081 true
1082 \ifconditional\pagestatespread false\ifdoublesided true\else false\fi\fi
1083 \relax}
1084
1085\def\referencerealpage
1086 {\clf_referencerealpage}
1087
1088\def\referencecolumnnumber
1089 {\clf_referencecolumn}
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106\unexpanded\def\tracedpagestate
1107 {{\blue\tttf(\ifcase\referencepagedetail unknown\or same\or previous\or next\or above\or below\else unknown\fi)}}
1108
1109\unexpanded\def\markreferencepage
1110 {\dontleavehmode\begingroup
1111 \iftrialtypesetting
1112
1113 \else
1114
1115 \global\advance\nofreferencestates\plusone
1116 \xypos{rst::\number\nofreferencestates}
1117
1118 \fi
1119 \endgroup}
1120
1121\unexpanded\def\doifcheckedpagestate#label
1122 {\doifelsereferencefound{#label}\strc_references_handle_page_state_yes\strc_references_handle_page_state_nop}
1123
1124\let\strc_references_handle_page_state_nop\sixthofsixarguments
1125
1126\def\strc_references_handle_page_state_yes
1127 {\markreferencepage
1128 \ifcase\referencepagedetail\relax
1129 \expandafter\sixthofsixarguments \or
1130 \expandafter\thirdofsixarguments \or
1131 \expandafter\firstofsixarguments \or
1132 \expandafter\fifthofsixarguments \or
1133 \expandafter\secondofsixarguments\or
1134 \expandafter\fourthofsixarguments\else
1135 \expandafter\sixthofsixarguments \fi}
1136
1137\unexpanded\def\referencesymbol
1138 {\hpack\bgroup
1139 \strut
1140 \markreferencepage
1141 \high
1142 {\setupsymbolset[\interactionparameter\c!symbolset]
1143 \symbol[\ifcase\referencepagedetail\v!somewhere\or\v!nowhere\or\v!previous\or\v!next\or\v!previous\or\v!next\else\v!somewhere\fi]}
1144 \egroup}
1145
1146
1147
1148
1149\unexpanded\def\somewhere#backward#foreward#dummy[#label]
1150 {\doifcheckedpagestate{#label}
1151 {\goto{#backward}[#label]}
1152 {\goto{#backward}[#label]}
1153 {\ignorespaces}
1154 {\goto{#foreward}[#label]}
1155 {\goto{#foreward}[#label]}
1156 {#label}}
1157
1158\unexpanded\def\someplace#preceding#backward#current#foreward#following#dummy[#label]
1159 {\doifcheckedpagestate{#label}
1160 {\doifelsenothing{#preceding}{\goto{#preceding}[#label]}\ignorespaces}
1161 {\doifelsenothing {#backward}{\goto {#backward}[#label]}\ignorespaces}
1162 {\doifelsenothing {#current}{\goto {#current}[#label]}\ignorespaces}
1163 {\doifelsenothing {#foreward}{\goto {#foreward}[#label]}\ignorespaces}
1164 {\doifelsenothing{#following}{\goto{#following}[#label]}\ignorespaces}
1165 {#label}}
1166
1167\unexpanded\def\atpage[#label]
1168 {\doifcheckedpagestate{#label}
1169 {\goto{\labeltext\v!precedingpage}[#label]}
1170 {\goto{\labeltext\v!hencefore}[#label]}
1171 {\ignorespaces}
1172 {\goto{\labeltext\v!hereafter}[#label]}
1173 {\goto{\labeltext\v!followingpage}[#label]}
1174 {\goto{\labeltexts\v!page\strc_references_dummy}[#label]}}
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197\def\symbolreference[#label]
1198 {\goto{\referencesymbol}[#label]}
1199
1200
1201
1202\newtoks\leftreferencetoks
1203\newtoks\rightreferencetoks
1204\newtoks\defaultleftreferencetoks
1205\newtoks\defaultrightreferencetoks
1206
1207
1208\let\rightofreferencecontent \empty
1209\let\leftofreference \empty
1210\let\rightofreference \empty
1211
1212\unexpanded\def\leftofreferencecontent
1213 {\removeunwantedspaces
1214 \nonbreakablespace
1215 \ignorespaces}
1216
1217\installcorenamespace{referencinginteraction}
1218
1219\def\strc_references_interaction_all
1220 {\the\leftreferencetoks
1221 \doifelsesometoks\leftreferencetoks \leftofreferencecontent \donothing
1222 \leftofreference
1223 \doifelsesometoks\leftreferencetoks\onlynonbreakablespace\relax
1224 \currentreferencecontent
1225 \rightofreference
1226 \doifelsesometoks\rightreferencetoks\rightofreferencecontent\donothing
1227 \the\rightreferencetoks}
1228
1229\letvalue{\??referencinginteraction\v!all}\strc_references_interaction_all
1230
1231\setvalue{\??referencinginteraction\v!label}
1232 {\leftofreference
1233 \the\leftreferencetoks
1234 \the\rightreferencetoks
1235 \rightofreference}
1236
1237\setvalue{\??referencinginteraction\v!text}
1238 {\leftofreference
1239 \currentreferencecontent
1240 \rightofreference}
1241
1242\setvalue{\??referencinginteraction\v!symbol}
1243 {\referencesymbol}
1244
1245\def\referencesequence
1246 {\ifcsname\??referencinginteraction\referencingparameter\c!interaction\endcsname
1247 \expandafter\lastnamedcs
1248 \else
1249 \expandafter\strc_references_interaction_all
1250 \fi}
1251
1252\newtoks\everyresetinatreference
1253
1254\appendtoks
1255 \glet\leftofreference \relax
1256 \glet\rightofreference\relax
1257\to \everyresetinatreference
1258
1259\def\strc_references_start_goto
1260 {\dontleavehmode
1261 \begingroup}
1262
1263\def\strc_references_stop_goto
1264 {\the\everyresetinatreference
1265 \endgroup}
1266
1267\def\strc_references_pickup_goto
1268 {\dodoublegroupempty\strc_references_pickup_goto_indeed}
1269
1270\def\strc_references_pickup_goto_indeed#left#right#dummy[#label]
1271 {\leftreferencetoks
1272 \iffirstargument
1273 {#left}
1274 \else
1275 \defaultleftreferencetoks
1276 \let\leftofreferencecontent\empty
1277 \fi
1278 \rightreferencetoks
1279 \ifsecondargument
1280 {#right}
1281 \else
1282 \defaultrightreferencetoks
1283 \let\rightofreferencecontent\empty
1284 \fi
1285
1286 \doifelsereferencefound{#label}
1287 {\goto{\referencesequence}[#label]}
1288 {\let\currentreferencecontent\strc_references_dummy
1289 \goto{\referencesequence}[#label]}
1290 \strc_references_stop_goto}
1291
1292\unexpanded\def\strc_references_in
1293 {\strc_references_start_goto
1294 \let\currentreferencecontent\currentreferencedefault
1295 \strc_references_pickup_goto}
1296
1297\unexpanded\def\strc_references_at
1298 {\strc_references_start_goto
1299 \let\currentreferencecontent\currentreferencepage
1300 \strc_references_pickup_goto}
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344\installcorenamespace{referenceformat}
1345
1346\installcommandhandler \??referenceformat {referenceformat} \??referenceformat
1347
1348\appendtoks
1349 \setuevalue\currentreferenceformat{\strc_references_apply_format{\currentreferenceformat}}
1350\to \everydefinereferenceformat
1351
1352\setupreferenceformat
1353 [\c!left=,
1354 \c!right=,
1355 \c!text=,
1356 \c!label=,
1357 \c!autocase=\v!no,
1358 \c!style=,
1359 \c!type=default,
1360 \c!setups=,
1361 \c!color=]
1362
1363\unexpanded\def\strc_references_apply_format#name
1364 {\strc_references_start_goto
1365 \edef\currentreferenceformat{#name}
1366 \gdef\leftofreference {\referenceformatparameter\c!left }
1367 \gdef\rightofreference {\referenceformatparameter\c!right }
1368 \edef\currentreferenceformatlabel {\referenceformatparameter\c!label }
1369 \edef\currentreferenceformattype {\referenceformatparameter\c!type }
1370 \edef\currentreferenceformatsetups {\referenceformatparameter\c!setups }
1371 \edef\currentreferenceformatautocase{\referenceformatparameter\c!autocase}
1372 \usereferenceformatstyleandcolor\c!style\c!color
1373 \ifx\currentstyleparameter\empty \else
1374 \resetinteractionparameter\c!style
1375 \fi
1376 \ifx\currentcolorparameter\empty \else
1377 \resetinteractionparameter\c!contrastcolor
1378 \resetinteractionparameter\c!color
1379 \fi
1380 \ifx\currentreferenceformatlabel\autoreferencelabeltextflag
1381 \edef\currentreferenceformatlabel{\autoreferencelabeltext}
1382 \fi
1383 \ifx\currentreferenceformatautocase\v!yes
1384 \setcharactercleaning[1]
1385 \fi
1386 \ifx\currentreferenceformatlabel\empty
1387 \defaultleftreferencetoks {\referenceformatparameter\c!text}
1388 \defaultrightreferencetoks\emptytoks
1389 \else
1390 \defaultleftreferencetoks {\leftlabeltext \currentreferenceformatlabel}
1391 \defaultrightreferencetoks{\rightlabeltext\currentreferenceformatlabel}
1392 \fi
1393 \ifx\currentreferenceformattype\empty
1394 \def\currentreferenceformattype{default}
1395 \fi
1396
1397 \ifx\currentreferenceformatsetups\empty
1398 \def\currentreferencecontent{\filterreference\currentreferenceformattype}
1399 \else
1400 \def\currentreferencecontent{\directsetup\currentreferenceformatsetups}
1401 \fi
1402
1403 \let\leftofreferencecontent \empty
1404 \let\rightofreferencecontent\empty
1405 \strc_references_pickup_goto}
1406
1407\def\autoreferencelabeltextflag{*}
1408
1409\unexpanded\def\autoreferencelabeltext
1410 {\clf_getcurrentreferencemetadata{name}}
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449\newconditional\uselocationstrut \settrue\uselocationstrut
1450
1451\def\extrareferencearguments
1452 {highlight \luaconditional\highlighthyperlinks\space
1453 newwindow \luaconditional\gotonewwindow\space
1454 layer {\currentviewerlayer}}
1455
1456\unexpanded\def\directgoto
1457 {\ifconditional\uselocationstrut
1458 \expandafter\strc_references_direct_goto
1459 \else
1460 \expandafter\strc_references_direct_goto_htdp
1461 \fi}
1462
1463\unexpanded\def\goto
1464 {\ifconditional\uselocationstrut
1465 \expandafter\strc_references_goto
1466 \else
1467 \expandafter\strc_references_goto_htdp
1468 \fi}
1469
1470
1471
1472
1473\newcount\lastsavedreferenceattribute
1474
1475\newbox\referencebox
1476
1477\def\revivesavedreferenceattribute
1478 {\c_attr_reference\lastsavedreferenceattribute}
1479
1480\def\strc_references_direct_goto#content[#label]
1481 {\dontleavehmode
1482 \begingroup
1483 \c_attr_reference\attributeunsetvalue
1484 \global\lastsavedreferenceattribute\attributeunsetvalue
1485 \iflocation
1486 \clf_injectreference
1487 {\referenceprefix}
1488 {#label}
1489 {
1490 height \ht\strutbox
1491 depth \dp\strutbox
1492 \extrareferencearguments
1493 }
1494 \relax
1495 \setlocationattributes
1496 \setstrut
1497 \global\lastsavedreferenceattribute\lastreferenceattribute
1498 \c_attr_reference\lastreferenceattribute
1499 \dostarttagged\t!link\empty
1500 #content
1501 \dostoptagged
1502 \else
1503 #content
1504 \fi
1505 \endgroup}
1506
1507\def\strc_references_direct_goto_htdp#content[#label]
1508 {\dontleavehmode
1509 \begingroup
1510 \global\lastsavedreferenceattribute\attributeunsetvalue
1511 \c_attr_reference\attributeunsetvalue
1512 \iflocation
1513 \clf_injectreference
1514 {\referenceprefix}
1515 {#label}
1516 {
1517 height \dimexpr\interactionparameter\c!height\relax
1518 depth \dimexpr\interactionparameter\c!depth \relax
1519 \extrareferencearguments
1520 }
1521 \relax
1522 \setlocationattributes
1523 \c_attr_reference\lastreferenceattribute
1524 \global\lastsavedreferenceattribute\lastreferenceattribute
1525 \dostarttagged\t!link\empty
1526 #content
1527 \dostoptagged
1528 \else
1529 #content
1530 \fi
1531 \endgroup}
1532
1533\def\strc_references_goto#content#dummy[#label]
1534 {\dontleavehmode
1535 \begingroup
1536
1537 \global\lastsavedreferenceattribute\attributeunsetvalue
1538 \c_attr_reference\attributeunsetvalue
1539 \iflocation
1540 \clf_doifelsereference{\referenceprefix}{#label}{\extrareferencearguments}
1541 {\expandtexincurrentreference
1542 \clf_injectcurrentreferencehtdp
1543 \ht\strutbox
1544 \dp\strutbox
1545 \relax
1546 \setlocationattributes
1547 \setstrut
1548 \global\lastsavedreferenceattribute\lastreferenceattribute
1549 \c_attr_reference\lastreferenceattribute
1550 \dostarttagged\t!link\empty
1551 #content
1552 \dostoptagged}
1553 {#content}
1554 \else
1555 #content
1556 \fi
1557
1558 \endgroup}
1559
1560\def\strc_references_goto_internal#content#dummy[#internal]
1561 {\dontleavehmode
1562 \begingroup
1563 \global\lastsavedreferenceattribute\attributeunsetvalue
1564 \c_attr_reference\attributeunsetvalue
1565 \iflocation
1566 \setstrut
1567 \strc_references_get_simple_reference{#internal}
1568 \global\lastsavedreferenceattribute\currentreferenceattribute
1569 \c_attr_reference\currentreferenceattribute
1570 \setlocationattributes
1571 \dostarttagged\t!link\empty
1572 #content
1573 \dostoptagged
1574 \else
1575 #content
1576 \fi
1577 \endgroup}
1578
1579\unexpanded\def\startgoto[#label]
1580 {\dontleavehmode
1581 \begingroup
1582 \iflocation
1583 \clf_doifelsereference{\referenceprefix}{#label}{\extrareferencearguments}
1584 {\expandafter\strc_references_start_goto_yes}
1585 {\expandafter\strc_references_start_goto_nop}
1586 \else
1587 \expandafter\strc_references_start_goto_nop
1588 \fi}
1589
1590\unexpanded\def\strc_references_start_goto_nop
1591 {\let\stopgoto\strc_references_stop_goto_nop}
1592
1593\unexpanded\def\strc_references_stop_goto_nop
1594 {\endgroup}
1595
1596\unexpanded\def\strc_references_start_goto_yes
1597 {\expandtexincurrentreference
1598 \clf_injectcurrentreferencehtdp
1599 \ht\strutbox
1600 \dp\strutbox
1601 \relax
1602 \setlocationattributes
1603 \setstrut
1604 \global\lastsavedreferenceattribute\lastreferenceattribute
1605 \c_attr_reference\lastreferenceattribute
1606 \dostarttagged\t!link\empty
1607 \let\stopgoto\strc_references_stop_goto_yes}
1608
1609\unexpanded\def\strc_references_stop_goto_yes
1610 {\dostoptagged
1611 \endgroup}
1612
1613\def\strc_references_goto_htdp#content#dummy[#label]
1614 {\dontleavehmode
1615 \begingroup
1616 \global\lastsavedreferenceattribute\attributeunsetvalue
1617 \c_attr_reference\attributeunsetvalue
1618 \iflocation
1619 \clf_doifelsereference{\referenceprefix}{#label}{\extrareferencearguments}
1620 {\expandtexincurrentreference
1621 \clf_injectcurrentreferencehtdp
1622 \dimexpr\interactionparameter\c!height\relax
1623 \dimexpr\interactionparameter\c!depth \relax
1624 \relax
1625 \setlocationattributes
1626 \global\lastsavedreferenceattribute\lastreferenceattribute
1627 \c_attr_reference\lastreferenceattribute
1628 \dostarttagged\t!link\empty
1629 #content
1630 \dostoptagged}
1631 {#content}
1632 \else
1633 #content
1634 \fi
1635 \endgroup}
1636
1637\unexpanded\def\directgotobox#content[#label]
1638 {\dontleavehmode
1639 \begingroup
1640 \global\lastsavedreferenceattribute\attributeunsetvalue
1641 \c_attr_reference\attributeunsetvalue
1642 \iflocation
1643 \clf_injectreference
1644 {\referenceprefix}
1645 {#label}
1646 {\extrareferencearguments}
1647 \relax
1648 \setlocationattributes
1649 \global\lastsavedreferenceattribute\lastreferenceattribute
1650 \dostarttagged\t!link\empty
1651 \hbox attr \referenceattribute \lastreferenceattribute {#content}
1652 \dostoptagged
1653 \else
1654 #content
1655 \fi
1656 \endgroup}
1657
1658\unexpanded\def\directgotospecbox#resolver#content[#label]
1659 {\dontleavehmode
1660 \begingroup
1661 \global\lastsavedreferenceattribute\attributeunsetvalue
1662 \c_attr_reference\attributeunsetvalue
1663 \iflocation
1664 \clf_injectreference
1665 {\referenceprefix}
1666 {#label}
1667 {\extrareferencearguments}
1668 \relax
1669 \setlocationcolorspec{#resolver}
1670 \global\lastsavedreferenceattribute\lastreferenceattribute
1671 \dostarttagged\t!link\empty
1672 \hbox attr \referenceattribute \lastreferenceattribute {#content}
1673 \dostoptagged
1674 \else
1675 #content
1676 \fi
1677 \endgroup}
1678
1679\unexpanded\def\directgotodumbbox#content[#label]
1680 {\dontleavehmode
1681 \begingroup
1682 \global\lastsavedreferenceattribute\attributeunsetvalue
1683 \c_attr_reference\attributeunsetvalue
1684 \iflocation
1685 \clf_injectreference
1686 {\referenceprefix}
1687 {#label}
1688 {\extrareferencearguments}
1689 \relax
1690 \global\lastsavedreferenceattribute\lastreferenceattribute
1691 \dostarttagged\t!link\empty
1692 \hbox attr \referenceattribute \lastreferenceattribute {#content}
1693 \dostoptagged
1694 \else
1695 #content
1696 \fi
1697 \endgroup}
1698
1699\unexpanded\def\gotobox#content[#label]
1700 {\dontleavehmode
1701 \begingroup
1702 \global\lastsavedreferenceattribute\attributeunsetvalue
1703 \c_attr_reference\attributeunsetvalue
1704 \iflocation
1705 \clf_doifelsereference{\referenceprefix}{#label}{\extrareferencearguments}
1706 {\expandtexincurrentreference
1707 \clf_injectcurrentreference
1708 \setlocationattributes
1709 \global\lastsavedreferenceattribute\lastreferenceattribute
1710 \dostarttagged\t!link\empty
1711 \hbox attr \referenceattribute \lastreferenceattribute {#content}
1712 \dostoptagged}
1713 {#content}
1714 \else
1715 #content
1716 \fi
1717 \endgroup}
1718
1719\unexpanded\def\gotowdhtbox#width#height[#label]
1720 {\dontleavehmode
1721 \begingroup
1722 \setbox\scratchbox\emptyhbox
1723 \wd\scratchbox#width
1724 \ht\scratchbox#height
1725 \global\lastsavedreferenceattribute\attributeunsetvalue
1726 \c_attr_reference\attributeunsetvalue
1727 \clf_doifelsereference{\referenceprefix}{#label}{\extrareferencearguments}
1728 {\clf_injectcurrentreference
1729 \global\lastsavedreferenceattribute\lastreferenceattribute
1730 \hpack attr \referenceattribute \lastreferenceattribute {\box\scratchbox}}
1731 {\box\scratchbox}
1732 \endgroup}
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780\unexpanded\def\useurl {\doquadrupleempty\strc_references_use_url }
1781\unexpanded\def\usefile{\dotripleargument\strc_references_use_file}
1782
1783\let\useURL \useurl
1784\let\useexternaldocument\usefile
1785
1786\def\strc_references_use_url[#label][#url][#file][#description]
1787 {\clf_useurl{#label}{\detokenize{#url}}{\detokenize{#file}}{\detokenize{#description}}}
1788
1789\def\strc_references_use_file[#label][#file][#description]
1790 {\clf_usefile{#label}{\detokenize{#file}}{\detokenize{#description}}}
1791
1792\def\doifelseurldefined #label{\clf_doifelseurldefined {#label}}
1793\def\doifelsefiledefined#label{\clf_doifelsefiledefined{#label}}
1794
1795\let\doifurldefinedelse \doifelseurldefined
1796\let\doiffiledefinedelse\doifelsefiledefined
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814\installcorenamespace{url}
1815
1816\installdirectcommandhandler \??url {url}
1817
1818\setupurl
1819 [\c!style=\v!type,
1820 \c!color=]
1821
1822\unexpanded\def\url[#label]
1823 {\dontleavehmode
1824 \begingroup
1825 \useurlstyleandcolor\c!style\c!color
1826 \hyphenatedurl{\clf_geturl{#label}}
1827 \endgroup}
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851\unexpanded\def\strc_references_from
1852 {\dosingleempty\strc_references_do_special_from}
1853
1854\def\strc_references_do_special_from[#label]
1855 {\dontleavehmode
1856 \goto{\clf_from{#label}}[fileorurl(#label)]}
1857
1858\def\dofromurldescription#content
1859 {#content}
1860
1861\def\dofromurlliteral#content
1862 {\useurlstyleandcolor\c!style\c!color
1863 \hyphenatedurl{#content}}
1864
1865\let\dofromfiledescription\dofromurldescription
1866\let\dofromfileliteral \dofromurlliteral
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892\installcorenamespace{programs}
1893
1894\installdirectcommandhandler \??programs {programs}
1895
1896\unexpanded\def\defineprogram
1897 {\dotripleargument\strc_references_define_program}
1898
1899\def\strc_references_define_program[#name][#program][#description]
1900 {\clf_defineprogram{#name}{#program}{#description}}
1901
1902\unexpanded\def\program[#name]
1903 {\dontleavehmode
1904 \begingroup
1905 \useprogramsstyleandcolor\c!style\c!color
1906 \clf_getprogram{#name}
1907 \endgroup}
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940\unexpanded\def\definepage
1941 {\dodoubleargument\strc_references_define_page}
1942
1943\def\strc_references_define_page[#name][#target]
1944 {\definereference[#name][page(#target)]}
1945
1946\def\gotopage#text[#target]
1947 {\goto{#text}[\v!page(#target)]}
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970\def\coupledocument
1971 {\doquadrupleempty\strc_references_couple_document}
1972
1973\def\strc_references_couple_document[#name][#file][#sections][#description]
1974 {\ifthirdargument
1975
1976 \fi}
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990\unexpanded\def\dotextprefix#text
1991 {\begingroup
1992 \setbox\scratchbox\hbox{#text}
1993 \ifdim\wd\scratchbox>\zeropoint
1994 \unhbox\scratchbox
1995 \edef\p_separator{\referencingparameter\c!separator}
1996 \ifx\p_separator\empty \else
1997 \removeunwantedspaces
1998 \p_separator
1999 \fi
2000 \else
2001 \unhbox\scratchbox
2002 \fi
2003 \endgroup}
2004
2005
2006
2007
2008\setupreferencing
2009 [\c!state=\v!start,
2010 \c!autofile=\v!no,
2011 \v!part\c!number=\v!yes,
2012 \v!chapter\c!number=\v!no,
2013 \c!interaction=\v!all,
2014 \c!convertfile=\v!no,
2015
2016 \c!prefix=,
2017 \c!width=.75\makeupwidth,
2018 \c!left=\quotation\bgroup,
2019 \c!right=\egroup,
2020 \c!global=\v!no,
2021 \c!expansion=\v!no,
2022 \c!separator=\nonbreakablespace,
2023 \c!export=\v!no]
2024
2025\setupprograms
2026 [\c!directory=,
2027 \c!style=\v!type,
2028 \c!color=]
2029
2030\definereference [\v!CloseDocument ] [action(close)]
2031\definereference [\v!ExitViewer ] [action(exit)]
2032\definereference [\v!FirstPage ] [action(first)]
2033\definereference [\v!LastPage ] [action(last)]
2034\definereference [\v!NextJump ] [action(forward)]
2035\definereference [\v!NextPage ] [action(next)]
2036\definereference [\v!PauseMovie ] [action(pausemovie)]
2037\definereference [\v!PauseSound ] [action(pausesound)]
2038\definereference [\v!PauseRendering ] [action(pauserendering)]
2039\definereference [\v!PreviousJump ] [action(backward)]
2040\definereference [\v!PreviousPage ] [action(previous)]
2041\definereference [\v!PrintDocument ] [action(print)]
2042\definereference [\v!SaveForm ] [action(exportform)]
2043\definereference [\v!LoadForm ] [action(importform)]
2044\definereference [\v!ResetForm ] [action(resetform)]
2045\definereference [\v!ResumeMovie ] [action(resumemovie)]
2046\definereference [\v!ResumeSound ] [action(resumesound)]
2047\definereference [\v!ResumeRendering ] [action(resumerendering)]
2048\definereference [\v!SaveDocument ] [action(save)]
2049\definereference [\v!SaveNamedDocument] [action(savenamed)]
2050\definereference [\v!OpenNamedDocument] [action(opennamed)]
2051\definereference [\v!SearchDocument ] [action(search)]
2052\definereference [\v!SearchAgain ] [action(searchagain)]
2053\definereference [\v!StartMovie ] [action(startmovie)]
2054\definereference [\v!StartSound ] [action(startsound)]
2055\definereference [\v!StartRendering ] [action(startrendering)]
2056\definereference [\v!StopMovie ] [action(stopmovie)]
2057\definereference [\v!StopSound ] [action(stopsound)]
2058\definereference [\v!StopRendering ] [action(stoprendering)]
2059\definereference [\v!SubmitForm ] [action(submitform)]
2060\definereference [\v!ToggleViewer ] [action(toggle)]
2061\definereference [\v!ViewerHelp ] [action(help)]
2062\definereference [\v!HideField ] [action(hide)]
2063\definereference [\v!ShowField ] [action(show)]
2064\definereference [\v!GotoPage ] [action(gotopage)]
2065\definereference [\v!Query ] [action(query)]
2066\definereference [\v!QueryAgain ] [action(queryagain)]
2067\definereference [\v!FitWidth ] [action(fitwidth)]
2068\definereference [\v!FitHeight ] [action(fitheight)]
2069\definereference [\v!ShowThumbs ] [action(thumbnails)]
2070\definereference [\v!ShowBookmarks ] [action(bookmarks)]
2071
2072\definereference [\v!HideLayer ] [action(hidelayer)]
2073\definereference [\v!VideLayer ] [action(videlayer)]
2074\definereference [\v!ToggleLayer ] [action(togglelayer)]
2075
2076\definereference [\v!firstpage] [page(firstpage)]
2077\definereference [\v!previouspage] [page(previouspage)]
2078\definereference [\v!nextpage] [page(nextpage)]
2079\definereference [\v!lastpage] [page(lastpage)]
2080\definereference [\v!forward] [page(forward)]
2081\definereference [\v!backward] [page(backward)]
2082\definereference [\v!firstsubpage] [page(firstsubpage)]
2083\definereference [\v!previoussubpage] [page(previoussubpage)]
2084\definereference [\v!nextsubpage] [page(nextsubpage)]
2085\definereference [\v!lastsubpage] [page(lastsubpage)]
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122\installcorenamespace{referencingprefix}
2123
2124\def\getreferencestructureprefix#kind#name#category
2125 {{
2126 prefix {\referencestructureprefixparameter{#kind}{#name}{#category}\c!prefix}
2127 separatorset {\referencestructureprefixparameter{#kind}{#name}{#category}\c!prefixseparatorset}
2128 conversion {\referencestructureprefixparameter{#kind}{#name}{#category}\c!prefixconversion}
2129 conversionset {\referencestructureprefixparameter{#kind}{#name}{#category}\c!prefixconversionset}
2130 starter {\referencestructureprefixparameter{#kind}{#name}{#category}\c!prefixstarter}
2131 stopper {\referencestructureprefixparameter{#kind}{#name}{#category}\c!prefixstopper}
2132 set {\referencestructureprefixparameter{#kind}{#name}{#category}\c!prefixset}
2133 segments {\referencestructureprefixparameter{#kind}{#name}{#category}\c!prefixsegments}
2134 connector {\referencestructureprefixparameter{#kind}{#name}{#category}\c!prefixconnector}
2135 }
2136 {
2137 separatorset {\referencestructureprefixparameter{#kind}{#name}{#category}\c!numberseparatorset}
2138 conversion {\referencestructureprefixparameter{#kind}{#name}{#category}\c!numberconversion}
2139 conversionset {\referencestructureprefixparameter{#kind}{#name}{#category}\c!numberconversionset}
2140 starter {\referencestructureprefixparameter{#kind}{#name}{#category}\c!numberstarter}
2141 stopper {\referencestructureprefixparameter{#kind}{#name}{#category}\c!numberstopper}
2142 segments {\referencestructureprefixparameter{#kind}{#name}{#category}\c!numbersegments}
2143 }}
2144
2145\unexpanded\def\setupreferencestructureprefix
2146 {\dotripleempty\strc_references_setup_reference_structure_prefix}
2147
2148\def\strc_references_setup_reference_structure_prefix[#kind][#category][#settings]
2149 {\ifthirdargument
2150 \getparameters[\??referencingprefix#kind:#category][#settings]
2151 \else\ifsecondargument
2152 \getparameters[\??referencingprefix:#kind][#category]
2153 \fi\fi}
2154
2155\def\referencestructureprefixparameter#kind#name#category#parameter
2156 {\ifcsname\??referencingprefix#name:#category#parameter\endcsname
2157 \lastnamedcs
2158 \else\ifcsname\??referencingprefix#kind:#category#parameter\endcsname
2159 \lastnamedcs
2160 \else\ifcsname\??referencingprefix:#category#parameter\endcsname
2161 \lastnamedcs
2162 \fi\fi\fi}
2163
2164\def\currentreferencedefault
2165 {\normalexpanded{\noexpand\clf_filterdefaultreference
2166 {\s!default}
2167 \noexpand\getreferencestructureprefix\clf_getcurrentprefixspec{\s!default}
2168 \relax}}
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214\protect \endinput
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235 |