davidcarlisle / dpctex

Assorted TeX packages
93 stars 30 forks source link

etex clashes with filecontents when `overwrite` is used #23

Closed u-fischer closed 3 years ago

u-fischer commented 4 years ago

from https://tex.stackexchange.com/questions/514498/beginfilecontentstabelle-tex-will-not-overwrite-existing-file

\documentclass{article}
\usepackage{etex}
\begin{filecontents}[overwrite]{ipsum.tex}
  dolor
\end{filecontents}
\begin{document}
  \input{ipsum.tex}
  sit
\end{document}

gives at the second compilation, when filecontents tries to overwrite the file

! No room for a new \write .
\ch@ck ...\else \errmessage {No room for a new #3}
                                                  \fi 
l.237 \begin{filecontents}[overwrite]{ipsum.tex}

? 

! LaTeX Error: Trying to overwrite `test-utf8.tex'.
davidcarlisle commented 4 years ago

as noted in an answer in stackexchange, we could adjust the definition of \ch@ck in etex to avoid this error, although etex.sty only re-instates the original definition for other packages that may be using it, so this isn't clearly safe.

Alternatively we could guard kernel uses of \ch@ck by a \relax after the 3rd argument so the 4-argument form is harmless.

But I'm tempted to say this is a document error, no old documents can have

\begin{filecontents}[overwrite]

and no new documents should have \usepackage{etex}

u-fischer commented 3 years ago

looks as this has been resolve by some change, the example no longer errors for me.