add tag
निरंजन
I have the following `test.lvt`:

```#
\documentclass{article}
\input{regression-test}
\AddToHook{begindocument/before}{abcd}

\START
% \OMIT% Doesn't work as expected
\begin{document}
% \TIMO% Doesn't work as expected
\end{document}
```

The following `build.lua`:

```lua#
module     = "duck"
```

The `.tlg` this generates is as follows:

```txt#
This is a generated file for the l3build validation system.
Don't change this file in any respect.
! LaTeX Error: Missing \begin{document}.
See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              
l. ...\begin{document}
You're in trouble here.  Try typing  <return>  to proceed.
If that doesn't work, type  X <return>  to quit.
(../l3backend-pdftex.def
File: l3backend-pdftex.def ....-..-.. L3 backend support: PDF output (pdfTeX)
\l__color_backend_stack_int=\count...
\l__pdf_internal_box=\box...
)
No file test.aux.
LaTeX Font Info:    Checking defaults for OML/cmm/m/it on input line ....
LaTeX Font Info:    ... okay on input line ....
LaTeX Font Info:    Checking defaults for OMS/cmsy/m/n on input line ....
LaTeX Font Info:    ... okay on input line ....
LaTeX Font Info:    Checking defaults for OT1/cmr/m/n on input line ....
LaTeX Font Info:    ... okay on input line ....
LaTeX Font Info:    Checking defaults for T1/cmr/m/n on input line ....
LaTeX Font Info:    ... okay on input line ....
LaTeX Font Info:    Checking defaults for TS1/cmr/m/n on input line ....
LaTeX Font Info:    ... okay on input line ....
LaTeX Font Info:    Checking defaults for OMX/cmex/m/n on input line ....
LaTeX Font Info:    ... okay on input line ....
LaTeX Font Info:    Checking defaults for U/cmr/m/n on input line ....
LaTeX Font Info:    ... okay on input line ....
[1
] (test.aux)
```

I want the `.tlg` to only have content up to line 9. After that, whatever it is, I don't wanna keep testing. Because of small unnecessary changes in that log generation, my tests are failing. Can I dissect `\begin{document}`, and then `\OMIT` the part that initialises this font log? I tried using `begindocument/end`, `begindocument/before` also. Nothing works. When I say `\OMIT`-`\TIMO` pair doesn't work as expected, I mean, it also excludes the error message I want to be printed (i.e., Missing \begindocument [...])
Top Answer
Skillmon
Well, `\OMIT ... \TIMO` ignores *everything* that happens in between the two calls.

The simple fix is to put the `\OMIT` inside your `begindocument/before` hook, but after the error message is thrown and the `\TIMO` after `\begin{document}`:

# `test.lvt`

```
\documentclass{article}
\input{regression-test}
\AddToHook{begindocument/before}{abcd\OMIT}

\START
\begin{document}
\TIMO
\end{document}
```
Answer #2
निरंजन
@cfr's comments at [the SE question](https://tex.stackexchange.com/q/724967/) helped.

We add another `\AddToHook` to the `.lvt`s and add the `\OMIT` inside it as follows:

```#
\documentclass{test}
\input{regression-test}
\AddToHook{begindocument/before}{\OMIT}
\START
\begin{document}
hello
\end{document}
```

with the following `.cls`:

```#
\ProvidesClass{test}
\LoadClass{article}
\AddToHook{begindocument/before}{%
  abcd%
}
```

produces the correct `.tlg`.

```#txt
This is a generated file for the l3build validation system.
Don't change this file in any respect.
! LaTeX Error: Missing \begin{document}.
See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              
l. ...\begin{document}
You're in trouble here.  Try typing  <return>  to proceed.
If that doesn't work, type  X <return>  to quit.
```

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.