# “Tex capacity exceeded, sorry [save size=8000]” on Texpad

I use the Texpad on my iPad. A "TeX capacity exceeded, [save size=8000]" issue occurred when compiling the project.

How to fix?

• Please add the document for what the error happens to your question. – siracusa Jul 17 at 1:42
• @siracusa I think this error irrespective to any document. It just depend on the size of document. – Jong Hyeok Lee Jul 17 at 1:49
• Then paste any document that doesn't work for you, so that we can check if we get the same error. – siracusa Jul 17 at 1:56
• Does your document compile correctly when using a "normal" TeX installation? – Mico Jul 17 at 8:02
• @Mico When I use a Windows 10, my document is compiled correctly. This document has this issue on iPad. – Jong Hyeok Lee Jul 17 at 8:03

Almost always if you use up the save stack you have some construct making local and global assignments to the same thing, which uses up an arbitrary amount of stack, so increasing TeX's stack size (if that is possible on the ipad implementation) probably won't help and you will need to correct the macros.

for example this document will run out of save stack in any implementation.

\documentclass{article}

\begin{document}

{
\loop
\dimen0=3pt
\global\dimen0=4pt
\iftrue
\repeat
}
\end{document}


producing

! TeX capacity exceeded, sorry [save size=80000].
\iterate ->\dimen 0=3pt
\global \dimen 0=4pt \iftrue \relax \expandafter \it...
l.11 \repeat

!  ==> Fatal error occurred, no output PDF file produced!


In theory you can change the stack size in texmf.cnf but in this cygwin texlive 2019 I can only reduce it from its default 80000 so

save_size  = 90000


has no effect but

save_size  = 1000


changes the error to

! TeX capacity exceeded, sorry [save size=1000].
\iterate ->\dimen 0=3pt
\global \dimen 0=4pt \iftrue \relax \expandafter \it...
l.11 \repeat

!  ==> Fatal error occurred, no output PDF file produced!

• Is this work on Windows? This issue occurs on iPadOS. – Jong Hyeok Lee Jul 17 at 8:01
• the above file will give the same error on any tex implementation. It uses an arbitrary amount of stack, your document is most likely the same, you need to fix the macros not look at the tex implementation. – David Carlisle Jul 17 at 8:03