使用 STCopy 和宏时,spreadtab 内存不足

使用 STCopy 和宏时,spreadtab 内存不足

以下代码使用 填充表格\STCopy。它会生成“超出保存大小错误”[MiKTeX 2.9]。

如果我把表格缩小一点(通过注释掉一行)或者删除调用max(只使用调用的第二个参数),它就会起作用。有什么办法让它“按原样”工作吗?请注意,对的调用max不是直接解决问题,因为可以通过删除它并向表中添加更多行来复制该问题。

我已经设定了save size=50000

谢谢!

\documentclass[a4paper, 12pt]{article}

\usepackage{spreadtab}
\usepackage{multirow}
\usepackage{rotating}

\begin{document}

\begin{table}[h]
\centering
\STautoround{0}
\begin{spreadtab}{{tabular}{|l|r||c|c|c||c|c|c||c|c|c||}}
\hline
% Data rows (hidden)
& & :={65}kt & :={[-1,0]}kt & :={[-1,0]}kt & :={85}kt & :={[-1,0]}kt & :={[-1,0]}kt & :={95}kt & :={[-1,0]}kt & :={[-1,0]}kt \SThiderow \\
& & :={500}ft & :={800}ft & :={1500}ft & :={[-3,0]}ft & :={[-3,0]}ft & :={[-3,0]}ft & :={[-3,0]}ft & :={[-3,0]}ft & :={[-3,0]}ft \SThiderow \\
& & :={1.68780986}ft/s & & & & & & & & \SThiderow \\
% Output
@ \multirow{7}{*}{\begin{sideways}\bf . \end{sideways}} & \bf :={0} & \STcopy{>,v}{max(5,c!2/((c!1-!b4)*!c!3)+0.5)}s & :={}s & :={}s & :={}s & :={}s & :={}s & :={}s & :={}s & :={}s \\\cline{3-11}
& \bf \STcopy{v6}{b4+10} & :={}s & :={}s & :={}s & :={}s & :={}s & :={}s & :={}s & :={}s & :={}s \\\cline{3-11}
& \bf :={}               & :={}s & :={}s & :={}s & :={}s & :={}s & :={}s & :={}s & :={}s & :={}s \\\cline{3-11}
& \bf :={}               & :={}s & :={}s & :={}s & :={}s & :={}s & :={}s & :={}s & :={}s & :={}s \\\cline{3-11}
& \bf :={}               & :={}s & :={}s & :={}s & :={}s & :={}s & :={}s & :={}s & :={}s & :={}s \\\cline{3-11}
& \bf :={}               & :={}s & :={}s & :={}s & :={}s & :={}s & :={}s & :={}s & :={}s & :={}s \\\cline{3-11}
& \bf :={}               & :={}s & :={}s & :={}s & :={}s & :={}s & :={}s & :={}s & :={}s & :={}s \\\cline{3-11}
& \bf :={}               & :={}s & :={}s & :={}s & :={}s & :={}s & :={}s & :={}s & :={}s & :={}s \\\hline
\end{spreadtab}
\end{table}

\end{document}

编辑后添加:

我需要所有这些:={}<unit>来显示计量单位。

答案1

spreadtab我以前没有使用过,xstring但是 xstring\groupID使用本地和全局分配重复分配,这是填充保存堆栈的通常方法。

如果我更改本地副本,使所有分配都是全局的,那么您的示例就可以工作,并且我得到

在此处输入图片描述

但我不知道这是否是预期的结果>

我应用的差异如下。

与您的问题无关,但表格参数[h]只是使得表格很可能到达文档末尾,始终p至少包含类似[htp]


