On Wed, 28 May 2025, RAGINI wrote:
Had filed a bug report on this earlier.
https://github.com/cplusplus/draft/issues/7747
Posting a link here for record in case anyone in the community needs to
refer to the issue.
I have question though, perhaps might be useful for some beginners as well:
How did you come to the conclusion that you need to open a bug for it?
Here is the rough trace of the line of reasoning that i adopted.
:: What software am I using?
LaTeX
0. LaTeX is a bunch of TeX macros.
1. Macros are about substitution.
2. LaTeX ships with tons of macros (ie. cls, sty etc)
:: What is the structural type of document I am trying to build a PDF for?
C++ draft LaTeX file which uses multiple packages.
This means, that assuming the ArchLinux texlive installation is consistent and
the packages required in std.tex file are available, the error most likely
comes from a incorrect usage of a package and or its options.
On executing the command, 'pdflatex std.tex', the errors were as follows
---
LaTeX Warning: Reference basic.fundamental' on page 16 undefined on input line
348.
LaTeX Warning: Reference `lex.ccon' on page 16 undefined on input line 353.
LaTeX Warning: Reference `lex.string' on page 16 undefined on input line 353.
LaTeX Warning: Reference `character.seq' on page 16 undefined on input line 362
\openout5 = `std.xtr'.
! TeX capacity exceeded, sorry [input stack size=10000].
@afterendenvhook@ ->@afterendenvhook@
\input {\jobname .xtr}
l.397 \end{bnf}
---
Beyond undefined references, the last line shows a '\end{bnf}'
Since errors are seen in that part of the document where the grammar is
written, does {bnf} mean Backus-Naur form. Did a bit of internet search and
read this old thread
https://tex.stackexchange.com/questions/24886/which-package-can-be-used-to-write-bnf-grammars
This tells me which package should one look at. Learnt something but couldn't
figure out how to approach further.
A search on the codebase showed the places where '\end{bnf}' shows up
https://github.com/search?q=repo%3Acplusplus%2Fdraft+path%3A%2F%5Esource%5C%2F%2F+%5Cend%7Bbnf%7D&type=code
Another old thread, helped with some understanding about 'undefined references'
https://tex.stackexchange.com/questions/34933/how-to-understand-the-latex-warning-there-were-undefined-references
There is another unsaid rule in LaTeX that if you get errors the first time,
you should run the command twice over and many a time the errors go away, since
many of the symbols and templates would have got resolved or substituted.
However, the errors were consistent.
Next, the undefined reference error 'lex.string', made me do another search.
https://github.com/search?q=repo%3Acplusplus%2Fdraft%20path%3A%2F%5Esource%5C%2F%2F%20lex.string&type=code
This clearly shows that somehow value of a string is pulled out and then
substituted wherever it's referenced.
So, i simply searched for 'extract' and 'substitute' string hoping that i will
get some ideas.
https://github.com/search?q=repo%3Acplusplus%2Fdraft+path%3A%2F%5Esource%5C%2F%2F+extract&type=code
I also searched if there was a LaTeX package that can extract and substitute.
Another old discussion link showed up (see the last comment)
https://tex.stackexchange.com/questions/2571/extracting-the-contents-of-text-in-a-specified-environment-into-a-new-file
https://ctan.org/pkg/extract?lang=en
However, i couldn't figure out the extraction logic.
That's when I decided that, i need to communicate with the folks who maintain
this C++ draft git repo and they can help me.
The final solution adopted Thomas was to use 'environ' package instead of
fixing the existing 'extract' package usage (perhaps the macro usage was
brittle).
https://ctan.org/pkg/environ?lang=en
The final commit (SHA 561a43b) is insightful. Please see
https://github.com/cplusplus/draft/commit/561a43b6730a360ae786b613e276017717f222fa
See the changes in source/std.tex file at line 49 (real simplification).
Hope this helps decode the entire process.
warm regards
Saifi.