-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
literalinclude xml: TeX capacity exceeded, sorry [main memory size=3000000]. #3099
Comments
I have tested it on 1.4.8 (and on master branch), and I can go up to 1487 lines, there is an error starting with 1488 lines, but it is not one on main memory and it is slightly different (and more depressing):
This comes from use of package edit: 1488+the two
However I don't understand your memory error. If it really is the first error, it would be interesting to know which version of Sphinx you use and how up-to-date is your MikTeX install. The dimension too big error is dramatic and there is nothing we can do about it apart from finding a completely different way to handle breakable frames. memo: The package
This looks promising because However you error is otherwise, on TL2016, the TeX main memory size is at 5000000, yours is set at 3000000, I recall that was old setting for TL too, but don't remember which year. I am not familiar with MikTeX but this explains how to increase the main memory size. This may be your better option, if that's really the problem. But I am afraid you will hit the dimension too large error next. Maybe you are lucky and the literal include is small enough to not trigger it. But if you have too many lines your only option then is to split the literal-include into smaller pieces (note that in my test the output occupies about 26 usletter pages). Notice that Sphinx 1.0 already used "framed.sty" package to draw the frame around literal includes or code blocks. Thus this problem has been there for a long time. With Sphinx 1.5 you will be able modify the font size used for code blocks. Insert this .. raw:: latex
\fvset{fontset=\footnotesize} before the location of the literal include. You can reset it to |
For info, I tested tcolorbox and could typeset, replacing in the tex file thesphinxVerbatim environment by (this example had no special characters in need of being escaped from TeX)
up to about
in the preamble. The problem is that this LaTeX package needs TL2012 at least, has had quite active development since and needs TikZ which itself became really stable about two years ago (it was probably stable already but at least in some directions there were breaking change, like the dev notes: adopting Ultimately if at some point in the future tcolorbox replaces framed, then the Sphinx LaTeX code could become much easier to maintain, as currently framed is used by sphinx.sty in a way requiring expert level at LaTeX. |
Thanks for investigating.
I installed both Sphinx 1.4.8 ( Is TL referring to TeX Live? Is that recommended for Sphinx over MikTeX? I don't know much about LaTeX, I just want a way to create a PDF. |
Yes, TL refers to TeX Live. No, it is not especially recommended over MikTeX, you should be fine with MikTeX. It happens that TeX Live has a higher default memory setting for TeX it seems, but you can increase it in MikTeX too, as explained in the link I referred too (I don't have any experience with Windows, hence don't know about MikTeX). Sorry for having put much information in my two posts above. A feature of TeX Live is that it gets updated from May to May, then it gets frozen, and you must re-install it entirely. They rarely update binaries in-between, but only the macro packages. If you add to this that Ubuntu used to distribute already old versions, you end up with situation that a Linux user of Sphinx may well have TeXLive 2009, in its initial release of June 2009, that it never was updated after that, and anyhow even fully updated contains macro packages of April-May 2010 at the best. I did not reproduce the memory error you reported, possibly because of the higher memory setting in TeXLive. |
I have reproduced your issue with Sphinx 1.4.8, after having re-configured TeXLive 2016 to use a reduced TeX memory setting at 3000000. Maybe I should have started with that ! The good news is that if you find the way to tell MikTeX to regenerate the format files with a memory setting increased at 5000000 words of memory, your problem will be solved ! (because you have a literalinclude of only about 1000 lines) |
The second good news is that there is no problem with the master branch of Sphinx (but there is on the stable branch). Hence even if you don't manage to increase the TeX main memory, you have another escape which would be use the current master branch. |
ah sorry no, it worked on master branch because I had conf.py configured to use Well, to sum up you must increase the memory of TeX, and as long as your literal includes do not exceed about 1500 lines (about 26 pages) you should be ok. |
@jfbu Are there anything to do on sphinx side? |
@tk0miya there is nothing to do on Sphinx side currently. The original issue at 1000 lines was explained from a too low memory setting in MikTeX. Investigation revealed an intrinsic limitation currently in Sphinx that code-blocks or literal includes must each have less than about 1500 lines. In future we could allow up to about 6000 lines, by refactoring sphinx.sty to use package tcolorbox rather than package framed. But package tcolorbox requires recent up-to-date and complete TeX installation. It seems with tcolorbox one can go even beyond that extended range via its "unlimited" style option, but this probably also requires from user to extend TeX's memory as well. |
Thanks, |
The command "make doc-guides-pdf" is failing because there are more than 1500 lines in the file MAINTAINERS which is included in the contributing guide. We are facing the issue mentioned in this comment: sphinx-doc/sphinx#3099 (comment) Anyway the file MAINTAINERS is mentioned several times in the guide. So the "literalinclude" is removed from the guide to fix the build of the PDF. Signed-off-by: Thomas Monjalon <thomas@monjalon.net> Signed-off-by: 0-day Robot <robot@bytheb.org>
The command "make doc-guides-pdf" is failing because there are more than 1500 lines in the file MAINTAINERS which is included in the contributing guide. We are facing the issue mentioned in this comment: sphinx-doc/sphinx#3099 (comment) Anyway the file MAINTAINERS is mentioned several times in the guide. So the "literalinclude" is removed from the guide to fix the build of the PDF. Signed-off-by: Thomas Monjalon <thomas@monjalon.net> Tested-by: Ferruh Yigit <ferruh.yigit@intel.com>
[ upstream commit d3ce1dc ] The command "make doc-guides-pdf" is failing because there are more than 1500 lines in the file MAINTAINERS which is included in the contributing guide. We are facing the issue mentioned in this comment: sphinx-doc/sphinx#3099 (comment) Anyway the file MAINTAINERS is mentioned several times in the guide. So the "literalinclude" is removed from the guide to fix the build of the PDF. Signed-off-by: Thomas Monjalon <thomas@monjalon.net> Tested-by: Ferruh Yigit <ferruh.yigit@intel.com>
I'd like to reopen this issue because we've been seeing this issue quite often in OpenStack. I also have a very simple reproducer, described below. We don't control the memory limit everywhere docs are built (primarily in CI environments, though I suspect readthedocs will have the same issue) so this isn't an option. I wonder if we could do one of the following:
(@jfbu, I suspect this is mostly aimed at you 😄) |
Forgot the reproducer (attachment). For reference, I'm just creating a new project using |
- Enable PDF documentation. Based on [1]. - Enable table of contents generation for pdf - Removed literalinclude of designate.conf [2] - Removed illegal character (a literal ESC) - Fix incorrect column count in backends summary section - Replace nodes.line() with nodes.paragraph() [1] https://review.opendev.org/601659 [2] sphinx-doc/sphinx#3099 Change-Id: Ie454f8f9ebc8e36347ce33b22f2e6da0257fe4e0 Signed-off-by: Nicolas Bock <nicolas.bock@suse.com>
* Update designate from branch 'master' - Merge "Add pdf-docs env to tox.ini" - Add pdf-docs env to tox.ini - Enable PDF documentation. Based on [1]. - Enable table of contents generation for pdf - Removed literalinclude of designate.conf [2] - Removed illegal character (a literal ESC) - Fix incorrect column count in backends summary section - Replace nodes.line() with nodes.paragraph() [1] https://review.opendev.org/601659 [2] sphinx-doc/sphinx#3099 Change-Id: Ie454f8f9ebc8e36347ce33b22f2e6da0257fe4e0 Signed-off-by: Nicolas Bock <nicolas.bock@suse.com>
[ upstream commit d3ce1dc ] The command "make doc-guides-pdf" is failing because there are more than 1500 lines in the file MAINTAINERS which is included in the contributing guide. We are facing the issue mentioned in this comment: sphinx-doc/sphinx#3099 (comment) Anyway the file MAINTAINERS is mentioned several times in the guide. So the "literalinclude" is removed from the guide to fix the build of the PDF. Signed-off-by: Thomas Monjalon <thomas@monjalon.net> Tested-by: Ferruh Yigit <ferruh.yigit@intel.com>
* Update nova from branch 'master' - Merge "PDF documentation build" - PDF documentation build - Add a new pdf-docs environment to enable PDF build. - sphinxcontrib-svg2pdfconverter is used to handle SVG properly. - maxlistdepth=10 in latex_elements is needed to handle deeper levels of nesting. - Sample config/policy files are skipped in the PDF document as inline sample files cause LaTeX error [1] and direct links in PDF doc is discouraged. Note that sample-config and sample-policy need to be excluded to avoid the LaTeX error [1] and :orphan: is specified in those files. [1] sphinx-doc/sphinx#3099 Change-Id: I3aaea1d15a357f550f529beaa84fb1a1a7748358
- Add a new pdf-docs environment to enable PDF build. - sphinxcontrib-svg2pdfconverter is used to handle SVG properly. - maxlistdepth=10 in latex_elements is needed to handle deeper levels of nesting. - Sample config/policy files are skipped in the PDF document as inline sample files cause LaTeX error [1] and direct links in PDF doc is discouraged. Note that sample-config and sample-policy need to be excluded to avoid the LaTeX error [1] and :orphan: is specified in those files. [1] sphinx-doc/sphinx#3099 Change-Id: I3aaea1d15a357f550f529beaa84fb1a1a7748358
- Add a new pdf-docs environment to enable PDF build. - sphinxcontrib-svg2pdfconverter is used to handle SVG properly. - maxlistdepth=10 in latex_elements is needed to handle deeper levels of nesting. - Specify openany in extraclassoptions to skip blank pages (oneside is also specified to use the same page layout for even and odd pages) - tocdepth is set to 2 for better PDF TOC - printindex and makeindex are set to empty in latex_elements to avoid an empty "Index" section in PDF - Sample config/policy files are skipped in the PDF document as inline sample files cause LaTeX error [1] and direct links in PDF doc is discouraged. Note that sample-config and sample-policy need to be excluded to avoid the LaTeX error [1] and :orphan: is specified in those files. [1] sphinx-doc/sphinx#3099 Change-Id: I70100a71114e1d75833e6c783086325baa0e3fd2
* Update cyborg from branch 'master' - Generate PDF documentation - Add a new pdf-docs environment to enable PDF build. - sphinxcontrib-svg2pdfconverter is used to handle SVG properly. - maxlistdepth=10 in latex_elements is needed to handle deeper levels of nesting. - Specify openany in extraclassoptions to skip blank pages (oneside is also specified to use the same page layout for even and odd pages) - tocdepth is set to 2 for better PDF TOC - printindex and makeindex are set to empty in latex_elements to avoid an empty "Index" section in PDF - Sample config/policy files are skipped in the PDF document as inline sample files cause LaTeX error [1] and direct links in PDF doc is discouraged. Note that sample-config and sample-policy need to be excluded to avoid the LaTeX error [1] and :orphan: is specified in those files. [1] sphinx-doc/sphinx#3099 Change-Id: I70100a71114e1d75833e6c783086325baa0e3fd2
I encountered the same issue with large files in our Sphinx documentation when converting to PDF. Specifically, including a requirements.txt file with more than 1365 lines using the literalinclude directive causes the PDF build to fail. As a workaround, we had to split the inclusion into multiple literalinclude directives, each covering fewer than 1365 lines. This solution works but is not ideal for maintaining large or frequently changing files. Version we use: |
@tjchhajed Thanks for reviving this issue. We must solve it, I agree. Thinking about it I see now a strategy which we could implement and solve this. The idea is simply to let the LaTeX file contain code-blocks contents split in successive chunks with say at most 900 lines each, which is very easy to do on the Python side, but must be inside suitable LaTeX mark-up with associated TeX code which is definitely not a two-minutes job. (simpler aspects will be to take care of codeline numbers, possible highlights, much more difficult wll be to join the chunks in the output in a smooth way with no separation). I hope to handle it during next two months or so, if not contributed by someone else, and perhaps much earlier, but right now I can not due to other tasks. edit: a completely different strategy would be to try to produce same output as currently but without using at all the LaTeX |
A document with just the following fails:
where
large.xml
is about 1000 lines of this:(for some reason the 16 spaces indentation are important to trigger this)
The error is:
The text was updated successfully, but these errors were encountered: