LaTeX forum ⇒ Conversion Tools ⇒ Pdflatex "No room for a new \string" In directories with lots of files

Information and discussion about output converters related to LaTeX (e.g. dvips, ps2pdf, ...)
user40293
Posts: 3
Joined: Mon Jan 11, 2021 6:48 am

Pdflatex "No room for a new \string" In directories with lots of files

I'm seeing strange behavior when using pdflatex on a directory with lots of files (80+). I have a simple tex file that imports two other tex files using /import. I was having erratic behavior where sometimes it would generate the pdf, and sometimes it would not. The errors were also not consistent. Sometimes it was No room for a new \string, or \write. Later it was "capacity exceeded". The error in stdout looks something like this:
1. (/usr/share/texlive/texmf-dist/tex/generic/oberdiek/kvdefinekeys.sty))
2. (/usr/share/texlive/texmf-dist/tex/generic/oberdiek/pdftexcmds.sty)
3. (/usr/share/texlive/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg))
4. *geometry* detected driver: dvips
5. (./3b.toc) [1
6. Non-PDF special ignored!
7. <special> papersize=433.62pt,650.43pt
8. {/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}]
9.
10. LaTeX Warning: No \author given.
11.
12. (./1b.tex (./3b.toc) (./9.tex (./3b.toc) (./10.tex [2] (./3b.toc) (./10.tex
13. (./3b.toc) (./10.tex (./3b.toc) (./10.tex (./3b.toc) (./10.tex (./3b.toc)
14. (./10.tex [3] (./3b.toc) (./10.tex (./3b.toc) (./10.tex (./3b.toc) (./10.tex
15. (./3b.toc) (./10.tex (./3b.toc) (./10.tex [4] (./3b.toc)
16. ! No room for a new \write.
17. \e@ch@ck ...message {No room for a new \string #4}
18. \fi \fi
19. l.42 \tableofcontents

The files were ones that had built in the past, and then when I tried to build them again, they would fail. What's strange is that there is no 9.tex or 10.tex file anywhere in the source (or the imported) tex files. Although there are ones in the same directory. I don't understand why it's looking for them. I found that if I stripped everything out of the imported tex files, so it was a skeleton almost, it still failed to build. Finally, I moved the tex file from its original directory, put it in a fresh directory, and it built immediately.

Would a directory with say 100 files be a problem to pdflatex? Is there a way to get more detailed output in the log for what it's trying to do? Any help much appreciated. I can provide the imported tex files if requested. Here's the main tex file:

1. \documentclass[11pt]{book}
2. \usepackage{standalone}
3. \usepackage{import}
4. \usepackage{graphicx}
5. \usepackage{caption}
6. \usepackage{xcolor}
7. \title{Title of doc}
8. %for c code (maybe not required)
9. \usepackage{listings}
10. \lstset{
11. basicstyle=\small\ttfamily,
12. columns=flexible,
13. breaklines=true
14. language=C %todo: custom language
15. }
16.
17.
18.
19. \paperheight=9in
20. \paperwidth=6in
21. \pdfpagewidth=6in
22. \pdfpageheight=9in
23.
24. \setlength{\pdfpagewidth}{\paperwidth}
25. \setlength{\pdfpageheight}{\paperheight}
26.
27. \usepackage[vcentering,dvips]{geometry}
28. \geometry{papersize={6in,9in},total={4.5in,6.8in}}
29.
30. \begin{document}
31.
32.
33. \tableofcontents
34.
35. \maketitle
36.
37. \begin{center}
38. \textbf{Preface:}
39. \vspace{0.2in}
40. \end{center}
41.
42. placeholder text...
43.
44.
45. \section{Door}
46. \import{/home/layoutdev/Desktop/code/documentation_general/Projects_2020/Door/docs/}{1b}
47.
48. \section{Car Stereo Replacement}
49. \import{/home/layoutdev/Desktop/code/documentation_general/Projects_2019/Car_Stereo/docs/}{1b}
50.
51. \end{document}

Ijon Tichy
Posts: 392
Joined: Mon Dec 24, 2018 10:12 am
The error message is: "! No room for a new \write." not "No room for a new \string"!

It seems there are to many simultaneously opened *.toc files. and it seems that 10.tex reads recursively 10.tex. Without a really complete minimal working example I cannot say more than already explained.

user40293
Posts: 3
Joined: Mon Jan 11, 2021 6:48 am
No room for a new string is taken from the above log, so it is there, but I think you are correct that the write is the proper error.

Regardless, even after moving to a new directory, I ran into another similar cryptic error. This time it is apparently a well-known capacity Tex exceeded error, text input levels=15... So I'm again caught.

I tried the three options given in the link(lua,morewrites,scrwfile). I also tried adjusting max_open_file in a cnf file in /etc/texmf/texmk.d which was reported in a few places. None of them have any effect.

Perhaps I'm going about this the wrong way. I have a number of tex files that are meant to be imported into my collection as articles. So I've decided to use the \import option. I have used \includepdf in the past, where I imported the some 30 or 40 PDF articles, and that worked without any issue. But this time I wanted to get a proper page count, along with an index, and other normal book fodder, but the import option apparently doesn't work after about importing 5 articles.

EDIT: fixed, see below.
Attachments
22.log
Last edited by user40293 on Tue Jan 12, 2021 8:23 am, edited 2 times in total.

user40293
Posts: 3
Joined: Mon Jan 11, 2021 6:48 am
I was able to track it down. It appears one of my imported articles had a bibliography in it, and when it imported, it was causing a recursive loop, I guess. By commenting out the bibliography tags, I was able to get what I have of the docs to import. That at least explains one of the errors.

So for others, with a similar problem: Strip everything out, and rebuild piece by piece until things break. Then look for any syntax or latex formatting that shouldn't be in an import file. Very hard to wrap your head around this, when you have dozens of articles to import. More verbosity in logs might be of use.

What was difficult, was how inconsistent this error was. Sometimes it would error out, sometimes it wouldn't, depending on seemingly unrelated circumstances. Just commenting out the bad article didn't always fix things.. I troubleshoot a lot of software, and this was not straightforward. I think there were two different errors at play.

Also don't assume that lualatex, or the other fixes above are the answer. That's a potential rabbit hole.

Ijon Tichy
Posts: 392
Joined: Mon Dec 24, 2018 10:12 am
user40293 wrote:No room for a new string is taken from the above log, so it is there,

But it is not the error message, it is only the source code line (from the LaTeX kernel) of the error message. This is not the same. Perhaps, it would be a good idea to believe the helpers at least in such basics …

And yes, minimizing a document is the recommended way to locate a problem. That's the reason we almost always ask for a minimal working example.

q.e.d.