TeX 容量超出...\lst@framelr ->\copy \lst@framebox

TeX 容量超出...\lst@framelr ->\copy \lst@framebox

以下是我尝试包含 Matlab 文件后收到的错误。

! TeX capacity exceeded, sorry [main memory size=3000000]. \lst@framelr ->\copy \lst@framebox

下面给出的代码编译时出现错误。问题就在这里,如果 XeLaTeX 决定以某种方式自行第二次运行代码,我不会收到错误。即使我删除 PDF 和 SYNC 文件,我也会收到错误。我能够使用 LauTeX 编译代码而不会出现错误。只有在使用 XeLaTeX 时才会收到错误。

我只是想知道是否可以从这篇文章中解读出此错误的原因以及如何修复它?谢谢。

\documentclass[a4paper, 10pt, oneside, fleqn, openright]{report}

\usepackage{calc}
\usepackage[left=1.5cm, right=1.6cm, bindingoffset=1.5cm, headheight=30pt, bottom=3cm, top={120pt+10mm}]{geometry}
\usepackage{graphicx, rotating, ltablex, dcolumn, booktabs}
\usepackage{siunitx,mleftright}
\usepackage{textcomp}
\graphicspath{{Pictures/}}

\usepackage[usenames,dvipsnames,svgnames,table,xcdraw]{xcolor}

\definecolor{myblueii}{RGB}{63,200,244}
\definecolor{myblueiii}{RGB}{199,234,253}
\newcommand*{\maincolor}{myblue}

\usepackage{tikz}
\usepackage{tkz-euclide}
\usetikzlibrary{shadows.blur}
\usetikzlibrary{calc}
\usepackage{eso-pic}
\usepackage{pgfplots,pgfplotstable}
\usepgfplotslibrary{external}
\usepackage{longtable}
\usepackage{array}
\usepackage{blkarray}
\usepackage{colortbl}
\usepackage{filecontents}
\usepackage{listings}
\usepackage{lstlinebgrd}
\usepackage{multicol}
\usepackage{lipsum}
\usepackage[font={color=mybluei},figurename=Fig.,labelfont={bf}]{caption}

%======================================================================================
%   FONTS
%======================================================================================
\usepackage{polyglossia}
\setdefaultlanguage{english}

\usepackage{avant}
\usepackage{microtype}
\usepackage[T1]{fontenc}

\newcommand{\listofdataname}{List of Data}
\newcommand{\listofresultname}{List of Results}
\newcommand{\listofmatlabname}{List of Matlab Code}
\usepackage[explicit,calcwidth]{titlesec}
\usepackage{fourier}

\usetikzlibrary{tikzmark,calc,arrows,shapes,decorations.pathreplacing,pgfplots.groupplots, matrix}
\pgfplotsset{compat=newest, title/.append style={align =center}}
\tikzset{every picture/.style={remember picture}}
\pagestyle{plain}

\newcounter{result}
\newcounter{matlab}

\usepackage{xpatch}

\usepackage{amsmath,amsfonts,amssymb,amsthm, bm} % For math equations, theorems, symbols, etc

\RequirePackage[framemethod=default]{mdframed} % Required for creating the theorem, definition, exercise and corollary boxes

\usepackage[sorting=none,sortcites=true,autopunct=true,autolang=hyphen,hyperref=true,backref=true,abbreviate=false,backend=biber]{biblatex}
\addbibresource{../References/chapter1.bib}% BibTeX

\usepackage{bookmark}

\usepackage[most]{tcolorbox}
\usepackage[numbered,framed]{matlab-prettifier}

\newcommand\ph\mlplaceholder
\makeatletter
\renewcommand\phOpDelim@mlpr{$\langle$}
\renewcommand\phClDelim@mlpr{$\rangle$}
\makeatother

\tcbuselibrary{skins,breakable,listings}

\newtcbinputlisting[use counter=result,list inside=result,number within=chapter,list type=result]{\inputresult}[3][]{%listing options={style=mystyleresults},%
    list text = {#2},
    enhanced,noparskip,breakable,colback=myblueiii,colbacktitle = myblueii,
    %opacitybacktitle=0,%
    title after break={\centering\footnotesize\itshape\bfseries\strut Result~\theresult~--~continued},%
    listing only,listing options={xleftmargin=-1mm,#1,style=mystyleresults},after upper={\centering\strut{\bfseries Result~\theresult:}~#2},%
    listing file={#3},#1}
\newtcbinputlisting[use counter=matlab,list inside=matlab,number within=chapter,list type=matlab]{\inputmatlab}[3][]{%
    list text = {#2},
    enhanced,noparskip,breakable,colback=myblueiii,opacitybacktitle=.8,%
    fonttitle=\bfseries,before upper={\hspace*{-1em}{#3}},%
    title after break={\centering\footnotesize\itshape\strut Matlab Code~\thematlab~--~continued},%
    listing only,listing options={frame=none,xleftmargin=-1mm,#1,numbersep=18pt,style=Matlab-editor,basicstyle=\mlttfamily\scriptsize},
    after upper={\centering\strut {\bfseries Matlab Code~\thematlab:}~#2},
    frame hidden,arc=0pt,outer arc=0pt,boxrule=0pt,
    overlay={\draw[gray!80,line width=1mm] ([xshift=-0.5pt]frame.north west) -- ([xshift=-0.5pt]frame.south west);},
    %
    listing file={#3},#1}
\lstdefinestyle{mystyleresults}{
    commentstyle=\color{codegreen},
    keywordstyle=\color{black},
    numberstyle=\tiny\color{codegray},
    stringstyle=\color{black},
    basicstyle=\ttfamily\scriptsize,
    breakatwhitespace=false,
    breaklines=true,
    captionpos=b,
    keepspaces=true,
    numbers=none,
    numbersep=5pt,
    showspaces=false,
    showstringspaces=false,
    showtabs=false,
    tabsize=6
}

\makeatletter
\newcommand{\ttll@result}{-1000}
\newcommand{\ttll@matlab}{-1000}
\makeatother

\begin{filecontents*}{sample.m}
%MDL_PUMA560 Create model of Puma 560 manipulator
%
% MDL_PUMA560 is a script that creates the workspace variable p560 which
% describes the kinematic and dynamic characteristics of a Unimation Puma
% 560 manipulator using standard DH conventions.
%
% Also define the workspace vectors:
%   qz         zero joint angle configuration
%   qr         vertical 'READY' configuration
%   qstretch   arm is stretched out in the X direction
%   qn         arm is at a nominal non-singular configuration
%
% Notes::
% - SI units are used.
% - The model includes armature inertia and gear ratios.
%
% Reference::
% - "A search for consensus among model parameters reported for the PUMA 560 robot",
%   P. Corke and B. Armstrong-Helouvry,
%   Proc. IEEE Int. Conf. Robotics and Automation, (San Diego),
%   pp. 1608-1613, May 1994.
%
% See also SerialRevolute, mdl_puma560akb, mdl_stanford.

% MODEL: Unimation, Puma560, dynamics, 6DOF, standard_DH

%
% Notes:
%    - the value of m1 is given as 0 here.  Armstrong found no value for it
% and it does not appear in the equation for tau1 after the substituion
% is made to inertia about link frame rather than COG frame.
% updated:
% 2/8/95  changed D3 to 150.05mm which is closer to data from Lee, AKB86 and Tarn
%  fixed errors in COG for links 2 and 3
% 29/1/91 to agree with data from Armstrong etal.  Due to their use
%  of modified D&H params, some of the offsets Ai, Di are
%  offset, and for links 3-5 swap Y and Z axes.
% 14/2/91 to use Paul's value of link twist (alpha) to be consistant
%  with ARCL.  This is the -ve of Lee's values, which means the
%  zero angle position is a righty for Paul, and lefty for Lee.
%  Note that gravity load torque is the motor torque necessary
%  to keep the joint static, and is thus -ve of the gravity
%  caused torque.
%
% 8/95 fix bugs in COG data for Puma 560. This led to signficant errors in
%  inertia of joint 1.
% $Log: not supported by cvs2svn $
% Revision 1.4  2008/04/27 11:36:54  cor134
% Add nominal (non singular) pose qn


% Copyright (C) 1993-2017, by Peter I. Corke
%
% This file is part of The Robotics Toolbox for MATLAB (RTB).
%
% RTB is free software: you can redistribute it and/or modify
% it under the terms of the GNU Lesser General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% RTB is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
% GNU Lesser General Public License for more details.
%
% You should have received a copy of the GNU Leser General Public License
% along with RTB.  If not, see <http://www.gnu.org/licenses/>.
%
% http://www.petercorke.com

clear L
deg = pi/180;

% joint angle limits from
% A combined optimization method for solving the inverse kinematics problem...
% Wang & Chen
% IEEE Trans. RA 7(4) 1991 pp 489-
L(1) = Revolute('d', 0, 'a', 0, 'alpha', pi/2, ...
    'I', [0, 0.35, 0, 0, 0, 0], ...
    'r', [0, 0, 0], ...
    'm', 0, ...
    'Jm', 200e-6, ...
    'G', -62.6111, ...
    'B', 1.48e-3, ...
    'Tc', [0.395 -0.435], ...
    'qlim', [-160 160]*deg );

L(2) = Revolute('d', 0, 'a', (0.4318+0.0005), 'alpha', 0, ...
    'I', [0.13, 0.524, 0.539, 0, 0, 0], ...
    'r', [-0.3638, 0.006, 0.2275], ...
    'm', 17.4, ...
    'Jm', 200e-6, ...
    'G', 107.815, ...
    'B', .817e-3, ...
    'Tc', [0.126 -0.071], ...
    'qlim', [-45 225]*deg );

L(3) = Revolute('d', 0.15005, 'a', 0.0203, 'alpha', -pi/2,  ...
    'I', [0.066, 0.086, 0.0125, 0, 0, 0], ...
    'r', [-0.0203, -0.0141, 0.070], ...
    'm', 4.8, ...
    'Jm', 200e-6, ...
    'G', -53.7063, ...
    'B', 1.38e-3, ...
    'Tc', [0.132, -0.105], ...
    'qlim', [-225 45]*deg );

L(4) = Revolute('d', 0.4318, 'a', 0, 'alpha', pi/2,  ...
    'I', [1.8e-3, 1.3e-3, 1.8e-3, 0, 0, 0], ...
    'r', [0, 0.019, 0], ...
    'm', 0.82, ...
    'Jm', 33e-6, ...
    'G', 76.0364, ...
    'B', 71.2e-6, ...
    'Tc', [11.2e-3, -16.9e-3], ...
    'qlim', [-110 170]*deg);

L(5) = Revolute('d', 0, 'a', 0, 'alpha', -pi/2,  ...
    'I', [0.3e-3, 0.4e-3, 0.3e-3, 0, 0, 0], ...
    'r', [0, 0, 0], ...
    'm', 0.34, ...
    'Jm', 33e-6, ...
    'G', 71.923, ...
    'B', 82.6e-6, ...
    'Tc', [9.26e-3, -14.5e-3], ...
    'qlim', [-100 100]*deg );


L(6) = Revolute('d', 0, 'a', 0, 'alpha', 0,  ...
    'I', [0.15e-3, 0.15e-3, 0.04e-3, 0, 0, 0], ...
    'r', [0, 0, 0.032], ...
    'm', 0.09, ...
    'Jm', 33e-6, ...
    'G', 76.686, ...
    'B', 36.7e-6, ...
    'Tc', [3.96e-3, -10.5e-3], ...
    'qlim', [-266 266]*deg );

p560a = SerialLink(L, 'name', 'Puma 560_a', ...
    'manufacturer', 'Unimation', 'ikine', 'puma', 'comment', 'viscous friction; params of 8/95');


p560a.model3d = 'UNIMATE/puma560';

%
% some useful poses
%
qz = [0 0 0 0 0 0]; % zero angles, L shaped pose
qr = [0 pi/2 -pi/2 0 0 0]; % ready pose, arm up
qs = [0 0 -pi/2 0 0 0];
qn=[0 pi/4 pi 0 pi/4  0];


clear L

\end{filecontents*}

\begin{document}
\lstlistoflistings

\tcblistof[\chapter*]{matlab}{\listofmatlabname}
\tcblistof[\chapter*]{result}{\listofresultname}

\chapter{New Code}

\inputresult[label=restult:testresult1]{Expansion Algorithm}{sample.m}
\inputresult[label=restult:testresult1]{Expansion Algorithm}{sample.m}
\inputmatlab[label=thisisatestlabel10]{This is a very long name for the Code that I hope will work}{sample.m}
\end{document} 

答案1

这不是一个真正的错误,只是你的数据太大了,你需要为 xetex 指定更大的主内存,我没有收到任何错误,但主内存使用量(刚好!)超过了 3000000

Here is how much of TeX's memory you used:
 65499 strings out of 493010
 1498515 string characters out of 6135495
 3011727 words of memory out of 5000000
 68392 multiletter control sequences out of 15000+600000
 629301 words of font info for 93 fonts, out of 8000000 for 9000
 1348 hyphenation exceptions out of 8191
 75i,6n,128p,10373b,3284s stack positions out of 5000i,500n,10000p,200000b,80000s

Output written on pp726.pdf (10 pages).

您可能需要加载更少的包(您真的在一个文档中使用所有这些包吗?

我的 texmf.cnf 说

main_memory = 5000000 % words of inimemory available; also applies to inimf&mp

我认为这是 texlive 的默认设置,但也许我之前已经增加过它,我不记得了。无论如何,您应该能够在本地 texmf.cnf 中增加此数字。

您可以使用

kpsewhich --all texmf.cnf

看看那是在哪里。

相关内容