我想使用包将一些伪代码添加到我的文档中program
,但是当我将包添加到我的文档时,我收到以下错误。我发现问题是由包todonotes
和之间的冲突引起的program
。这是一个最小(非)工作示例,用于重现我的问题。我的问题是:是否有可能解决这个问题(这意味着,我想保留这两个包,因为我目前todonotes
在文档中大量使用 )。
\documentclass{scrbook}
\usepackage{program}
\usepackage[textsize=footnotesize]{todonotes}
\begin{document}
Hello world!
\end{document}
我收到的错误:
There were errors in your LaTeX source
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/math/pgfmathparser.code.tex:673: Missing \endcsname inserted. [...eoperator{||}{or} {2}{infix} {200}]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/math/pgfmathparser.code.tex:673: Missing \endcsname inserted. [...eoperator{||}{or} {2}{infix} {200}]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/math/pgfmathparser.code.tex:673: Missing \endcsname inserted. [...eoperator{||}{or} {2}{infix} {200}]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/math/pgfmathparser.code.tex:673: Missing \endcsname inserted. [...eoperator{||}{or} {2}{infix} {200}]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/math/pgfmathparser.code.tex:673: Missing \endcsname inserted. [...eoperator{||}{or} {2}{infix} {200}]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransformations.code.tex:15: No room for a new \dimen . [\newdimen\pgf@pt@x]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransformations.code.tex:16: No room for a new \dimen . [\newdimen\pgf@pt@y]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransformations.code.tex:18: No room for a new \dimen . [\newdimen\pgf@pt@temp]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/basiclayer/pgfcorearrows.code.tex:562: Missing \endcsname inserted. [}]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/basiclayer/pgfcorearrows.code.tex:562: Extra \endcsname. [}]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/basiclayer/pgfcorearrows.code.tex:562: Extra \else. [}]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/basiclayer/pgfcorearrows.code.tex:562: Missing \endcsname inserted. [}]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/basiclayer/pgfcorearrows.code.tex:562: Missing \endcsname inserted. [}]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/basiclayer/pgfcorearrows.code.tex:562: Missing \endcsname inserted. [}]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/basiclayer/pgfcorearrows.code.tex:562: Missing \endcsname inserted. [}]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/basiclayer/pgfcorearrows.code.tex:562: Package pgf Error: Arrow end type ``\relax \@dovar\hbox {}'' already defined. [}]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreshade.code.tex:15: No room for a new \dimen . [\newdimen\pgf@max]
/usr/local/texlive/2012/texmf-dist/tex/latex/pgf/compatibility/pgfcomp-version-0-65.sty:466: No room for a new \dimen . [\newdimen\pgf@nodesepstart]
/usr/local/texlive/2012/texmf-dist/tex/latex/pgf/compatibility/pgfcomp-version-0-65.sty:467: No room for a new \dimen . [\newdimen\pgf@nodesepend]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/utilities/pgffor.code.tex:13: No room for a new \dimen . [\newdimen\pgffor@iter]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/utilities/pgffor.code.tex:14: No room for a new \dimen . [\newdimen\pgffor@skip]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/libraries/pgflibraryplothandlers.code.tex:872: No room for a new \dimen . [\newdimen\pgfplotmarksize]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex:17: No room for a new \dimen . [\newdimen\tikz@lastx]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex:18: No room for a new \dimen . [\newdimen\tikz@lasty]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex:19: No room for a new \dimen . [\newdimen\tikz@lastxsaved]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex:20: No room for a new \dimen . [\newdimen\tikz@lastysaved]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex:22: No room for a new \dimen . [\newdimen\tikzleveldistance]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex:23: No room for a new \dimen . [\newdimen\tikzsiblingdistance]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex:885: Missing \endcsname inserted. [\tikz@set@pointed{\pgf@arrows@invertto}{to}]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex:885: LaTeX Error: Missing \begin{document}. [\tikz@set@pointed{\pgf@arrows@invertto}{to}]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex:885: Extra \endcsname. [\tikz@set@pointed{\pgf@arrows@invertto}{to}]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex:885: Extra \else. [\tikz@set@pointed{\pgf@arrows@invertto}{to}]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex:885: Missing \endcsname inserted. [\tikz@set@pointed{\pgf@arrows@invertto}{to}]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex:885: Missing \endcsname inserted. [\tikz@set@pointed{\pgf@arrows@invertto}{to}]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex:885: Missing \endcsname inserted. [\tikz@set@pointed{\pgf@arrows@invertto}{to}]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex:885: Missing \endcsname inserted. [\tikz@set@pointed{\pgf@arrows@invertto}{to}]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex:885: Missing \endcsname inserted. [\tikz@set@pointed{\pgf@arrows@invertto}{to}]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex:885: Argument of \next has an extra }. [\tikz@set@pointed{\pgf@arrows@invertto}{to}]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex:885: Paragraph ended before \next was complete. [\tikz@set@pointed{\pgf@arrows@invertto}{to}]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex:885: Missing \endcsname inserted. [\tikz@set@pointed{\pgf@arrows@invertto}{to}]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex:885: Argument of \next has an extra }. [\tikz@set@pointed{\pgf@arrows@invertto}{to}]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex:885: Paragraph ended before \next was complete. [\tikz@set@pointed{\pgf@arrows@invertto}{to}]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex:885: Missing \endcsname inserted. [\tikz@set@pointed{\pgf@arrows@invertto}{to}]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex:885: Argument of \next has an extra }. [\tikz@set@pointed{\pgf@arrows@invertto}{to}]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex:885: Use of \csname doesn't match its definition. [\tikz@set@pointed{\pgf@arrows@invertto}{to}]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex:885: Missing control sequence inserted. [\tikz@set@pointed{\pgf@arrows@invertto}{to}]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex:885: Argument of \next has an extra }. [\tikz@set@pointed{\pgf@arrows@invertto}{to}]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex:885: Paragraph ended before \next was complete. [\tikz@set@pointed{\pgf@arrows@invertto}{to}]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex:885: Package pgf Error: Arrow end type ``tikz@>\endgroup \let \par . [\tikz@set@pointed{\pgf@arrows@invertto}{to}]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex:885: Missing \endcsname inserted. [\tikz@set@pointed{\pgf@arrows@invertto}{to}]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex:885: Missing \endcsname inserted. [\tikz@set@pointed{\pgf@arrows@invertto}{to}]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex:885: LaTeX Error: Variable name ended by end of line.. [\tikz@set@pointed{\pgf@arrows@invertto}{to}]
/usr/local/texlive/2012/texmf-dist/tex/latex/tools/calc.sty:54: No room for a new \dimen . [\newdimen\calc@Adimen]
/usr/local/texlive/2012/texmf-dist/tex/latex/tools/calc.sty:54: No room for a new \dimen . [\newdimen\calc@Adimen \newdimen\calc@Bdimen]
/usr/local/texlive/2012/texmf-dist/tex/latex/subfigure/subfigure.sty:97: No room for a new \dimen . [\newdimen\subfigcaptopadj]
/usr/local/texlive/2012/texmf-dist/tex/latex/subfigure/subfigure.sty:99: No room for a new \dimen . [\newdimen\subfigcapmargin]
./Document.tex:1: Undefined control sequence. [\include{Header}]
./Document.tex:1: Undefined control sequence. [\include{Header}]
./Document.tex:1: Undefined control sequence. [\include{Header}]
./Document.tex:1: Undefined control sequence. [\include{Header}]
./Document.tex:1: Undefined control sequence. [\include{Header}]
./Document.tex:1: Extra \else. [\include{Header}]
答案1
添加包产生错误时的第一步措施是更改加载顺序;目前的问题是由于program
“类别代码”的一些内部混乱造成了混淆todonotes
,或者更确切地说,混淆了它使用的 TikZ 引擎。
所以
\documentclass{scrbook}
\usepackage[textsize=footnotesize]{todonotes}
\usepackage{program}
\begin{document}
Hello world!
\end{document}
应该是解决方案。
从您报告的错误消息来看,似乎还有另一个问题;program
大量使用内部寄存器,而 TikZ 也非常需要这些寄存器,因此其他包可能会导致可用寄存器数量溢出。只需添加\usepackage{etex}
(参见没有空间容纳新的\dimen);下面我模拟了一个“现实世界”的情况,并<other packages>
指出etex
应尽快加载。
\documentclass{scrbook}
\usepackage{etex}
<other packages>
\usepackage[textsize=footnotesize]{todonotes}
\usepackage{program}
<other packages>
\begin{document}
Hello world!
\end{document}