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
LaTeX2e <2020-02-02> patch level 5
L3 programming layer <2020-03-06>
Document Class: ltxdoc 2019/09/16 v2.0y Standard LaTeX documentation class
Document Class: article 2019/12/20 v1.4l Standard LaTeX document class
Writing index file lgrind.idx
Writing glossary file lgrind.glo

! 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)

1 Answer 1


The source file does


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


while removing the \begin{document} line below

% \GetFileInfo{lgrind.dtx}
  • 1
    I'm pretty sure I said this on the mailing list too :)
    – Joseph Wright
    Jun 22, 2020 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, 2020 at 10:02
  • Thank you Joseph. That works! Jun 22, 2020 at 21:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .