input request
I have just pushed b52d805e, the latest state of my local repository. The transpiler produces code that compiles and executes but now I'm facing the situation that I basically don't know how to use the program at all, so I'm in need of some help/guidance from someone else. Unstructured notes/questions follow. If you can pick any item on the list and provide me with any comments I'll be very grateful because they will be helpfull for sure. Thanks in advance and aoplogies for my incompetence. In general and about TeX particularly ;-)
-
I was not able to find the documentation for the command produced by tex.web -> tex.p -> tex.go. Of course, there's documentation for the "real" tex binary in man tex, but it seems to differ substantially. For example, the Knuth's original version accepts no command-line arguments/options.
-
I'm probably missing understanding of some of the most elementary concepts of TeX. I'm not trying to read the 500+ pages .pdf to learn about the language. I would love to do it and surely enjoy it, but I don't have a week or few weeks of free time to do that. I found "TeX for the Impatient", hoping to read that instead, but it's 393 pages.
-
Wikipedia to the rescue! At https://en.wikipedia.org/wiki/TeX#How_it_is_run is a nice, tiny example:
Hello, World
\bye % marks the end of the file; not shown in the final output
- Trying to type the lines at the ** prompt revealed that TeX is actually accepting only a file name at that moment. Comparing the behavior with the tex program seems to prove that. Ok, let's save the above text in hello.tex and try again, now inputting 'hello'.
jnml@3900x:~/src/modernc.org/web2go$ cat hello.tex
Hello, World
\bye % marks the end of the file; not shown in the final output
jnml@3900x:~/src/modernc.org/web2go$ make xtex && xtex
...
go install -v
rm -rf ~/tmp/xtex.go
web2go -o ~/tmp/xtex.go tex.web changefile.ch
go build -v -o ~/bin/xtex ~/tmp/xtex.go
This is TeX, Version 3.141592653 (INITEX)
**hello
(hello.tex
! Undefined control sequence.
l.2 \bye
% marks the end of the file; not shown in the final...
? ^C
jnml@3900x:~/src/modernc.org/web2go$ tex
This is TeX, Version 3.14159265 (TeX Live 2019/dev/Debian) (preloaded format=tex)
**hello
(./hello.tex [1] )
Output written on hello.dvi (1 page, 228 bytes).
Transcript written on hello.log.
jnml@3900x:~/src/modernc.org/web2go$
- Some trial and error round later it turns out that s/bye/end/ in hello.tex makes things a bit better:
jnml@3900x:~/src/modernc.org/web2go$ cat hello.tex
Hello, World
\end % marks the end of the file; not shown in the final output
jnml@3900x:~/src/modernc.org/web2go$ make xtex && xtex
...
go install -v
rm -rf ~/tmp/xtex.go
web2go -o ~/tmp/xtex.go tex.web changefile.ch
go build -v -o ~/bin/xtex ~/tmp/xtex.go
This is TeX, Version 3.141592653 (INITEX)
**hello
(hello.tex [0] )
Output written on hello.dvi (1 page, 128 bytes).
Transcript written on hello.log.jnml@3900x:~/src/modernc.org/web2go$ hd hello.dvi
00000000 f7 02 01 83 92 c0 1c 3b 00 00 00 00 03 e8 1b 20 |.......;....... |
00000010 54 65 58 20 6f 75 74 70 75 74 20 32 30 32 31 2e |TeX output 2021.|
00000020 30 33 2e 30 36 3a 31 38 31 30 8b 00 00 00 00 00 |03.06:1810......|
00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00000050 00 00 00 ff ff ff ff 8c f8 00 00 00 2a 01 83 92 |............*...|
00000060 c0 1c 3b 00 00 00 00 03 e8 00 00 00 00 00 00 00 |..;.............|
00000070 00 00 01 00 01 f9 00 00 00 58 02 df df df df df |.........X......|
00000080
jnml@3900x:~/src/modernc.org/web2go$ tex
This is TeX, Version 3.14159265 (TeX Live 2019/dev/Debian) (preloaded format=tex)
**hello
(./hello.tex [1] )
Output written on hello.dvi (1 page, 228 bytes).
Transcript written on hello.log.
jnml@3900x:~/src/modernc.org/web2go$ hd hello.dvi
00000000 f7 02 01 83 92 c0 1c 3b 00 00 00 00 03 e8 1b 20 |.......;....... |
00000010 54 65 58 20 6f 75 74 70 75 74 20 32 30 32 31 2e |TeX output 2021.|
00000020 30 33 2e 30 36 3a 31 38 31 31 8b 00 00 00 01 00 |03.06:1811......|
00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00000050 00 00 00 ff ff ff ff 8d 9f f2 00 00 8e a0 02 83 |................|
00000060 33 da 8d a0 fd 86 cc 26 8d 91 14 00 00 f3 00 4b |3......&.......K|
00000070 f1 60 79 00 0a 00 00 00 0a 00 00 00 05 63 6d 72 |.`y..........cmr|
00000080 31 30 ab 48 65 6c 6c 6f 2c 91 03 55 55 57 91 ff |10.Hello,..UUW..|
00000090 2a aa 6f 72 6c 64 8e 8e 9f 18 00 00 8d 92 00 e8 |*.orld..........|
000000a0 60 a3 31 8e 8c f8 00 00 00 2a 01 83 92 c0 1c 3b |`.1......*.....;|
000000b0 00 00 00 00 03 e8 02 9b 33 da 01 d5 c1 47 00 02 |........3....G..|
000000c0 00 01 f3 00 4b f1 60 79 00 0a 00 00 00 0a 00 00 |....K.`y........|
000000d0 00 05 63 6d 72 31 30 f9 00 00 00 a5 02 df df df |..cmr10.........|
000000e0 df df df df |....|
000000e4
jnml@3900x:~/src/modernc.org/web2go$
-
Why does not the Wikipedia example work? I need to know if that's a bug introduced by the translation or if the tex.web version is so outdated. But it's a version from this year so my confusion is pretty big about this.
-
Ok, the translated xtex.go has some other bugs it seems. That's expected in the very beginning. To debug I need to know what I am doing and what's the expected vs actual outcome. The above is a good example. But it would be nice to decompose it into smaller chunks. The nowhere-found-documented TeX prompt '**' seems to accept "things" that start with a backslah in addition to file names. Let's try:
jnml@3900x:~/src/modernc.org/web2go$ make xtex && xtex
...
go install -v
rm -rf ~/tmp/xtex.go
web2go -o ~/tmp/xtex.go tex.web changefile.ch
go build -v -o ~/bin/xtex ~/tmp/xtex.go
This is TeX, Version 3.141592653 (INITEX)
**\end
No pages of output.
Transcript written on texput.log.jnml@3900x:~/src/modernc.org/web2go$ tex
This is TeX, Version 3.14159265 (TeX Live 2019/dev/Debian) (preloaded format=tex)
**\end
No pages of output.
Transcript written on texput.log.
jnml@3900x:~/src/modernc.org/web2go$
-
Oh, modulo the missing newline of xtex's outputto the terminal both programs nicely - do nothing ;-)
-
Makes me realize I have no idea about the semantics of '\end'. It just seems it does not have to be paired with some '\begin', I guess.
-
The Wikipedia chapter https://en.wikipedia.org/wiki/TeX#Macro_language provides basically zero bits of information. How are tokens distiguished? Is white space significant? (More on that later.) Is newline special compared to ordinary white space? Does every "non-tex" start with the backslash? Can '\def' appear only at the first column? Seems like that. Must be a '\def'-inition completely on a single line? Also seems like that, ie. I haven't found a counter-example in tex.tex.
-
It seems I still cannot get the eoln implementation in the run time library (rtl.go) right.
jnml@3900x:~/src/modernc.org/web2go$ make xtex && xtex
...
go install -v
rm -rf ~/tmp/xtex.go
web2go -o ~/tmp/xtex.go tex.web changefile.ch
go build -v -o ~/bin/xtex ~/tmp/xtex.go
This is TeX, Version 3.141592653 (INITEX)
**\def\foo{bar}
*\end
*\end
*
(Please type a command or say `\end')
*\end
*^C
jnml@3900x:~/src/modernc.org/web2go$ tex
This is TeX, Version 3.14159265 (TeX Live 2019/dev/Debian) (preloaded format=tex)
**\def\foo{bar}
*\end
No pages of output.
Transcript written on texput.log.
jnml@3900x:~/src/modernc.org/web2go$
- This is again the possible broken eoln implemetation manifestation.
jnml@3900x:~/src/modernc.org/web2go$ make xtex && xtex
tangle tex.web changefile.ch
This is TANGLE, Version 4.5 (TeX Live 2019/dev/Debian)
*1*17*25*38*54*72*99*110*115*133*162*173*199*203*207*211*220*256*268*289*297*300*321*332*366*402*464*487*511*539*583*592*644*680*699*719*768*813*862*891*900*919*942*967*980*1029*1055*1136*1208*1299*1330*1338*1340*1379*1380
Writing the output file.....500.....1000.....1500.....2000.....2500.....3000.....3500.....4000.....4500.....5000.....5500.....6000.
Done.
1045 strings written to string pool file.
(No errors were found.)
weave tex.web
This is WEAVE, Version 4.4 (TeX Live 2019/dev/Debian)
*1*17*25*38*54*72*99*110*115*133*162*173*199*203*207*211*220*256*268*289*297*300*321*332*366*402*464*487*511*539*583*592*644*680*699*719*768*813*862*891*900*919*942*967*980*1029*1055*1136*1208*1299*1330*1338*1340*1379*1380
Writing the output file...*1*17*25*38*54*72*99*110*115*133*162*173*199*203*207*211*220*256*268*289*297*300*321*332*366*402*464*487*511*539*583*592*644*680*699*719*768*813*862*891*900*919*942*967*980*1029*1055*1136*1208*1299*1330*1338*1340*1379*1380
Writing the index...Done.
(No errors were found.)
go install -v
rm -rf ~/tmp/xtex.go
web2go -o ~/tmp/xtex.go tex.web changefile.ch
go build -v -o ~/bin/xtex ~/tmp/xtex.go
This is TeX, Version 3.141592653 (INITEX)
**tex
(tex.tex (webmac.tex)
Runaway definition?
{\fmtversion +WEBMAC4.1} \parskip 0pt \parindent 1em \par \font \ETC.
! File ended while scanning definition of \fmtversion.
<inserted text>
}
l.1 \input webmac
? ^C
jnml@3900x:~/src/modernc.org/web2go$
The problem here is that I don't know what to look for. The source lines in webmac.tex look like this
% standard macros for WEB listings (in addition to PLAIN.TEX)
\xdef\fmtversion{\fmtversion+WEBMAC4.1} % identifies current set of macros
\parskip 0pt % no stretch between paragraphs
\parindent 1em % for paragraphs and for the first line of Pascal text
- Is the above a problem with detecting newlines or white space? The fmtversion macro ends nicely with a properly balanced brace...