LyX ⇒ Lyx: TeX capacity exceeded
-
- Posts: 3
- Joined: Sat Apr 25, 2020 5:29 am
Lyx: TeX capacity exceeded
I am compiling a large document and which cannot be exported from lyx document to pdf any more.
The error which shows up is "TeX capacity exceeded, sorry [main memory size=5000000]"
I was trying out to change the latex options in lyx but they always were ignored. So I do not know how to proceed.
Maybe you have an idea.
Thanks for the comments.
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
- Ijon Tichy
- Posts: 640
- Joined: Mon Dec 24, 2018 10:12 am
Lyx: TeX capacity exceeded
Main memory is used to hold all macro definitions and the current vertical list. It can only exceed if all valid definitions (this is the LaTeX format + the class + packages + preamble definitions etc.) and a single page or a single paragraph (if does not fit on the current page) needs more than the current setting for main memory. 5 Mio words is a lot of main memory, so with a usual document this never happens. But, e.g., with package pdfplots this indeed can happen, because a plot can consist of several millions of single pixels and each of them needs about a dozend words of main memory. The best suggestion for users of pgfplots is not to use PDFLaTeX or XeLaTeX but LuaLaTeX.
In most other cases exceeded main memory is an indication of a mistake of either a package author or the user. For example
Code: Select all
% WARNING: Don't try this using LuaLaTeX, because it will fill all RAM and swap memory of your computer so it becomes unusable!
\documentclass{article}
\usepackage{blindtext}
\newcommand*{\wam}{\blindtext \wam}
\begin{document}
\wam
\end{document}

-
- Posts: 3
- Joined: Sat Apr 25, 2020 5:29 am
Lyx: TeX capacity exceeded
Thanks for the hint. It was indeed a problem with a macro in lyx. I defined \ht but this was already defined, so I renamed it. Since there are so many errors and warnings which I do not understand properly it is very difficult to find out what was going on.
Many error messages are not really self explanatory that's why they accumulated over time

- Ijon Tichy
- Posts: 640
- Joined: Mon Dec 24, 2018 10:12 am
Lyx: TeX capacity exceeded
And the LaTeX error message for already defined commands is self explaining:
Code: Select all
\newcommand{\ht}{foo}
./test.tex:1: LaTeX Error: Command \ht already defined.
Or name \end... illegal, see p.192 of the manual.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.1 \newcommand{\ht}{foo}
Moreover the redefinition will be ignored. So it can become dangerous mainly, if someone does not use the high level command
\newcommand
that should be used to define a new command, but the low-level TeX primitive \def
that should not be used to define a new command, even less by someone, who does not know, what he/she/it is doing.
-
- Posts: 3
- Joined: Sat Apr 25, 2020 5:29 am
Lyx: TeX capacity exceeded
\global\long\def\htjets{H_{\mathrm{T}}}%
Is used if one adds a macro via the lyx GUI. This solution may not be ideal.
- Ijon Tichy
- Posts: 640
- Joined: Mon Dec 24, 2018 10:12 am
Lyx: TeX capacity exceeded
\ht
but \htjets
. And indeed (in the document preamble) this should not be done using \long\def
but \newcommand
. If really LyX does this itself, this is one more reason for me, not to use it. However I cannot reproduce this with LyX. In a minimal document, it does not add such a definition.