[tex-eplain] TeX, eplain + BibTeX: apalike style causes overlapping text bib entries in PDF
Laurence.Finston at gmx.net
Laurence.Finston at gmx.net
Wed Oct 11 11:41:02 CEST 2023
> If there's a good saying about this, I can't think of it right now.
Programming is debugging. Admittedly not that good, but true.
> I don't know enough about TeX and how package macros work to diagnose this.
TeX is an excellent example of a particular kind of program, namely a macro processor. There are other programs of this type, notably m4, which is used by Automake and CPP, the C Preprocessor. (In contrast, METAFONT is an excellent example of another type of program, namely a compiler or interpreter.) TeX works by reading tokens, which are either expandable or non-expandable. The non-expandable ones are the basic elements of the language, i.e., the "primitives", which are also called "tokens" or "terminal symbols" in the parlance of compiler construction. All macros, whether defined in plain.tex, eplain.tex, the various LaTeX styles or whatever are simply built up from the "primitives".
When TeX reads its input, it reads one character at a time and determines its "category code" (catcode). When it sees a character with category code 0, under normal circumstances a backslash, but any other character, if it's had catcode 0 assigned to it, it will interpret the following sequence of characters as the name of primitive or a macro. If it's a primitive, say, \vbox, it will act according to the meaning of this primitive in the TeX language. If it's a macro, it will start expanding tokens (in TeX's sense of the term) "recursively", until only primitives are left and then it will execute them.
This is exactly the same procedure for every macro package.
That is how TeX and any kind of macro, package or otherwise, work in a nutshell.
My advice would be, if you use eplain, don't use LaTeX packages and vice versa, but to each his/her own.
> Gesendet: Mittwoch, 11. Oktober 2023 um 11:17 Uhr
> Von: terry.s at Safe-mail.net
> An: tex-eplain at tug.org
> Betreff: [tex-eplain] TeX, eplain + BibTeX: apalike style causes overlapping text bib entries in PDF
>
> Hello,
>
> I'm using TeX, eplain and BibTeX and this is my workflow: tex > bibtex > tex > tex > dvipdfmx
>
> I originally had "\input eplain" followed by "\input btxmac" and couldn't compile. Laurence Finster noticed the issue disappears if you move btxmac up (which fixed the error), then Kark Berry notified me it's not even necessary because eplain automatically loads it. (You can also use it by itself without eplain.) After moving btxmac, several new errors broke the compile (unable to find my .bib file in the same directory + also the styles that are pre-installed in TeX Live) ... those errors mysteriously dissappeared after several compiles and are no longer relevant. (I since also removed the manual load of btxmac.)
>
> New errors appeared which I spent a day trying to fix by every combination of changes (and hours double-checking while I drafted an email). That's a lesson in paying attention to the tiniest little niggle when you're focused on something "big" ... so I'll entertain you with that at the end (see if you can guess what I did).
>
> However, I have a new, legitimate issue, for which I present both *suggested test source* given in the btxmac.tex iself and a PDF result that happens if you change the style to 'apalike'. (The bibliography cited is also pre-installed in TeX Live.)
>
> **Using 'apalike' style with or without eplain (without eplain you must load btxmac yourself) causes several words of the first line of every bibliography item to overlap.** (The 'plain' style works fine, so I didn't test any other styles.)
>
> I don't know enough about TeX and how package macros work to diagnose this. I did read he entire source of btxmac.tex, but if anything there should give me a clue, it doesn't. Does anyone know what causes this and how I can patch my document (or even the btxmac source)?
>
> I attached the example source and you can test compile with plain and apalike and change other things + see they don't matter. I also attached the PDF output with apalike that has the overlapped text.
>
> ..... And now, for your entertainment .....
>
> No matter what combination of eplain (or not, then load btxmac), plain or apalike style, \enablehyperlinks (or not, and it requires eplain), everything compile without error during the first *tex* run and also *bibtex*. However, on the next 2 runs of *tex* I would get this error (which I could just `Enter' past and run *dvipdfmx* without error):
>
> ! Undefined control sequence.
> l.5 \newblock Eplain: Expanded plain \tex
>
> "Eplain: Expanded...." is part of a bib entry. Can you guess what caused the "undefined" error? (It's not what you'd think!)
> If you can guess what went wrong and where, you'd win a bag of cookies (but you'll have to buy them yourself).
> ...
> ...
> ...
> ...
> No? Okay, here's the entry in my .bib file, and if you can figure it out, buy yourself a cookie (or at least a chocolate chip):
> ...
> @article{berry-eplain:2005, title={Eplain: Expanded Plain \TeX}, author={Berry, Karl and Katsitadze, Oleg}, date={2022-10}, note={({\sl TUGboat} vol.~26 no.~5, 2005)}}
> ...
> ...
> Well? Notice the terminal said "plain \tex" but I typed "plain \TeX"! Many people put quotes around their kv *values* but it's too easy to accidentally backspace over a quote and not see it (especially with my eyes), so I use {}, which is perfectly legal. But REGARDLESS how you delimit a value, if you want TeX/BibTeX to *preserve the format* (as for multi-word author surnames, which are alternatively just fixed by using surname last with comma, or a title where you want capitalization preferred, etc) the *value* INSIDE quotes or {} must be in {}! Failing to do so allows BibTeX to *convert* titles to lowercase ... so \TeX became \tex. My title should have been in "{}" or {{}} but *not* just {}. BibTeX only changes formatting of certain fields. (See one of many documents on bibliographies by Nicola Talbot,and presumably the BibTeX documentation.)
>
> *THAT'S* what TeX was complaining about ... \tex, not \newblock!
>
> I just spent hours testing with combinations of eplain/not, btxmac/not, plain/apalike (with the caveat you must load btxmac if you don't load eplain). Because I kept getting the error at the start of a bibliography entry, yet plain style is typeset in PDF fine whereas apalike has overlapping text, I thought maybe this "undefined" \newblock (supposedly) messed up that style, maybe.
>
> Yes, that \tex on the terminal niggled at me a couple times, but since I knew it was typed correctly in my .bib file and I was so focused on \newblock (even copying the "just in case" definition from btxmac.tex and pasting it in various places, and even putting a NEW btxmac in my "texmf-local" where the definition was COMMENTED OUT of btxmac.tex) that it went right over my head. Sometimes it helps to focus on the small things (often easy) instead of the big picture. If there's a good saying about this, I can't think of it right now.
>
> Sincerely,
> Terry S.
>
More information about the tex-eplain
mailing list.