Lualatex、Pdflatex 使用 \externalize 失败

Lualatex、Pdflatex 使用 \externalize 失败

这是我的问题:我有一个 100 多页的文档,其中包含大约 100 个 tikz 图。一些图包含 9000 多个点,使用 pdflatex -shell-escape(或任何 main_memory_size)编译它们会失败。我可以使用 lualatex 编译它,但它需要很长时间。我决定使用:

    \usetikzlibrary{external}
    \tikzset{external/system call={lualatex \tikzexternalcheckshellescape -shell-                escape -halt-on-error -interaction=nonstopmode -jobname "\image" "\texsource"}}
    \tikzexternalize[prefix=TikzFigures/]
    \tikzset{external/force remake}

但它失败了

    "16684 words still in use, bla-bla ...may be you did not enable shell-escape         ...bla-bla write18...please refer to picture-17.log", 

但是该日志中没有错误消息。如果我切换回 pdflatex,并进行适当的调整,错误日志会再次显示内存不足。我以为 lualatex 会动态管理内存,并且当常规编译失败时 externalize 应该可以工作,但是我得到的却是相反的情况。我有 4 核 i7 和 8GB RAM,几乎没用到一半......该怎么办?我使用 TexNic center 和 MikTex,因此在编辑器选项中,我当然会将 -shell-escape 以及 -enable-write18 以所有可能的组合放在 pdflatex 输出配置文件和 lualatex 配置文件中。我有一个包含几个章节的主 .tex 文件,.tex 文件中也有单独的 tikzpistures。此外,如果我从 TikzFigures/ 文件夹中删除所有图像,那么现在 lualatex 和 pdflatex 都会在第一张图像处失败。如果我注释掉负责外部化的行,它就会编译。它花费 5 分钟和 500Mb 内存,但它编译时会发出一个关于 scrbook\float@addtolist 的警告,表明它即将过时。

    \documentclass[fontsize=12,BCOR=0mm]{scrbook}
    \usepackage{etex}
    \usepackage[USenglish]{babel}
    \usepackage{url}
    \usepackage{natbib}
    \usepackage{breakcites}
    \usepackage{enumerate}
    \usepackage{caption}
    \usepackage{nomencl}
    \usepackage{setspace}
    \usepackage{listings}
    \usepackage{booktabs}
    \usepackage{tikz}
    \usepackage{tikzscale}
    \usepackage{pgf}
    \usepackage{pgfplots}
    \usepackage{subfig}
    \pgfplotsset{compat=1.8}
    \pgfplotsset{colormap={my_hot}{[1cm]color(0cm)=(black);
    color(3cm)=(red);color(4cm)=(orange);color(5cm)=(yellow);color(8cm)=(white)}}

    \pgfplotsset{every axis/.append style={line width=1pt, 
    tick style={tick align=outside, line width=0.6pt}}}
    \pgfplotsset{ticks=both}%/.append style={thin}}
    \pgfplotsset{ylabel shift=-4pt}
    \pgfplotsset{yticklabel style={xshift=0.1cm}}
    \pgfplotsset{label style={font=\small}}
    \pgfplotsset{every axis legend/.style={inner ysep=1.5pt}}
    \usetikzlibrary{automata, arrows}
    \usepackage{color}
    \definecolor{light-gray}{gray}{0.95}
    \lstset{backgroundcolor=\color{light-gray}}%, xleftmargin=\noindent} 


    \usepackage{multibib}


    \usetikzlibrary{external}
    \tikzset{external/system call={lualatex \tikzexternalcheckshellescape 
    -enable-write18 -halt-on-error -interaction=nonstopmode 
    -jobname "\image" "\texsource"}}
    \tikzexternalize[prefix=TikzFigures/]
    \tikzset{external/force remake}

    \makenomenclature
    \newcommand{\keywords}[1]{\par\addvspace\baselineskip
    \noindent\keywordname\enspace\ignorespaces#1}
    \setcapindent{0pt} 
    \renewcommand{\nomname}{List of Symbols}

    \makeatletter 
    \renewenvironment{thebibliography}[1]
     {\subsection*{\refname}%
      \@mkboth{\MakeUppercase\refname}{\MakeUppercase\refname}
      \list{\@biblabel{\@arabic\c@enumiv}}
    {\settowidth\labelwidth{\@biblabel{#1}}
    \leftmargin\labelwidth
    \advance\leftmargin\labelsep
    \@openbib@code
    \usecounter{enumiv}
    \let\p@enumiv\@empty
    \renewcommand\theenumiv{\@arabic\c@enumiv}}
      \sloppy
      \clubpenalty4000
      \@clubpenalty \clubpenalty
      \widowpenalty4000%
      \sfcode`\.\@m}
     {\def\@noitemerr
       {\@latex@warning{Empty `thebibliography' environment}}
      \endlist} 
    \makeatother

    \makeindex
    \begin{document}
    \pagenumbering{roman}
    \input{title.tex}
    \maketitle


    \include{abstract}

    \include{acknowledgements}

    \tableofcontents
    \listoftables 
    \listoffigures 

    \clearpage
    \pagenumbering{arabic}

    \include{Abstract}
    \include{Introduction}
    \include{Algorithms}
    \include{Modeling}
    \include{Performance}
    \include{Conclusions}


    \pagestyle{plain}
    \cleardoublepage
    \addcontentsline{toc}{chapter}{List of Symbols}

    \setlength{\nomitemsep}{-0.7\parsep}

    \begin{spacing}{0.4}
    \printnomenclature [14mm]
    \end{spacing}

    \bibliography{paper-bibfile-short}


    \end{document}

! Package tikz Error: Sorry, the system call 'lualatex --shell-escape -intera
ion=nonstopmode -jobname "TikzFigures/phd_thesis-figure17" "\def\tikzexternal
aljob{phd_thesis}\input{phd_thesis}"' did NOT result in a usable output file
ikzFigures/phd_thesis-figure17' (expected one of .pdf:.jpg:.jpeg:.png:). Plea
verify that you have enabled system calls. For pdflatex, this is 'pdflatex -
ell-escape'. Sometimes it is also named 'write 18' or something like that. Or
aybe the command simply failed? Error messages can be found in 'TikzFigures/p
_thesis-figure17.log'. If you continue now, I'll try to typeset the picture.

答案1

为什么不使用 pdflatex 并手动增加内存。

这是一个例子(数字任意大,您可能想尝试一些其他值)

  \tikzset{external/system call= {pdflatex -save-size=80000 
                           -pool-size=10000000 
                           -extra-mem-top=50000000 
                           -extra-mem-bot=10000000 
                           -main-memory=90000000 
                           \tikzexternalcheckshellescape 
                           -halt-on-error 
                           -interaction=batchmode
                           -jobname "\image" "\texsource"}} 

相关内容