*** xstring.tex~    2012-11-29 09:38:39.484507200 +0000
--- xstring.tex 2012-11-29 09:41:38.830854400 +0000
***************
*** 427,433 ****
  % si l'occurrence n'existe pas ou qu'un des arguments est vide, toutes les chaines renvoy\'ees sont vides
  \def\@xs@cutafteroccur#1#2#3{%
    \def\@xs@reserved@D{#1}\let\@xs@reserved@C\@empty\def\@xs@reserved@E{#2}%
!   \decimalpart\z@\integerpart\z@\def\groupID{0}\let\@xs@nestlevel\z@
    \def\@xs@atendofgroup{%
        \expandafter\endgroup
        \expandafter\@xs@addtomacro\expandafter\@xs@reserved@C\expandafter{\expandafter{\@xs@reserved@C}}%
--- 427,433 ----
  % si l'occurrence n'existe pas ou qu'un des arguments est vide, toutes les chaines renvoy\'ees sont vides
  \def\@xs@cutafteroccur#1#2#3{%
    \def\@xs@reserved@D{#1}\let\@xs@reserved@C\@empty\def\@xs@reserved@E{#2}%
!   \decimalpart\z@\integerpart\z@\gdef\groupID{0}\let\@xs@nestlevel\z@
    \def\@xs@atendofgroup{%
        \expandafter\endgroup
        \expandafter\@xs@addtomacro\expandafter\@xs@reserved@C\expandafter{\expandafter{\@xs@reserved@C}}%
***************
*** 449,455 ****
        \let\@xs@reserved@E\@xs@reserved@D
        \expandafter\expandafter\expandafter\def\expandafter\expandafter\expandafter\@xs@reserved@D\expandafter\expandafter\expandafter{\expandafter\@xs@reserved@C\@xs@argument@A}%
    \else
!       \let\@xs@reserved@C\@empty\let\@xs@reserved@E\@empty\let\groupID\@empty
    \fi}

  \@xs@newmacro*3\IfSubStr{1}{2}{0}{%
--- 449,455 ----
        \let\@xs@reserved@E\@xs@reserved@D
        \expandafter\expandafter\expandafter\def\expandafter\expandafter\expandafter\@xs@reserved@D\expandafter\expandafter\expandafter{\expandafter\@xs@reserved@C\@xs@argument@A}%
    \else
!       \let\@xs@reserved@C\@empty\let\@xs@reserved@E\@empty\global\let\groupID\@empty
    \fi}

  \@xs@newmacro*3\IfSubStr{1}{2}{0}{%
***************
*** 534,540 ****
    \expandafter\expandafter\expandafter\@xs@cutafteroccur\expandafter\expandafter\expandafter{\expandafter\@xs@reserved@C\expandafter}\expandafter{\@xs@reserved@A}{#2}%
    \def\@xs@reserved@A{#4}%
    \expandafter\expandafter\expandafter\@xs@cutafteroccur\expandafter\expandafter\expandafter{\expandafter\@xs@reserved@C\expandafter}\expandafter{\@xs@reserved@A}{#1}%
!   \let\groupID\@empty
    \expandafter\@xs@testempty\expandafter{\@xs@reserved@C}%
    \if@xs@empty
        \expandafter\@secondoftwo
--- 534,540 ----
    \expandafter\expandafter\expandafter\@xs@cutafteroccur\expandafter\expandafter\expandafter{\expandafter\@xs@reserved@C\expandafter}\expandafter{\@xs@reserved@A}{#2}%
    \def\@xs@reserved@A{#4}%
    \expandafter\expandafter\expandafter\@xs@cutafteroccur\expandafter\expandafter\expandafter{\expandafter\@xs@reserved@C\expandafter}\expandafter{\@xs@reserved@A}{#1}%
!   \global\let\groupID\@empty
    \expandafter\@xs@testempty\expandafter{\@xs@reserved@C}%
    \if@xs@empty
        \expandafter\@secondoftwo
***************
*** 682,688 ****
        \expandafter
    \endgroup
    \expandafter\@xs@ReturnResult\expandafter{\@xs@reserved@E}{#6}%
!   \let\groupID\@empty}

  \def\exploregroups{\let\@xs@exploregroups\relax}
  \def\noexploregroups{\def\@xs@exploregroups{\let\@xs@toks0\relax}}
--- 682,688 ----
        \expandafter
    \endgroup
    \expandafter\@xs@ReturnResult\expandafter{\@xs@reserved@E}{#6}%
!   \global\let\groupID\@empty}

  \def\exploregroups{\let\@xs@exploregroups\relax}
  \def\noexploregroups{\def\@xs@exploregroups{\let\@xs@toks0\relax}}
***************
*** 694,700 ****
  \@xs@newmacro\StrSubstitute{0}{3}{1}{%
    \def\@xs@reserved@D{#2}\let\@xs@reserved@C\@empty\def\@xs@reserved@E{#3}%
    \def\@xs@argument@C{#3}\def\@xs@argument@D{#4}%
!   \decimalpart\z@\integerpart\z@\def\groupID{0}\let\@xs@nestlevel\z@
    \def\@xs@atendofgroup{%
        \expandafter\endgroup
        \expandafter\@xs@addtomacro\expandafter\@xs@reserved@C\expandafter{\expandafter{\@xs@reserved@C}}%
--- 694,700 ----
  \@xs@newmacro\StrSubstitute{0}{3}{1}{%
    \def\@xs@reserved@D{#2}\let\@xs@reserved@C\@empty\def\@xs@reserved@E{#3}%
    \def\@xs@argument@C{#3}\def\@xs@argument@D{#4}%
!   \decimalpart\z@\integerpart\z@\gdef\groupID{0}\let\@xs@nestlevel\z@
    \def\@xs@atendofgroup{%
        \expandafter\endgroup
        \expandafter\@xs@addtomacro\expandafter\@xs@reserved@C\expandafter{\expandafter{\@xs@reserved@C}}%
***************
*** 729,735 ****
    \def\@xs@reserved@C{#1}%
    \decimalpart\z@
    \let\@xs@nestlevel\z@
!   \def\groupID{0}%
    \let\@xs@atbegingroup\relax
    \def\@xs@atendofgroup{\endgroup\@xs@read@reserved@C}%
    \let\@xs@atnextsyntaxunit\relax
--- 729,735 ----
    \def\@xs@reserved@C{#1}%
    \decimalpart\z@
    \let\@xs@nestlevel\z@
!   \gdef\groupID{0}%
    \let\@xs@atbegingroup\relax
    \def\@xs@atendofgroup{\endgroup\@xs@read@reserved@C}%
    \let\@xs@atnextsyntaxunit\relax
***************
*** 749,755 ****
  \def\@xs@manage@groupID{%
    \begingroup\def\@xs@reserved@A{0}%
    \ifx\@xs@reserved@A\groupID% si on arrive du groupe de niveau 0
!       \endgroup\edef\groupID{\number\integerpart}% on met simplement le niveau
    \else
        \endgroup\expandafter\@xs@addtomacro\expandafter\groupID\expandafter{\expandafter,\number\integerpart}%
    \fi}
--- 749,755 ----
  \def\@xs@manage@groupID{%
    \begingroup\def\@xs@reserved@A{0}%
    \ifx\@xs@reserved@A\groupID% si on arrive du groupe de niveau 0
!       \endgroup\xdef\groupID{\number\integerpart}% on met simplement le niveau
    \else
        \endgroup\expandafter\@xs@addtomacro\expandafter\groupID\expandafter{\expandafter,\number\integerpart}%
    \fi}
***************
*** 760,768 ****
  % Cette macro interne coupe la chaine #2 apr\`es l'unit\'e syntaxique n°#1
  % Le d\'ebut est assign\'e dans \@xs@reserved@B et la fin dans \@xs@reserved@C
  \def\@xs@StrSplit@i#1#2{%
!   \def\@xs@reserved@D{#1}\def\@xs@reserved@C{#2}\let\@xs@reserved@B\@empty\let\groupID\@empty
    \ifnum#1>\z@
!       \decimalpart\z@\integerpart\z@\def\groupID{0}\let\@xs@nestlevel\z@
        \def\@xs@atendofgroup{%
            \expandafter\endgroup
            \expandafter\@xs@addtomacro\expandafter\@xs@reserved@B\expandafter{\expandafter{\@xs@reserved@B}}%
--- 760,768 ----
  % Cette macro interne coupe la chaine #2 apr\`es l'unit\'e syntaxique n°#1
  % Le d\'ebut est assign\'e dans \@xs@reserved@B et la fin dans \@xs@reserved@C
  \def\@xs@StrSplit@i#1#2{%
!   \def\@xs@reserved@D{#1}\def\@xs@reserved@C{#2}\let\@xs@reserved@B\@empty\global\let\groupID\@empty
    \ifnum#1>\z@
!       \decimalpart\z@\integerpart\z@\gdef\groupID{0}\let\@xs@nestlevel\z@
        \def\@xs@atendofgroup{%
            \expandafter\endgroup
            \expandafter\@xs@addtomacro\expandafter\@xs@reserved@B\expandafter{\expandafter{\@xs@reserved@B}}%
***************
*** 794,800 ****
        \expandafter\expandafter\expandafter\@xs@StrSplit@i\expandafter\expandafter\expandafter{\expandafter\@xs@reserved@C\expandafter}\expandafter{\@xs@reserved@B}%
    \expandafter\endgroup
    \expandafter\@xs@ReturnResult\expandafter{\@xs@reserved@C}{#4}%
!   \let\groupID\@empty}

  % supprime #2 unit\'es syntaxiques \`a gauche dans la chaine #1
  \@xs@newmacro\StrGobbleLeft{}{2}{1}{%
--- 794,800 ----
        \expandafter\expandafter\expandafter\@xs@StrSplit@i\expandafter\expandafter\expandafter{\expandafter\@xs@reserved@C\expandafter}\expandafter{\@xs@reserved@B}%
    \expandafter\endgroup
    \expandafter\@xs@ReturnResult\expandafter{\@xs@reserved@C}{#4}%
!   \global\let\groupID\@empty}

  % supprime #2 unit\'es syntaxiques \`a gauche dans la chaine #1
  \@xs@newmacro\StrGobbleLeft{}{2}{1}{%
***************
*** 826,832 ****
    \let\@xs@reserved@B\@empty
    \def\@xs@reserved@C{#1}\def\@xs@reserved@D{#2}%
    \ifnum#2>\z@
!       \def\groupID{0}\let\@xs@nestlevel\z@\integerpart\z@\decimalpart\z@
        \let\@xs@atbegingroup\relax
        \def\@xs@atendofgroup{\endgroup\@xs@read@reserved@C}%
        \def\@xs@atnextsyntaxunit{%
--- 826,832 ----
    \let\@xs@reserved@B\@empty
    \def\@xs@reserved@C{#1}\def\@xs@reserved@D{#2}%
    \ifnum#2>\z@
!       \gdef\groupID{0}\let\@xs@nestlevel\z@\integerpart\z@\decimalpart\z@
        \let\@xs@atbegingroup\relax
        \def\@xs@atendofgroup{\endgroup\@xs@read@reserved@C}%
        \def\@xs@atnextsyntaxunit{%
***************
*** 839,845 ****
        \@xs@read@reserved@C
    \fi
    \expandafter\@xs@testempty\expandafter{\@xs@reserved@B}%
!   \if@xs@empty\let\groupID\@empty\fi
    \expandafter\@xs@ReturnResult\expandafter{\@xs@reserved@B}{#3}}

  % Combien de fois compte t-on #2 dans #1 ?
--- 839,845 ----
        \@xs@read@reserved@C
    \fi
    \expandafter\@xs@testempty\expandafter{\@xs@reserved@B}%
!   \if@xs@empty\global\let\groupID\@empty\fi
    \expandafter\@xs@ReturnResult\expandafter{\@xs@reserved@B}{#3}}

  % Combien de fois compte t-on #2 dans #1 ?
***************
*** 849,855 ****
    \if@xs@empty
        \@xs@ReturnResult{0}{#3}%
    \else
!       \decimalpart\z@\integerpart\z@\def\groupID{0}\let\@xs@nestlevel\z@
        \def\@xs@atendofgroup{%
            \expandafter\endgroup
            \expandafter\@xs@addtomacro\expandafter\@xs@reserved@C\expandafter{\expandafter{\@xs@reserved@C}}%
--- 849,855 ----
    \if@xs@empty
        \@xs@ReturnResult{0}{#3}%
    \else
!       \decimalpart\z@\integerpart\z@\gdef\groupID{0}\let\@xs@nestlevel\z@
        \def\@xs@atendofgroup{%
            \expandafter\endgroup
            \expandafter\@xs@addtomacro\expandafter\@xs@reserved@C\expandafter{\expandafter{\@xs@reserved@C}}%
***************
*** 870,876 ****
        \expandafter\@xs@StrLen\expandafter{\@xs@reserved@C}[\@xs@reserved@C]%
        \expandafter\@xs@ReturnResult\expandafter{\number\numexpr\@xs@reserved@C+1}{#4}%
    \fi
!   \let\groupID\@xs@reserved@E}

  \def\comparestrict{\let\@xs@comparecoeff\@ne}
  \def\comparenormal{\let\@xs@comparecoeff\z@}
--- 870,876 ----
        \expandafter\@xs@StrLen\expandafter{\@xs@reserved@C}[\@xs@reserved@C]%
        \expandafter\@xs@ReturnResult\expandafter{\number\numexpr\@xs@reserved@C+1}{#4}%
    \fi
!   \global\let\groupID\@xs@reserved@E}

  \def\comparestrict{\let\@xs@comparecoeff\@ne}
  \def\comparenormal{\let\@xs@comparecoeff\z@}
***************
*** 975,981 ****
        \@xs@expandingroups
        \ifnum#1>\z@
            \integerpart#1\relax
!           \decimalpart\z@\def\groupID{0}\let\@xs@nestlevel\z@
            \def\@xs@atendofgroup{%
                \expandafter\endgroup
                \expandafter\@xs@addtomacro\expandafter\@xs@reserved@B\expandafter{\expandafter{\@xs@reserved@B}}%
--- 975,981 ----
        \@xs@expandingroups
        \ifnum#1>\z@
            \integerpart#1\relax
!           \decimalpart\z@\gdef\groupID{0}\let\@xs@nestlevel\z@
            \def\@xs@atendofgroup{%
                \expandafter\endgroup
                \expandafter\@xs@addtomacro\expandafter\@xs@reserved@B\expandafter{\expandafter{\@xs@reserved@B}}%
***************
*** 993,999 ****
        \global\let\@xs@reserved@B\@xs@reserved@B
    \endgroup
    \let#3\@xs@reserved@B
!   \let\groupID\@empty}
  \def\@xs@StrExpand@i#1{%
    \ifnum#1>\z@
        \let\@xs@reserved@B\@empty
--- 993,999 ----
        \global\let\@xs@reserved@B\@xs@reserved@B
    \endgroup
    \let#3\@xs@reserved@B
!   \global\let\groupID\@empty}
  \def\@xs@StrExpand@i#1{%
    \ifnum#1>\z@
        \let\@xs@reserved@B\@empty

相关内容