# lgrind.dtx no longer compiles as of TeX Live 2020, potential problem with new latex3 core?

I originally asked this question on the tldistro mailing list (I'm the TeX Live package maintainer for OpenBSD) and Karl Berry suggested I post here.

The lgrind.dtx included in lgrind-3.67 no longer builds as of TeX Live 2020 (it does build with TeX Live 2019).

The steps to compile are:

• latex lgrind.ins
• latex lgrind.dtx (twice)

This should generate lgrind.dvi.

Here's what we get with TeX Live 2020:

$latex lgrind.ins ... (this bit works fine)$ latex lgrind.dtx
This is pdfTeX, Version 3.14159265-2.6-1.40.21 (TeX Live 2020-OpenBSD_Ports) (preloaded format=latex)
restricted \write18 enabled.
entering extended mode
(./lgrind.dtx
LaTeX2e <2020-02-02> patch level 5
L3 programming layer <2020-03-06>
(/usr/local/share/texmf-dist/tex/latex/base/ltxdoc.cls
Document Class: ltxdoc 2019/09/16 v2.0y Standard LaTeX documentation class
(/usr/local/share/texmf-dist/tex/latex/base/article.cls
Document Class: article 2019/12/20 v1.4l Standard LaTeX document class
(/usr/local/share/texmf-dist/tex/latex/base/size10.clo))
(/usr/local/share/texmf-dist/tex/latex/base/doc.sty
(/usr/local/share/texmf-dist/tex/latex/tools/multicol.sty)))
Writing index file lgrind.idx
Writing glossary file lgrind.glo
(./lgrind.dtx
(/usr/local/share/texmf-dist/tex/latex/l3backend/l3backend-dvips.def

! LaTeX Error: Missing \begin{document}.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
...

l.2 %% T
his is file l3backend-dvips.def',


The T there apparently appears in the preamble, which is what causes this error, but why? Looks like comment stripping has been over-zealous? Perhaps a bug?

(The sources for lgrind-3.67 are here)

The source file does

\NeedsTeXFormat{LaTeX2e}[1996/06/01]
\documentclass{ltxdoc}
\CodelineIndex
\RecordChanges
\DocInput{lgrind.dtx}
\end{document}


and hides the \begin{document} inside \DocInput. That means that % is not a comment char during \begin{document}, which messes up anything that loads additional files there. It shows up because l3backend is now loaded there, but really it's not 'right' anyway. The best solution is to alter the .dtx to

\NeedsTeXFormat{LaTeX2e}[1996/06/01]
\documentclass{ltxdoc}
\CodelineIndex
\RecordChanges
\begin{document}
\DocInput{lgrind.dtx}
\end{document}


while removing the \begin{document} line below

% \GetFileInfo{lgrind.dtx}
`
• I'm pretty sure I said this on the mailing list too :) Jun 22 '20 at 9:52
• Thanks Joseph. I'll give this a shot when I get a moment. I must have missed the post on the mailing list -- at least the only reply I see to my thread is from Karl. Jun 22 '20 at 10:02
• Thank you Joseph. That works! Jun 22 '20 at 21:03