-
Notifications
You must be signed in to change notification settings - Fork 0
/
2018dednat6-extras.tex
1476 lines (1242 loc) · 42.2 KB
/
2018dednat6-extras.tex
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
29
30
31
32
33
34
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
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
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
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
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
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
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
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
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
% (find-angg "dednat6/2018dednat6-extras.tex")
% (defun c () (interactive) (find-dednat6sh "lualatex -record 2018dednat6-extras.tex"))
% (defun d () (interactive) (find-pdf-page "~/dednat6/2018dednat6-extras.pdf"))
% (defun e () (interactive) (find-dednat6 "2018dednat6-extras.tex"))
% (defun l () (interactive) (find-dednat6 "myverbatim.lua"))
% (defun u () (interactive) (find-latex-upload-links "2018dednat6-extras"))
% (find-pdf-page "~/dednat6/2018dednat6-extras.pdf")
% (find-sh0 "cp -v ~/dednat6/2018dednat6-extras.pdf /tmp/")
% (find-sh0 "cp -v ~/dednat6/2018dednat6-extras.pdf /tmp/pen/")
% file:///home/edrx/dednat6/2018dednat6-extras.pdf
% file:///tmp/2018dednat6-extras.pdf
% file:///tmp/pen/2018dednat6-extras.pdf
% http://angg.twu.net/dednat6/2018dednat6-extras.pdf
% «.verbatim» (to "verbatim")
%
% «.title» (to "title")
% «.what-is-this» (to "what-is-this")
% «.downloading» (to "downloading")
% «.dednat6.zip-test» (to "dednat6.zip-test")
% «.preamble» (to "preamble")
% «.tree-hacks» (to "tree-hacks")
% «.tree-bars» (to "tree-bars")
% «.abbrevs» (to "abbrevs")
% «.renaming» (to "renaming")
% «.arrow-modifiers» (to "arrow-modifiers")
%
% «.strange-modules» (to "strange-modules")
% «.barr» (to "barr")
% «.a-few-samples» (to "a-few-samples")
% «.repl» (to "repl")
% «.other-back-ends» (to "other-back-ends")
\documentclass[oneside]{article}
\usepackage[colorlinks]{hyperref} % (find-es "tex" "hyperref")
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{pict2e}
\usepackage{color} % (find-dednat6 "edrx15.sty" "colors")
\usepackage{colorweb} % (find-es "tex" "colorweb")
\usepackage{graphicx} % <- temporary?
%\usepackage{tikz}
%
% (find-dn6 "preamble6.lua" "preamble0")
\usepackage{proof} % For derivation trees ("%:" lines)
\input diagxy % For 2D diagrams ("%D" lines)
\xyoption{curve} % For the ".curve=" feature in 2D diagrams
\catcode`\^^J=10 % (find-es "luatex" "spurious-omega")
\directlua{dofile "dednat6load.lua"} % (find-dednat6 "dednat6load.lua")
\def\expr#1{\directlua{output(tostring(#1))}}
\def\eval#1{\directlua{#1}}
%
%\usepackage{edrx15} % (find-angg "dednat6/edrx15.sty")
%\input edrx15defs.tex % (find-LATEX "edrx15defs.tex")
%\input edrxaccents.tex % (find-angg "dednat6/edrxaccents.tex")
%\input edrxchars.tex % (find-dednat6 "edrxchars.tex")
%\input edrxheadfoot.tex % (find-dn4ex "edrxheadfoot.tex")
%\input edrxgac2.tex % (find-dednat6 "edrxgac2.tex")
\def\bsk{\bigskip}
\def\msk{\medskip}
\def\ssk{\smallskip}
\def\orange#1{{\color{orange}#1}}
\def\yellow#1{{\color{yellow}#1}}
\def\smashedvrule#1#2#3{\vrule width#1 height#2 depth#3 \kern-#1}
\def\bicolorhbox#1{{%
\setbox0\hbox{#1}%
\yellow{\smashedvrule{\wd0}{\ht0}{0pt}}%
\orange{\smashedvrule{\wd0}{0pt}{\dp0}}%
\box0%
}}
\def\bhbox{\bicolorhbox}
\def\cded #1{\begin{matrix}\ded {#1}\end{matrix}}
%
\begin{document}
\catcode`\^^J=10
%\directlua{dofile "edrxtikz.lua"} % (find-dednat6 "edrxtikz.lua")
%\directlua{dofile "edrxpict.lua"} % (find-dednat6 "edrxpict.lua")
% %L V.__tostring = function (v) return format("(%.3f,%.3f)", v[1], v[2]) end
\def\ASCII{ASCII}
% \co: a low-level way to typeset code; a poor man's "\verb"
\def\co#1{{%
\def\%{\char37}%
\def\\{\char92}%
\def\^{\char94}%
\def\~{\char126}%
\tt#1%
}}
\def\qco#1{`\co{#1}'}
\def\qqco#1{``\co{#1}''}
% «verbatim» (to ".verbatim")
% (find-dednat6 "2018tug-dednat6.tex" "verbatim")
\directlua{dofile "myverbatim.lua"} % (find-dednat6 "myverbatim.lua")
\def\myhbox#1#2#3{\setbox0=\hbox{#3}\ht0=#1\dp0=#2\box0}
\def\verbahbox#1{\myhbox{7pt}{2pt}{{\tt#1}}}
\def\bgbox#1{\bgcolorhbox{YellowOrangeLight}{#1}}
\def\bgcolorhbox#1#2{{%
\setbox0\hbox{#2}%
\setbox0\vbox{\vskip\fboxsep\box0\vskip\fboxsep}%
\setbox0\hbox{\kern\fboxsep\box0\kern\fboxsep}%
{\color{#1}{\smashedvrule{\wd0}{\ht0}{\dp0}}}%
\box0%
}}
%
\long\def\ColorRed #1{{\color{Red}#1}}
\long\def\ColorViolet#1{{\color{MagentaVioletLight}#1}}
\long\def\ColorGreen #1{{\color{SpringDarkHard}#1}}
\long\def\ColorGreen #1{{\color{SpringGreenDark}#1}}
\long\def\ColorGray #1{{\color{GrayLight}#1}}
%
\catcode`𝐚=13 \def𝐚{\color{SpringGreenDark}}
\catcode`𝐛=13 \def𝐛{\color{black}}
\catcode`𝐠=13 \def𝐠{\color{SpringGreenDark}}
\catcode`𝐫=13 \def𝐫{\color{Red}}
\catcode`𝐧=13 \def𝐧{\color{blue}}
\catcode`𝐮=13 \def𝐮{\color{blue}}
\catcode`𝐜=13 \def𝐜{\color{pink}}
\catcode`𝐰=13 \def𝐰{\color{YellowOrangeLight}}
% (find-dednat6 "edrxchars.tex")
\catcode`Ω=13 \defΩ{\Omega}
\catcode`Γ=13 \defΓ{\Gamma}
\catcode`⊢=13 \def⊢{\vdash}
\catcode`∨=13 \def∨{\lor}
\catcode`→=13 \def→{\to}
\def\myvcenter#1{\begin{matrix}#1\end{matrix}}
\catcode`\^^O=13 \def{{\color{red}*}}
% _____ _ _ _
% |_ _(_) |_| | ___
% | | | | __| |/ _ \
% | | | | |_| | __/
% |_| |_|\__|_|\___|
%
% «title» (to ".title")
% (find-es "tex" "title")
% (dnep 1)
\title{Dednat6: Some Extra Features}
\author{Eduardo Ochs}
\maketitle
% $$\bfig
% \morphism(2400,0)|l|/{@{>}@`{c,(3000,0),(2700,2800),p}}/<-1200,2800>[A`B;ab]
% \morphism(0,0)|l|/{@{>}@`{c,(3000,0),(2700,2800),p}}/<400,200>[C`D;cd]
% \morphism(0,0)|l|/{@{>}@`{c,(1000,0),(600,200),p}}/<400,200>[C`D;cd]
% \efig
% $$
%
% \end{document}
% __ ___ _ _ _ _ _
% \ \ / / |__ __ _| |_ (_)___ | |_| |__ (_)___
% \ \ /\ / /| '_ \ / _` | __| | / __| | __| '_ \| / __|
% \ V V / | | | | (_| | |_ | \__ \ | |_| | | | \__ \
% \_/\_/ |_| |_|\__,_|\__| |_|___/ \__|_| |_|_|___/
%
% «what-is-this» (to ".what-is-this")
% \section{What this document is}
At this moment the documentation of Dednat6 consists of:
\begin{itemize}
\item An article about Dednat6 for TUGBoat, called ``Dednat6: An
extensible (semi-)preprocessor for Lua\LaTeX\ that understands
diagrams in \ASCII\ art'', that explains all the main concepts and
how they are implemented. Link:
\url{http://angg.twu.net/LATEX/2018tugboat-rev1.pdf}
\item The slides for a presentation with the same title (on the
TUG2018 conference). Link:
\url{http://angg.twu.net/LATEX/2018tug-dednat6.pdf}
\item {\sl This document}, that complements the article and the slides
--- with installation instructions, plus lots of details and
technicalities. Link:
\url{http://angg.twu.net/LATEX/2018dednat6-extras.pdf} \\
\end{itemize}
See also:
% (find-TH "math-b" "tug-2018")
\url{http://angg.twu.net/dednat6.html}
\url{http://angg.twu.net/math-b.html\#tug-2018}
\section{Hey!}
The slides for the TUG talk end with this call for feedback:
\msk
I've stopped trying to document Dednat6 because
1) I don't have a mental image of who I am writing for,
2) I get {\sl far too little feedback},
3) all of the feedback that I got came from people who felt that I was
not writing for them --- my approach, tone and choice of
pre-requisites were all wrong.
If you would like to try Dednat6, get in touch, {\bf let's chat} ---
{\sl please}!
{\sl
Maybe I can typeset in 20 minutes a diagram that took you
a day, maybe I can implement an extension that you need...
}
\msk
This still holds! I'm \co{[email protected]}, get in touch!
Index of sections:
{\makeatletter
\renewcommand*\l@section{\@dottedtocline{1}{1.5em}{2.3em}}
\@starttoc{toc}
}
% ____ _ _ _
% | _ \ _____ ___ __ | | ___ __ _ __| (_)_ __ __ _
% | | | |/ _ \ \ /\ / / '_ \| |/ _ \ / _` |/ _` | | '_ \ / _` |
% | |_| | (_) \ V V /| | | | | (_) | (_| | (_| | | | | | (_| |
% |____/ \___/ \_/\_/ |_| |_|_|\___/ \__,_|\__,_|_|_| |_|\__, |
% |___/
% «downloading» (to ".downloading")
\section{Downloading}
You can download the current version of dednat6 from
\url{http://angg.twu.net/dednat6.html}, or from here:
\url{http://angg.twu.net/dednat6.zip}. The .zip file contains
documentation in PDF and source form. To download it, delete the PDFs
and recompile them, do this:
% «dednat6.zip-test» (to ".dednat6.zip-test")
% (find-es "dednat" "dednat6.zip-test")
%V rm -Rfv /tmp/dn6-test/
%V mkdir /tmp/dn6-test/
%V cd /tmp/dn6-test/
%V wget http://angg.twu.net/dednat6.zip
%V unzip dednat6.zip
%V rm -v *.pdf
%V lualatex 2018tugboat-rev1.tex
%V lualatex 2018tugboat-rev1.tex
%V lualatex 2018tug-dednat6.tex
%V lualatex 2018tug-dednat6.tex
%V lualatex 2018dednat6-extras.tex
%V lualatex 2018dednat6-extras.tex
%V lualatex 2018dednat6-minimal.tex
%V lualatex 2018dednat6-no-lua.tex
%V mkdir no-lua/
%V cd no-lua/
%V cp -v ../2018dednat6-no-lua.tex ../2018dednat6-no-lua.dnt .
%V pdflatex 2018dednat6-no-lua.tex
%
%L verbdef "foo"
%
$\pu\foo$
Dednat6 itself consists of just the contents of the \co{dednat6/}
directory plus the file \co{dednat6load.lua}. You can run the code
below to check that that's what is needed to compile
\co{2018dednat6-minimal.tex}:
%V rm -Rfv /tmp/dn6-test-min/
%V mkdir /tmp/dn6-test-min/
%V cd /tmp/dn6-test-min/
%V wget http://angg.twu.net/dednat6.zip
%V unzip dednat6.zip "dednat6/**" dednat6load.lua 2018dednat6-minimal.tex
%V lualatex 2018dednat6-minimal.tex
%
%L verbdef "foo"
%
$\pu\footnotesize\foo$
%V lualatex 2018dednat6-minimal.tex
% ____ _ _
% | _ \ _ __ ___ __ _ _ __ ___ | |__ | | ___
% | |_) | '__/ _ \/ _` | '_ ` _ \| '_ \| |/ _ \
% | __/| | | __/ (_| | | | | | | |_) | | __/
% |_| |_| \___|\__,_|_| |_| |_|_.__/|_|\___|
%
% «preamble» (to ".preamble")
\section{The preamble}
It {\sl should} be possible to load Dednat6 from a .tex file with a
single command, like this:
\msk
%V \documentclass{article}
%V \directlua{dofile "dednat6load.lua"}
%V \begin{document}
%V (...)
%V \end{document}
%
%L verbdef "foo"
%
$\pu\foo$
\msk
\noindent but due to some quirks this is not possible at this moment,
and we have to do this (the indented lines):
\msk
%V \documentclass{article}
%V \usepackage{proof}
%V \input diagxy
%V \xyoption{curve}
%V \begin{document}
%V \catcode`\^^J=10
%V \directlua{dofile "dednat6load.lua"}
%V (...)
%V \end{document}
%
%L verbdef "foo"
%
$\pu\foo$
\msk
% (find-es "luatex" "spurious-omega")
The `\co{\\catcode}' is needed to make the newlines in the \TeX{} code
generated by dednat6 be interpreted as newlines and not as `$Ω$'s (the
``spurious omega problem''); `\co{\\usepackage\{proof\}}' loads a
package for typesetting proof trees, `\co{\\input diagxy}' loads \Xy
Pic and the \co{diagxy} extension (sec.\ref{diagxy}), and
\co{\\xyoption{curve}} loads an extension for \co{diagxy} that allows
drawing curved arrows.
% (find-dn6 "preamble6.lua" "preamble1")
One of the things that \co{\\directlua\{dofile "dednat6load.lua"\}}
does is that it runs this from Lua:
%
$$\co{output(preamble1)}$$
%
\co{preamble1} is a chunk of \TeX{} code defined in the file
\co{dednat6/preamble.lua}, that contains material like this:
\msk
%V \def\defdiag#1#2{\expandafter\def\csname diag-#1\endcsname{\bfig#2\efig}}
%V \def\ifdiagundefined#1{\expandafter\ifx\csname diag-#1\endcsname\relax}
%V \def\diag#1{\ifdiagundefined{#1}
%V \errmessage{UNDEFINED DIAGRAM: #1}
%V \else
%V \csname diag-#1\endcsname
%V \fi
%V }
%V %
%V \def\expr#1{\directlua{output(tostring(#1))}}
%V \def\eval#1{\directlua{#1}}
%V \def\pu{\directlua{pu()}}
%
%L verbdef "foo"
%
$\pu\footnotesize\foo$
The file \co{dednat6/preamble.lua} also defines a `\co{preamble0}'
with the \qco{\\usepackage}s and \qco{\\input}s that would have to be
run before the \qco{\\begin\{document\}}, and it explains in comments
why this currently doesn't work. See the source.
% _ _ _
% | \ | | ___ | | _ _ __ _
% | \| |/ _ \ | | | | | |/ _` |
% | |\ | (_) | | |__| |_| | (_| |
% |_| \_|\___/ |_____\__,_|\__,_|
%
% «no-lua» (to ".no-lua")
\section{Producing a .tex/.dnt pair that doesn't need Lua\LaTeX}
Here is a trick for dealing with situations in which we need to
generate code that compiles with just \co{pdflatex}, without
\co{lualatex} --- for example, when we need to produce \LaTeX{} code
acceptable by Arxiv. The file \co{2018dednat6-no-lua.tex} in the .zip
package is an example of that trick. To prepare a version of it that
only needs \co{pdflatex}, do this:
\msk
%V rm -Rfv /tmp/dn6-test-no-lua/
%V mkdir /tmp/dn6-test-no-lua/
%V cd /tmp/dn6-test-no-lua/
%V wget http://angg.twu.net/dednat6.zip
%V unzip dednat6.zip "dednat6/**" dednat6load.lua 2018dednat6-no-lua.tex
%V lualatex 2018dednat6-no-lua.tex
%V mkdir no-lua/
%V cd no-lua/
%V cp -v ../2018dednat6-no-lua.tex ../2018dednat6-no-lua.dnt .
%V pdflatex 2018dednat6-no-lua.tex
%V xpdf 2018dednat6-no-lua.pdf
%
%L verbdef "foo"
%
$\pu\footnotesize\foo$
\msk
The line \qqco{lualatex 2018dednat6-no-lua.tex} generates a \co{.dnt}
file; the commands after that create a directory with just the
\co{.tex} and the \co{.dnt}, and compiles the \co{.tex} with
\co{pdflatex}.
A \co{.tex} file that supports being compiled in this was has this
structure:
\msk
%V \documentclass[oneside]{book}
%V \usepackage{ifluatex}
%V \usepackage{proof}
%V \input diagxy
%V \xyoption{curve}
%V \begin{document}
%V
%V \ifluatex
%V \catcode`\^^J=10
%V \directlua{dofile "dednat6load.lua"}
%V \else
%V \input\jobname.dnt
%V \def\pu{}
%V \fi
%V
%V (...)
%V
%V %L write_dnt_file()
%V \pu
%V
%V \end{document}
%
%L verbdef "foo"
%
{\pu\foo}
\msk
Note the \qqco{\\usepackage\{ifluatex\}}, the \co{\\ifluatex} /
\co{\\else} / \co{\\fi} block, and the \qqco{\%L write\_dnt\_file()}
followed by a \co{\\pu}.
% _____ _ _
% |_ _| __ ___ ___ | |__ __ _ ___| | _____
% | || '__/ _ \/ _ \ | '_ \ / _` |/ __| |/ / __|
% | || | | __/ __/ | | | | (_| | (__| <\__ \
% |_||_| \___|\___| |_| |_|\__,_|\___|_|\_\___/
%
% «tree-hacks» (to ".tree-hacks")
\section{Changing how tree nodes are \LaTeX'ed}
The trees below were produced by changing {\sl temporarily} the
function that converts each tree node from ascii to \TeX{} code. TO
DO: explain this; for the moment look at the source code of this
section.
% The functions that generate \TeX{} code for deduction trees are in
% the file \co{dednat6/treetex.lua}. Dednat6 uses Makoto Tatsuta's
% \co{proof.sty} by default, and the functions that generate code
% using \co{proof.sty}'s macros are \co{TeX\_subtree\_tatsuta} and
% \co{TeX\_deftree\_tatsuta}. They call \co{unabbrev\_tatsuta} to
% generate \TeX{} code for each node,
% (find-dn6 "treetex.lua" "unabbrev_tatsuta")
%L unabbrev_syntree = function (str)
%L if str:match"^<.*>$"
%L then return "\\langle\\text{"..str:sub(2, -2).."}\\rangle"
%L else return "\\co{"..str:gsub("[\\]", "\\%1").."}"
%L end
%L end
%L unabbrev_tatsuta = unabbrev_syntree
%L -- To deactivate the hack do:
%L -- unabbrev_tatsuta = unabbrev
% \POS(1500,1000)*+
% !!<0ex,.75ex>
% {T_{n-1}}\ar@{-}|!{(1000,500);(1500,500)}\hole(1167,334)
% \POS(1167,334)\ar|!{(1000,500);(1000,0)}\hole_<>(.6){h_{n-1}}
% (500,0)*+!!<0ex,.75ex>{S_n}
%:
%:
%:
%:
%: 1500 1000
%: -------- --------
%: ( <factor> , <factor> ) + <empty>
%: ----------------------- ------- ------
%: <vector> <addop> <size>
%: ------- ---------------
%: <coord> <modifier> <object1>
%: ------- --------------------------------------
%: <pos> * <object>
%: ----------------
%: \POS <coord>
%: ------------
%: <command>
%:
%: ^command
%:
%:
%: 0ex .75ex
%: ------- -------
%: < <dimen> , <dimen> >
%: ---------------------
%: ! <vector>
%: ---------------
%: ! <modifier> <object2>
%: ---------- -------------------
%: <modifier> <object>
%: ------------------------
%: <object1>
%:
%: ^object1
%:
%:
%:
%:
%:
%: -----------------
%: <object2>
%:
%: ^object2
%:
\pu
$$\ded{command}$$
$$\ded{object1}$$
%-- Revert:
%L unabbrev_tatsuta = unabbrev
% _____ _
% |_ _| __ ___ ___ | |__ __ _ _ __ ___
% | || '__/ _ \/ _ \ | '_ \ / _` | '__/ __|
% | || | | __/ __/ | |_) | (_| | | \__ \
% |_||_| \___|\___| |_.__/ \__,_|_| |___/
%
% «tree-bars» (to ".tree-bars")
% Moved to: (find-dednat6 "extra-features.tex" "tree-bars")
\section{Other inference bars}
% (find-es "tex" "proof")
% (find-LATEXfile "2010hyps.tex" "\\DeduceSym")
All the examples of deduction trees in the TUGBoat article use
`\co{-}'s for the inference bars in the ASCII art representation. If
we use `\co{=}'s instead of `\co{-}'s we get double bars, and if we
use `\co{:}'s we get a line of vertical dots instead of a bar:
%:
%: Γ Γ [P]^1 Γ\;\;[Q]^1
%: : :::::::: ::::::::::
%: Γ,P⊢R Γ,Q⊢R P∨Q R R
%: ============ --------------------1
%: Γ,P∨Q⊢R R
%:
%: ^or-1 ^or-2
%:
$$\pu \ded{or-1} \quad\Longrightarrow\quad \ded{or-2}$$
You can change the number of vertical dots by redefining the macro
`\co{\\DeduceSym}'. For example:
\msk
%V \makeatletter
%V % Original with 4 dots (from proof.sty):
%V % \def\DeduceSym{\vtop{\baselineskip4\p@ \lineskiplimit\z@
%V % \vbox{\hbox{.}\hbox{.}\hbox{.}}\hbox{.}}}
%V % New, with 3 dots:
%V \def\DeduceSym{\vtop{\baselineskip4\p@ \lineskiplimit\z@
%V \vbox{\hbox{.}\hbox{.}}\hbox{.}}}
%V \makeatother
%
%L verbdef "foo"
%
$\pu\foo$
% _ _ _
% / \ | |__ | |__ _ __ _____ _____
% / _ \ | '_ \| '_ \| '__/ _ \ \ / / __|
% / ___ \| |_) | |_) | | | __/\ V /\__ \
% /_/ \_\_.__/|_.__/|_| \___| \_/ |___/
%
% «abbrevs» (to ".abbrevs")
% Moved to: (find-dednat6 "extra-features.tex" "abbrevs")
% (find-dn6file "dednat6.lua" "abbrevs")
% (find-dn6 "abbrevs.lua")
\section{Abbrevs}
The first Dednats did not support UTF-8, and the way to write a tree
node that would display as `$a→b$' was to write it as `\co{a->b}'
after running \co{addabbrevs("->", "\\to ")}. The module
\co{abbrevs.lua} implements this, and \co{unabbrev(str)} parses
\co{str} from left to right, at each point looking for the longest
string starting at that point that is an abbrev and replacing it by
its expansion, or leaving that character untouched if it doesn't have
an expansion. Here is an example:
%V %L addabbrevs("->", "\\to ")
%V %:
%V %: [a]^1 a->b
%V %: -----------
%V %: b b->c
%V %: ------------
%V %: c
%V %: ----1
%V %: a->c
%V %:
%V %: ^a->c
%V %:
%V $$\pu \ded{a->c}$$
%L
%L verbdef "abbrevcode"
%L addabbrevs("->", "\\to ")
%:
%: [a]^1 a->b
%: -----------
%: b b->c
%: ------------
%: c
%: ----1
%: a->c
%:
%: ^a->c
%:
%$$\pu \ded{a->c}$$
$$\pu
\myvcenter{\abbrevcode}
%\abbrevcode
\qquad
\to
\qquad
\cded{a->c}
$$
% (turp 2)
Abbrevs are also used in 2D diagrams, in a more complex way. Section
2.2 of the TUGBoat article explains how the grid words create a table
\co{nodes}, but it doesn't explain how the fields \co{.tex} and
\co{.TeX} in a node affect how it is displayed. The code below creates
nodes whose {\sl tags} are \co{"A"}, \co{"B"}, \co{"C"}, \co{"D"}, and
then changes the fields \co{.tex} and \co{.TeX} in some of these
nodes. The \TeX{} code for each node is calculated by the function
\co{node\_to\_TeX}, that expects a node (a table) and returns a
string. If \co{node\_to\_TeX} receives a node that has a \co{.TeX}
field then it returns that field unchanged, surrounded by
`\co{\{\}}'s; if it doesn't have a \co{.TeX} field but it has a
\co{.tex} field then it returns the result of running \co{unabbrev} on
that field and surrounding it with `\co{\{\}}'s; otherwise it returns
the result of running \co{unabbrev} on the tag surrounding it with
`\co{\{\}}'s. For example:
%V %D diagram nodes-and-abbrevs
%V %D 2Dx 100 +40
%V %D 2D 100 A -> B
%V %D 2D | |
%V %D 2D v v
%V %D 2D +30 C -> D
%V %D 2D
%V %D (( B .tex= (a->b)
%V %D C .TeX= (a->b)
%V %D D .tex= (a->b) .TeX= (a->b)
%V %L print("nodes:"); print(nodes)
%V %L print("A:", node_to_TeX(nodes["A"]))
%V %L print("B:", node_to_TeX(nodes["B"]))
%V %L print("C:", node_to_TeX(nodes["C"]))
%V %L print("D:", node_to_TeX(nodes["D"]))
%V %D A B -> A C -> B D -> C D ->
%V %D ))
%V %D enddiagram
%L
%L verbdef "abbrevdiag"
%D diagram nodes-and-abbrevs
%D 2Dx 100 +40
%D 2D 100 A -> B
%D 2D | |
%D 2D v v
%D 2D +30 C -> D
%D 2D
%D (( B .tex= (a->b)
%D C .TeX= (a->b)
%D D .tex= (a->b) .TeX= (a->b)
%L print("nodes:"); print(nodes)
%L print("A:", node_to_TeX(nodes["A"]))
%L print("B:", node_to_TeX(nodes["B"]))
%L print("C:", node_to_TeX(nodes["C"]))
%L print("D:", node_to_TeX(nodes["D"]))
%D A B -> A C -> B D -> C D ->
%D ))
%D enddiagram
%D
$$\pu
\myvcenter{\abbrevdiag}
\quad
\to
\quad
\diag{nodes-and-abbrevs}
$$
The output of the \co{print()}s is:
{\footnotesize
\begin{verbatim}
nodes:
{ 1={"noden"=1, "tag"="A", "x"=100, "y"=100},
2={"noden"=2, "tag"="B", "x"=140, "y"=100, "tex"="(a->b)"},
3={"noden"=3, "tag"="C", "x"=100, "y"=130, "TeX"="(a->b)"},
4={"noden"=4, "tag"="D", "x"=140, "y"=130, "tex"="(a->b)", "TeX"="(a->b)"},
"A"={"noden"=1, "tag"="A", "x"=100, "y"=100},
"B"={"noden"=2, "tag"="B", "x"=140, "y"=100, "tex"="(a->b)"},
"C"={"noden"=3, "tag"="C", "x"=100, "y"=130, "TeX"="(a->b)"},
"D"={"noden"=4, "tag"="D", "x"=140, "y"=130, "tex"="(a->b)", "TeX"="(a->b)"}
}
A: {A}
B: {(a\to b)}
C: {(a->b)}
D: {(a->b)}
\end{verbatim}
}
% ____ _
% | _ \ ___ _ __ __ _ _ __ ___ (_)_ __ __ _
% | |_) / _ \ '_ \ / _` | '_ ` _ \| | '_ \ / _` |
% | _ < __/ | | | (_| | | | | | | | | | | (_| |
% |_| \_\___|_| |_|\__,_|_| |_| |_|_|_| |_|\__, |
% |___/
% «renaming» (to ".renaming")
% Moved to: (find-dednat6 "extra-features.tex" "renaming")
% (find-dn6 "diagforth.lua" "dxyren")
\section{Renaming}
The word \co{ren} in the language for 2D diagrams eats the rest of the
line, splits it at the `\co{==>}', and splits the material before the
`\co{==>}' into a list of {\sl tags}, $A_1, \ldots, A_n$, and the
material after `\co{==>}' into a list of {\sl texs}, $B_1, \ldots,
B_n$; these two lists must have the same length, and then \co{ren}
runs \co{nodes[$A_i$].tex = $B_i$} for each $i$ in $1,\ldots,n$. For
example:
%V %D diagram ren
%V %D 2Dx 100 +30
%V %D 2D 100 A1 <-| A2
%V %D 2D | |
%V %D 2D v v
%V %D 2D +30 A3 |-> A4
%V %D 2D
%V %D ren A1 A2 ==> A{\times}B A
%V %D ren A3 A4 ==> C B{\to}C
%V %D
%V %D (( A1 A2 <-| .plabel= a ({\times}B)
%V %D A1 A3 -> A2 A4 ->
%V %D A3 A4 |-> .plabel= b (B{\to})
%V %D ))
%V %D enddiagram
%L
%L verbdef "diagren"
%D diagram ren
%D 2Dx 100 +30
%D 2D 100 A1 <-| A2
%D 2D | |
%D 2D v v
%D 2D +30 A3 |-> A4
%D 2D
%D ren A1 A2 ==> A{\times}B A
%D ren A3 A4 ==> C B{\to}C
%D
%D (( A1 A2 <-| .plabel= a ({\times}B)
%D A1 A3 -> A2 A4 ->
%D A3 A4 |-> .plabel= b (B{\to})
%D ))
%D enddiagram
%D
$$\pu
\myvcenter{\diagren}
\quad
\to
\quad
\diag{ren}
$$
% _
% _ __ ___ ___ __| |_____
% | '_ ` _ \ / _ \ / _` |_____|
% _| | | | | | (_) | (_| |_____|
% (_)_| |_| |_|\___/ \__,_|
%
% «arrow-modifiers» (to ".arrow-modifiers")
% Moved to: (find-dednat6 "extra-features.tex" "arrow-modifiers")
\section{Arrow modifiers}
% (find-es "diagxy" "shape")
% (find-dn6 "diagtex.lua" "arrow_to_TeX")
% (find-dn6 "diagtex.lua" "arrow_to_TeX" "arrow_to_TeX_pshL =")
The language for 2D diagrams in dednat6 has some words for curving and
sliding arrows:
%
%V %D diagram curve-slide
%V %D 2Dx 100 +40
%V %D 2D 100 A B
%V %D 2D
%V %D 2D +40 D C
%V %D 2D
%V %D (( A B -> .plabel= b \text{one}
%V %D A B -> .slide= 5pt .plabel= a \text{two}
%V %D A B -> .slide= 20pt .plabel= a \text{three}
%V %D B C -> .curve= _10pt .plabel= l \text{four}
%V %D B C -> .curve= ^5pt .plabel= r \text{five}
%V %D C D ->
%V %D C D -> .curve= _5pt
%V %D C D -> .curve= _5pt .slide= -5pt
%V %D .plabel= a \text{six}
%V %D ))
%V %D enddiagram
%L
%L verbdef "curveslide"
%
%D diagram curve-slide
%D 2Dx 100 +40
%D 2D 100 A B
%D 2D
%D 2D +40 D C
%D 2D
%D (( A B -> .plabel= b \text{one}
%D A B -> .slide= 5pt .plabel= a \text{two}
%D A B -> .slide= 20pt .plabel= a \text{three}
%D B C -> .curve= _10pt .plabel= l \text{four}
%D B C -> .curve= ^5pt .plabel= r \text{five}
%D C D ->
%D C D -> .curve= _5pt
%D C D -> .curve= _5pt .slide= -5pt
%D .plabel= a \text{six}
%D ))
%D enddiagram
%D
$$\pu
\myvcenter{\footnotesize\curveslide}
\quad
\to
\quad
\diag{curve-slide}
$$
% (find-dn6 "diagforth.lua" "arrows")
% (find-dn6 "diagforth.lua" "arrows" "sl^^")
The words \qco{sl\^\^}, \qco{sl\^}, \qco{sl\_}, and \qco{sl\_\_} are
abbreviations for \qqco{.slide= 5pt}, \qqco{.slide= 2.5pt},
\qqco{.slide= -2.5pt}, \qqco{.slide= -5pt} respectively.
%L forths[".mod="] = function ()
%L ds:pick(0).modifier = getword() or error()
%L end
% %D diagram ??
% %D 2Dx 100 +40
% %D 2D 100 A B
% %D 2D
% %D 2D +40 D C
% %D 2D
% %D (( A B -> .plabel= a 1 .mod= @<-5pt>@/_5pt/
% %D
% %D ))
% %D enddiagram
% %D
% $$\pu
% \diag{??}
% $$
% ____ _ _ _
% / ___|| |_ _ __ _ __ __ _ _ __ ___ ___ __| |_ _| | ___ ___
% \___ \| __| '__| '_ \ / _` | | '_ ` _ \ / _ \ / _` | | | | |/ _ \/ __|
% ___) | |_| | | | | | (_| | | | | | | | (_) | (_| | |_| | | __/\__ \
% |____/ \__|_| |_| |_|\__, | |_| |_| |_|\___/ \__,_|\__,_|_|\___||___/
% |___/
%
% «strange-modules» (to ".strange-modules")
\section{Strange modules}
% (find-dn6 "dednat6.lua")
% (find-dn6 "dednat6.lua" "requires" "picture")
% (find-dn6 "picture.lua")
% (find-dn6 "zhas.lua")
% (find-dn6 "zhas.lua" "MixedPicture")
The code of Dednat6 --- inside the directory \co{dednat6/} --- is made
of several \co{.lua} files that are {\sl all} loaded by
\co{dednat6.lua}; there is no provision yet for loading only the
modules that are used in a given \co{.tex} file. This means that some
modules that are only useful to the author of Dednat6 (Eduardo Ochs,
a.k.a. ``me'') are always loaded.
Most of these extra modules were written to handle the objects
described in my series of papers about ``Planar Heyting Algebras'',
at:
\url{http://angg.twu.net/math-b.html#zhas-for-children-2}
\msk
% (find-LATEX "2017planar-has-defs.tex" "defzha-and-deftcg")
\def\defzha#1#2{\expandafter\def\csname zha-#1\endcsname{#2}}
\def\ifzhaundefined#1{\expandafter\ifx\csname zha-#1\endcsname\relax}
\def\zha#1{\ifzhaundefined{#1}
\errmessage{UNDEFINED ZHA: #1}
\else
\csname zha-#1\endcsname
\fi
}
\def\deftcg#1#2{\expandafter\def\csname tcg-#1\endcsname{#2}}
\def\iftcgundefined#1{\expandafter\ifx\csname tcg-#1\endcsname\relax}
\def\tcg#1{\iftcgundefined{#1}
\errmessage{UNDEFINED TCG: #1}
\else
\csname tcg-#1\endcsname
\fi
}
% (find-LATEXfile "2019ebl-five-appls.tex" "A strange J-operator")
%
%L tdims = TCGDims {qrh=5, q=15, crh=12, h=60, v=25, crv=7} -- with v arrows
%L tspec_PA = TCGSpec.new("46; 11 22 34 45, 25")
%L tspec_PAQ = TCGSpec.new("46; 11 22 34 45, 25", ".???", "???.?.")
%L tspec_PA :mp ({zdef="O_A(P)"}) :addlrs():print() :output()