Consider the following MNWE, which I'm compiling with pdfTeX:
\documentclass{article} \usepackage{morewrites} \usepackage{memoize} \usepackage{tikz} \begin{document} \begin{tikz} \draw (0,0) -| (1,1); \end{tikz} \end{document} This fails to compile with the error
! I can't write on file `{.//prawf.700EB6A4550C47FDDA18E01DBED7CCDC.memo}'. <to be read again> \scan_stop: l.229 \draw (0,0) -| (1,1); (Press Enter to retry, or Control-D to exit; default file extension is `.tex') Please type another output file name: I'm guessing this might have to do with the use of \write16 in memoize.sty and advice.sty since morewrites.pdf says
TEXhackers note: The revised
\newwriteallocate stream numbers starting at 19. This might break some code that expects stream numbers to be less than 16.
However, the \write16 in both cases is invoked in code which, as I understand it, is for tracing purposes and off by default. So I'm not certain if this is the problem or not.
Nonetheless, I tried adding, for example,
\makeatletter \def\advice@trace#1{\immediate\write\@unused{[tracing advice] #1}} \def\mmz@trace#1{\immediate\write\@unused{[tracing memoize] #1}} \makeatother but this was obviously a stupid idea because it made no difference at all. That is, the following code compiles fine:
\documentclass{article} %\usepackage{morewrites} \usepackage{memoize} \usepackage{tikz} \makeatletter \def\advice@trace#1{\immediate\write\@unused{[tracing advice] #1}} \def\mmz@trace#1{\immediate\write\@unused{[tracing memoize] #1}} \makeatother \begin{document} \begin{tikz} \draw (0,0) -| (1,1); \end{tikz} \end{document} But as soon as I uncomment the call to morewrites, compilation breaks with the error reported above.
So I'm not clear whether this is simply the use of \write16, whether I've missed less obvious uses of \write16 or if there's a further incompatibility here.
I'm aware that using luaTeX might avoid the need for morewrites, but the documents where I need morewrites are sufficiently committed to pdfTeX that I'll probably just avoid memoize if using it requires switching engines.
What causes the error and is there a way I can work around it in pdfTeX?
Before somebody asks if I really need morewrites, David Carlisle told me I needed morewrites after some change to LaTeX several years ago.
[That is, is there any chance I might be able to have my cake and eat it, too? A sort of self-perpetuating cake of some kind ....]
lualatex(even withmorewritesloaded).morewritesbails out if luatex is used. It issues a warning, but that's all.\write?bib2glsrather thanxindy. But that would mean converting all the databases. I know there's a conversion tool, but I'm not sure how messy it would get.