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 \def\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\def\autoreferencelabeltext
1410
1411 {\clf_getcurrentreferencelabel}
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
1450\newconditional\uselocationstrut \settrue\uselocationstrut
1451
1452\def\extrareferencearguments
1453 {highlight \luaconditional\highlighthyperlinks\space
1454 newwindow \luaconditional\gotonewwindow\space
1455 layer {\currentviewerlayer}}
1456
1457\unexpanded\def\directgoto
1458 {\ifconditional\uselocationstrut
1459 \expandafter\strc_references_direct_goto
1460 \else
1461 \expandafter\strc_references_direct_goto_htdp
1462 \fi}
1463
1464\unexpanded\def\goto
1465 {\ifconditional\uselocationstrut
1466 \expandafter\strc_references_goto
1467 \else
1468 \expandafter\strc_references_goto_htdp
1469 \fi}
1470
1471
1472
1473
1474\newcount\lastsavedreferenceattribute
1475
1476\newbox\referencebox
1477
1478\def\revivesavedreferenceattribute
1479 {\c_attr_reference\lastsavedreferenceattribute}
1480
1481\def\strc_references_direct_goto#content[#label]
1482 {\dontleavehmode
1483 \begingroup
1484 \c_attr_reference\attributeunsetvalue
1485 \global\lastsavedreferenceattribute\attributeunsetvalue
1486 \iflocation
1487 \clf_injectreference
1488 {\referenceprefix}
1489 {#label}
1490 {
1491 height \ht\strutbox
1492 depth \dp\strutbox
1493 \extrareferencearguments
1494 }
1495 \relax
1496 \setlocationattributes
1497 \setstrut
1498 \global\lastsavedreferenceattribute\lastreferenceattribute
1499 \c_attr_reference\lastreferenceattribute
1500 \dostarttagged\t!link\empty
1501 #content
1502 \dostoptagged
1503 \else
1504 #content
1505 \fi
1506 \endgroup}
1507
1508\def\strc_references_direct_goto_htdp#content[#label]
1509 {\dontleavehmode
1510 \begingroup
1511 \global\lastsavedreferenceattribute\attributeunsetvalue
1512 \c_attr_reference\attributeunsetvalue
1513 \iflocation
1514 \clf_injectreference
1515 {\referenceprefix}
1516 {#label}
1517 {
1518 height \dimexpr\interactionparameter\c!height\relax
1519 depth \dimexpr\interactionparameter\c!depth \relax
1520 \extrareferencearguments
1521 }
1522 \relax
1523 \setlocationattributes
1524 \c_attr_reference\lastreferenceattribute
1525 \global\lastsavedreferenceattribute\lastreferenceattribute
1526 \dostarttagged\t!link\empty
1527 #content
1528 \dostoptagged
1529 \else
1530 #content
1531 \fi
1532 \endgroup}
1533
1534\def\strc_references_goto#content#dummy[#label]
1535 {\dontleavehmode
1536 \begingroup
1537
1538 \global\lastsavedreferenceattribute\attributeunsetvalue
1539 \c_attr_reference\attributeunsetvalue
1540 \iflocation
1541 \clf_doifelsereference{\referenceprefix}{#label}{\extrareferencearguments}
1542 {\expandtexincurrentreference
1543 \clf_injectcurrentreferencehtdp
1544 \ht\strutbox
1545 \dp\strutbox
1546 \relax
1547 \setlocationattributes
1548 \setstrut
1549 \global\lastsavedreferenceattribute\lastreferenceattribute
1550 \c_attr_reference\lastreferenceattribute
1551 \dostarttagged\t!link\empty
1552 #content
1553 \dostoptagged}
1554 {#content}
1555 \else
1556 #content
1557 \fi
1558
1559 \endgroup}
1560
1561\def\strc_references_goto_internal#content#dummy[#internal]
1562 {\dontleavehmode
1563 \begingroup
1564 \global\lastsavedreferenceattribute\attributeunsetvalue
1565 \c_attr_reference\attributeunsetvalue
1566 \iflocation
1567 \setstrut
1568 \strc_references_get_simple_reference{#internal}
1569 \global\lastsavedreferenceattribute\currentreferenceattribute
1570 \c_attr_reference\currentreferenceattribute
1571 \setlocationattributes
1572 \dostarttagged\t!link\empty
1573 #content
1574 \dostoptagged
1575 \else
1576 #content
1577 \fi
1578 \endgroup}
1579
1580\unexpanded\def\startgoto[#label]
1581 {\dontleavehmode
1582 \begingroup
1583 \iflocation
1584 \clf_doifelsereference{\referenceprefix}{#label}{\extrareferencearguments}
1585 {\expandafter\strc_references_start_goto_yes}
1586 {\expandafter\strc_references_start_goto_nop}
1587 \else
1588 \expandafter\strc_references_start_goto_nop
1589 \fi}
1590
1591\unexpanded\def\strc_references_start_goto_nop
1592 {\let\stopgoto\strc_references_stop_goto_nop}
1593
1594\unexpanded\def\strc_references_stop_goto_nop
1595 {\endgroup}
1596
1597\unexpanded\def\strc_references_start_goto_yes
1598 {\expandtexincurrentreference
1599 \clf_injectcurrentreferencehtdp
1600 \ht\strutbox
1601 \dp\strutbox
1602 \relax
1603 \setlocationattributes
1604 \setstrut
1605 \global\lastsavedreferenceattribute\lastreferenceattribute
1606 \c_attr_reference\lastreferenceattribute
1607 \dostarttagged\t!link\empty
1608 \let\stopgoto\strc_references_stop_goto_yes}
1609
1610\unexpanded\def\strc_references_stop_goto_yes
1611 {\dostoptagged
1612 \endgroup}
1613
1614\def\strc_references_goto_htdp#content#dummy[#label]
1615 {\dontleavehmode
1616 \begingroup
1617 \global\lastsavedreferenceattribute\attributeunsetvalue
1618 \c_attr_reference\attributeunsetvalue
1619 \iflocation
1620 \clf_doifelsereference{\referenceprefix}{#label}{\extrareferencearguments}
1621 {\expandtexincurrentreference
1622 \clf_injectcurrentreferencehtdp
1623 \dimexpr\interactionparameter\c!height\relax
1624 \dimexpr\interactionparameter\c!depth \relax
1625 \relax
1626 \setlocationattributes
1627 \global\lastsavedreferenceattribute\lastreferenceattribute
1628 \c_attr_reference\lastreferenceattribute
1629 \dostarttagged\t!link\empty
1630 #content
1631 \dostoptagged}
1632 {#content}
1633 \else
1634 #content
1635 \fi
1636 \endgroup}
1637
1638\unexpanded\def\directgotobox#content[#label]
1639 {\dontleavehmode
1640 \begingroup
1641 \global\lastsavedreferenceattribute\attributeunsetvalue
1642 \c_attr_reference\attributeunsetvalue
1643 \iflocation
1644 \clf_injectreference
1645 {\referenceprefix}
1646 {#label}
1647 {\extrareferencearguments}
1648 \relax
1649 \setlocationattributes
1650 \global\lastsavedreferenceattribute\lastreferenceattribute
1651 \dostarttagged\t!link\empty
1652 \hbox attr \referenceattribute \lastreferenceattribute {#content}
1653 \dostoptagged
1654 \else
1655 #content
1656 \fi
1657 \endgroup}
1658
1659\unexpanded\def\directgotospecbox#resolver#content[#label]
1660 {\dontleavehmode
1661 \begingroup
1662 \global\lastsavedreferenceattribute\attributeunsetvalue
1663 \c_attr_reference\attributeunsetvalue
1664 \iflocation
1665 \clf_injectreference
1666 {\referenceprefix}
1667 {#label}
1668 {\extrareferencearguments}
1669 \relax
1670 \setlocationcolorspec{#resolver}
1671 \global\lastsavedreferenceattribute\lastreferenceattribute
1672 \dostarttagged\t!link\empty
1673 \hbox attr \referenceattribute \lastreferenceattribute {#content}
1674 \dostoptagged
1675 \else
1676 #content
1677 \fi
1678 \endgroup}
1679
1680\unexpanded\def\directgotodumbbox#content[#label]
1681 {\dontleavehmode
1682 \begingroup
1683 \global\lastsavedreferenceattribute\attributeunsetvalue
1684 \c_attr_reference\attributeunsetvalue
1685 \iflocation
1686 \clf_injectreference
1687 {\referenceprefix}
1688 {#label}
1689 {\extrareferencearguments}
1690 \relax
1691 \global\lastsavedreferenceattribute\lastreferenceattribute
1692 \dostarttagged\t!link\empty
1693 \hbox attr \referenceattribute \lastreferenceattribute {#content}
1694 \dostoptagged
1695 \else
1696 #content
1697 \fi
1698 \endgroup}
1699
1700\unexpanded\def\gotobox#content[#label]
1701 {\dontleavehmode
1702 \begingroup
1703 \global\lastsavedreferenceattribute\attributeunsetvalue
1704 \c_attr_reference\attributeunsetvalue
1705 \iflocation
1706 \clf_doifelsereference{\referenceprefix}{#label}{\extrareferencearguments}
1707 {\expandtexincurrentreference
1708 \clf_injectcurrentreference
1709 \setlocationattributes
1710 \global\lastsavedreferenceattribute\lastreferenceattribute
1711 \dostarttagged\t!link\empty
1712 \hbox attr \referenceattribute \lastreferenceattribute {#content}
1713 \dostoptagged}
1714 {#content}
1715 \else
1716 #content
1717 \fi
1718 \endgroup}
1719
1720\unexpanded\def\gotowdhtbox#width#height[#label]
1721 {\dontleavehmode
1722 \begingroup
1723 \setbox\scratchbox\emptyhbox
1724 \wd\scratchbox#width
1725 \ht\scratchbox#height
1726 \global\lastsavedreferenceattribute\attributeunsetvalue
1727 \c_attr_reference\attributeunsetvalue
1728 \clf_doifelsereference{\referenceprefix}{#label}{\extrareferencearguments}
1729 {\clf_injectcurrentreference
1730 \global\lastsavedreferenceattribute\lastreferenceattribute
1731 \hpack attr \referenceattribute \lastreferenceattribute {\box\scratchbox}}
1732 {\box\scratchbox}
1733 \endgroup}
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
1781\unexpanded\def\useurl {\doquadrupleempty\strc_references_use_url }
1782\unexpanded\def\usefile{\dotripleargument\strc_references_use_file}
1783
1784\let\useURL \useurl
1785\let\useexternaldocument\usefile
1786
1787\def\strc_references_use_url[#label][#url][#file][#description]
1788 {\clf_useurl{#label}{\detokenize{#url}}{\detokenize{#file}}{\detokenize{#description}}}
1789
1790\def\strc_references_use_file[#label][#file][#description]
1791 {\clf_usefile{#label}{\detokenize{#file}}{\detokenize{#description}}}
1792
1793\def\doifelseurldefined #label{\clf_doifelseurldefined {#label}}
1794\def\doifelsefiledefined#label{\clf_doifelsefiledefined{#label}}
1795
1796\let\doifurldefinedelse \doifelseurldefined
1797\let\doiffiledefinedelse\doifelsefiledefined
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815\installcorenamespace{url}
1816
1817\installdirectcommandhandler \??url {url}
1818
1819\setupurl
1820 [\c!style=\v!type,
1821 \c!color=]
1822
1823\unexpanded\def\url[#label]
1824 {\dontleavehmode
1825 \begingroup
1826 \useurlstyleandcolor\c!style\c!color
1827 \hyphenatedurl{\clf_geturl{#label}}
1828 \endgroup}
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852\unexpanded\def\strc_references_from
1853 {\dosingleempty\strc_references_do_special_from}
1854
1855\def\strc_references_do_special_from[#label]
1856 {\dontleavehmode
1857 \goto{\clf_from{#label}}[fileorurl(#label)]}
1858
1859\def\dofromurldescription#content
1860 {#content}
1861
1862\def\dofromurlliteral#content
1863 {\useurlstyleandcolor\c!style\c!color
1864 \hyphenatedurl{#content}}
1865
1866\let\dofromfiledescription\dofromurldescription
1867\let\dofromfileliteral \dofromurlliteral
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
1893\installcorenamespace{programs}
1894
1895\installdirectcommandhandler \??programs {programs}
1896
1897\unexpanded\def\defineprogram
1898 {\dotripleargument\strc_references_define_program}
1899
1900\def\strc_references_define_program[#name][#program][#description]
1901 {\clf_defineprogram{#name}{#program}{#description}}
1902
1903\unexpanded\def\program[#name]
1904 {\dontleavehmode
1905 \begingroup
1906 \useprogramsstyleandcolor\c!style\c!color
1907 \clf_getprogram{#name}
1908 \endgroup}
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
1941\unexpanded\def\definepage
1942 {\dodoubleargument\strc_references_define_page}
1943
1944\def\strc_references_define_page[#name][#target]
1945 {\definereference[#name][page(#target)]}
1946
1947\def\gotopage#text[#target]
1948 {\goto{#text}[\v!page(#target)]}
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971\def\coupledocument
1972 {\doquadrupleempty\strc_references_couple_document}
1973
1974\def\strc_references_couple_document[#name][#file][#sections][#description]
1975 {\ifthirdargument
1976
1977 \fi}
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991\unexpanded\def\dotextprefix#text
1992 {\begingroup
1993 \setbox\scratchbox\hbox{#text}
1994 \ifdim\wd\scratchbox>\zeropoint
1995 \unhbox\scratchbox
1996 \edef\p_separator{\referencingparameter\c!separator}
1997 \ifx\p_separator\empty \else
1998 \removeunwantedspaces
1999 \p_separator
2000 \fi
2001 \else
2002 \unhbox\scratchbox
2003 \fi
2004 \endgroup}
2005
2006
2007
2008
2009\setupreferencing
2010 [\c!state=\v!start,
2011 \c!autofile=\v!no,
2012 \v!part\c!number=\v!yes,
2013 \v!chapter\c!number=\v!no,
2014 \c!interaction=\v!all,
2015 \c!convertfile=\v!no,
2016
2017 \c!prefix=,
2018 \c!width=.75\makeupwidth,
2019 \c!left=\quotation\bgroup,
2020 \c!right=\egroup,
2021 \c!global=\v!no,
2022 \c!expansion=\v!no,
2023 \c!separator=\nonbreakablespace,
2024 \c!export=\v!no]
2025
2026\setupprograms
2027 [\c!directory=,
2028 \c!style=\v!type,
2029 \c!color=]
2030
2031\definereference [\v!CloseDocument ] [action(close)]
2032\definereference [\v!ExitViewer ] [action(exit)]
2033\definereference [\v!FirstPage ] [action(first)]
2034\definereference [\v!LastPage ] [action(last)]
2035\definereference [\v!NextJump ] [action(forward)]
2036\definereference [\v!NextPage ] [action(next)]
2037\definereference [\v!PauseMovie ] [action(pausemovie)]
2038\definereference [\v!PauseSound ] [action(pausesound)]
2039\definereference [\v!PauseRendering ] [action(pauserendering)]
2040\definereference [\v!PreviousJump ] [action(backward)]
2041\definereference [\v!PreviousPage ] [action(previous)]
2042\definereference [\v!PrintDocument ] [action(print)]
2043\definereference [\v!SaveForm ] [action(exportform)]
2044\definereference [\v!LoadForm ] [action(importform)]
2045\definereference [\v!ResetForm ] [action(resetform)]
2046\definereference [\v!ResumeMovie ] [action(resumemovie)]
2047\definereference [\v!ResumeSound ] [action(resumesound)]
2048\definereference [\v!ResumeRendering ] [action(resumerendering)]
2049\definereference [\v!SaveDocument ] [action(save)]
2050\definereference [\v!SaveNamedDocument] [action(savenamed)]
2051\definereference [\v!OpenNamedDocument] [action(opennamed)]
2052\definereference [\v!SearchDocument ] [action(search)]
2053\definereference [\v!SearchAgain ] [action(searchagain)]
2054\definereference [\v!StartMovie ] [action(startmovie)]
2055\definereference [\v!StartSound ] [action(startsound)]
2056\definereference [\v!StartRendering ] [action(startrendering)]
2057\definereference [\v!StopMovie ] [action(stopmovie)]
2058\definereference [\v!StopSound ] [action(stopsound)]
2059\definereference [\v!StopRendering ] [action(stoprendering)]
2060\definereference [\v!SubmitForm ] [action(submitform)]
2061\definereference [\v!ToggleViewer ] [action(toggle)]
2062\definereference [\v!ViewerHelp ] [action(help)]
2063\definereference [\v!HideField ] [action(hide)]
2064\definereference [\v!ShowField ] [action(show)]
2065\definereference [\v!GotoPage ] [action(gotopage)]
2066\definereference [\v!Query ] [action(query)]
2067\definereference [\v!QueryAgain ] [action(queryagain)]
2068\definereference [\v!FitWidth ] [action(fitwidth)]
2069\definereference [\v!FitHeight ] [action(fitheight)]
2070\definereference [\v!ShowThumbs ] [action(thumbnails)]
2071\definereference [\v!ShowBookmarks ] [action(bookmarks)]
2072
2073\definereference [\v!HideLayer ] [action(hidelayer)]
2074\definereference [\v!VideLayer ] [action(videlayer)]
2075\definereference [\v!ToggleLayer ] [action(togglelayer)]
2076
2077\definereference [\v!firstpage] [page(firstpage)]
2078\definereference [\v!previouspage] [page(previouspage)]
2079\definereference [\v!nextpage] [page(nextpage)]
2080\definereference [\v!lastpage] [page(lastpage)]
2081\definereference [\v!forward] [page(forward)]
2082\definereference [\v!backward] [page(backward)]
2083\definereference [\v!firstsubpage] [page(firstsubpage)]
2084\definereference [\v!previoussubpage] [page(previoussubpage)]
2085\definereference [\v!nextsubpage] [page(nextsubpage)]
2086\definereference [\v!lastsubpage] [page(lastsubpage)]
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
2123\installcorenamespace{referencingprefix}
2124
2125\def\getreferencestructureprefix#kind#name#category
2126 {{
2127 prefix {\referencestructureprefixparameter{#kind}{#name}{#category}\c!prefix}
2128 separatorset {\referencestructureprefixparameter{#kind}{#name}{#category}\c!prefixseparatorset}
2129 conversion {\referencestructureprefixparameter{#kind}{#name}{#category}\c!prefixconversion}
2130 conversionset {\referencestructureprefixparameter{#kind}{#name}{#category}\c!prefixconversionset}
2131 starter {\referencestructureprefixparameter{#kind}{#name}{#category}\c!prefixstarter}
2132 stopper {\referencestructureprefixparameter{#kind}{#name}{#category}\c!prefixstopper}
2133 set {\referencestructureprefixparameter{#kind}{#name}{#category}\c!prefixset}
2134 segments {\referencestructureprefixparameter{#kind}{#name}{#category}\c!prefixsegments}
2135 connector {\referencestructureprefixparameter{#kind}{#name}{#category}\c!prefixconnector}
2136 }
2137 {
2138 separatorset {\referencestructureprefixparameter{#kind}{#name}{#category}\c!numberseparatorset}
2139 conversion {\referencestructureprefixparameter{#kind}{#name}{#category}\c!numberconversion}
2140 conversionset {\referencestructureprefixparameter{#kind}{#name}{#category}\c!numberconversionset}
2141 starter {\referencestructureprefixparameter{#kind}{#name}{#category}\c!numberstarter}
2142 stopper {\referencestructureprefixparameter{#kind}{#name}{#category}\c!numberstopper}
2143 segments {\referencestructureprefixparameter{#kind}{#name}{#category}\c!numbersegments}
2144 }}
2145
2146\unexpanded\def\setupreferencestructureprefix
2147 {\dotripleempty\strc_references_setup_reference_structure_prefix}
2148
2149\def\strc_references_setup_reference_structure_prefix[#kind][#category][#settings]
2150 {\ifthirdargument
2151 \getparameters[\??referencingprefix#kind:#category][#settings]
2152 \else\ifsecondargument
2153 \getparameters[\??referencingprefix:#kind][#category]
2154 \fi\fi}
2155
2156\def\referencestructureprefixparameter#kind#name#category#parameter
2157 {\ifcsname\??referencingprefix#name:#category#parameter\endcsname
2158 \lastnamedcs
2159 \else\ifcsname\??referencingprefix#kind:#category#parameter\endcsname
2160 \lastnamedcs
2161 \else\ifcsname\??referencingprefix:#category#parameter\endcsname
2162 \lastnamedcs
2163 \fi\fi\fi}
2164
2165\def\currentreferencedefault
2166 {\normalexpanded{\noexpand\clf_filterdefaultreference
2167 {\s!default}
2168 \noexpand\getreferencestructureprefix\clf_getcurrentprefixspec{\s!default}
2169 \relax}}
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
2215\protect \endinput
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236 |