未定义控制序列 \g__prg_map_int

未定义控制序列 \g__prg_map_int

我正在努力改进我的答案并且我找到了一个在 Overleaf 上完美运行的解决方案(我查看了日志,而不仅仅是显示的内容)。

\listfiles
\documentclass[12pt,fleqn]{article}
\usepackage{amsmath}
\usepackage{environ}
\usepackage{tikz}
\usetikzlibrary{matrix}
\usetikzlibrary{decorations.pathreplacing, calligraphy, calc}
\tikzset{
    mymatr/.style={
        matrix of math nodes, 
        column sep = 10pt,
        nodes={
            anchor=text, 
            inner xsep=3pt
            }, 
        inner xsep=7pt,
        ampersand replacement=\&
        }
    }
\NewEnviron{mybrak}[1][2]{%
    \begin{tikzpicture}[baseline=(mybase)]
    \matrix[mymatr](A){
        \BODY\\
        };
    \coordinate (mybase) at ($(A-1-1.text)!.5! (A-#1-1.text)$);
    \draw[thick]([xshift=-6.4pt]A-1-1.west) -- +(4.4pt,0);
    \foreach[evaluate=\mystep as \prev using int(\mystep-1)] \mystep in {2,...,#1}{
        \draw[thick]([xshift=-6pt]A-\prev-1.west) -- ([xshift=-6pt]A-\mystep-1.west) -- + (4pt,0);
    }
    \end{tikzpicture}
    }

\NewEnviron{mycurly}[1][2]{%
    \begin{tikzpicture}[baseline=(mybase)]
    \matrix[mymatr](A){
        \BODY\\
        };
    \coordinate (mybase) at ($(A-1-1.text)!.5! (A-#1-1.text)$); 
    \draw[line width=.9pt,decorate,decoration={calligraphic brace,amplitude=4pt, mirror}](A-1-1.west) -- (A-#1-1.west);
    \end{tikzpicture}
    }


\begin{document}
Environment who puts curly braces:
\[
\begin{mycurly}
    \frac{3}{4}x+y=2 \\
    e^{2x}+3y=4
\end{mycurly}
\]
if you have more than 2 equation, you have to indicate their number in the optional argument:
\[
\begin{mycurly}[3]
    \frac{3}{4}x+y=2 \\
    e^{2x}+3y=4\\
    \sqrt{x+3}+5z=0
\end{mycurly}
\]
\[
\begin{mycurly}[4]
    x+y=2 \\
    2x+3y=4 \\
    3x+5z=0 \\
    \dfrac{7x}{x+9}+y+z=2
\end{mycurly}
\]
Environment who puts square brakets:
\[
\begin{mybrak}
    \frac{3}{4}x+y=2 \\
    e^{2x}+3y=4
\end{mybrak}
\]
if you have more than 2 equation, you have to indicate their number in the optional argument:
\[
\begin{mybrak}[3]
    \frac{3}{4}x+y=2 \\
    e^{2x}+3y=4\\
    \sqrt{x+3}+5z=0
\end{mybrak}
\]
\[
\begin{mybrak}[4]
    x+y=2 \\
    2x+3y=4 \\
    3x+5z=0 \\
    \dfrac{7x}{x+9}+y+z=2
\end{mybrak}
\]
Please note you have to use \verb|\&| instead of \verb|&| here:
\[
 f(x) = 
  \begin{mycurly}[4]
   \dfrac{1}{3}x+y=2 \& \text{if }x<0 \\
    2x+3y=4 \& \text{if }0\leq x<1\\
    3x+5z=0 \& \text{if }1\leq x<2\\
    \dfrac{7x}{x+9}+y+z=2 \& \text{if } x>2
  \end{mycurly}
\]
\[
 f(x) = 
  \begin{mycurly}[3]
    2x+3y=4 \& \text{if } x<1\\
    3x+5z=0 \& \text{if }1\leq x<2\\
    \dfrac{7x}{x+9}+y+z=2 \& \text{if } x>2
  \end{mycurly}
\]
It works also with the bracket type (even if I don't know if it is used in your country):
\[
 f(x) = 
  \begin{mybrak}[4]
   \dfrac{1}{3}x+y=2 \& \text{if }x<0 \\
    2x+3y=4 \& \text{if }0\leq x<1\\
    3x+5z=0 \& \text{if }1\leq x<2\\
    \dfrac{7x}{x+9}+y+z=2 \& \text{if } x>2
  \end{mybrak}
\]
\[
 f(x) = 
  \begin{mybrak}[3]
    2x+3y=4 \& \text{if } x<1\\
    3x+5z=0 \& \text{if }1\leq x<2\\
    \dfrac{7x}{x+9}+y+z=2 \& \text{if } x>2
  \end{mybrak}
\]
\end{document}

使用以下版本的软件包:

 *File List*
 article.cls    2014/09/29 v1.4h Standard LaTeX document class
   fleqn.clo    2016/12/29 v1.2a Standard LaTeX option (flush left equations)
  size12.clo    2014/09/29 v1.4h Standard LaTeX file (size option)
 amsmath.sty    2016/11/05 v2.16a AMS math features
 amstext.sty    2000/06/29 v2.01 AMS text
  amsgen.sty    1999/11/30 v2.0 generic functions
  amsbsy.sty    1999/11/29 v1.2d Bold Symbols
  amsopn.sty    2016/03/08 v2.02 operator names
 environ.sty    2014/05/04 v0.3 A new way to define environments
trimspaces.sty    2009/09/17 v1.1 Trim spaces around a token list
    tikz.sty    2015/08/07 v3.0.1a (rcs-revision 1.151)
     pgf.sty    2015/08/07 v3.0.1a (rcs-revision 1.15)
  pgfrcs.sty    2015/08/07 v3.0.1a (rcs-revision 1.31)
everyshi.sty    2001/05/15 v3.00 EveryShipout Package (MS)
  pgfrcs.code.tex
 pgfcore.sty    2010/04/11 v3.0.1a (rcs-revision 1.7)
graphicx.sty    2017/06/01 v1.1a Enhanced LaTeX Graphics (DPC,SPQR)
  keyval.sty    2014/10/28 v1.15 key=value parser (DPC)
graphics.sty    2017/06/25 v1.2c Standard LaTeX Graphics (DPC,SPQR)
    trig.sty    2016/01/03 v1.10 sin cos tan (DPC)
graphics.cfg    2016/06/04 v1.11 sample graphics configuration
  pdftex.def    2017/06/24 v1.0g Graphics/color driver for pdftex
  pgfsys.sty    2014/07/09 v3.0.1a (rcs-revision 1.48)
  pgfsys.code.tex
pgfsyssoftpath.code.tex    2013/09/09  (rcs-revision 1.9)
pgfsysprotocol.code.tex    2006/10/16  (rcs-revision 1.4)
  xcolor.sty    2016/05/11 v2.12 LaTeX color extensions (UK)
   color.cfg    2016/01/02 v1.6 sample color configuration
 pgfcore.code.tex
pgfcomp-version-0-65.sty    2007/07/03 v3.0.1a (rcs-revision 1.7)
pgfcomp-version-1-18.sty    2007/07/23 v3.0.1a (rcs-revision 1.1)
  pgffor.sty    2013/12/13 v3.0.1a (rcs-revision 1.25)
 pgfkeys.sty    
 pgfkeys.code.tex
 pgfmath.sty    
 pgfmath.code.tex
  pgffor.code.tex
    tikz.code.tex
  spath3.sty    2016/02/19 v1.1 Functions for manipulating PGF soft paths
   expl3.sty    2017/05/29 L3 programming layer (loader) 
expl3-code.tex    2017/05/29 L3 programming layer 
l3pdfmode.def    2017/03/18 v L3 Experimental driver: PDF mode
  xparse.sty    2017/05/29 L3 Experimental document command parser
supp-pdf.mkii
epstopdf-base.sty    2016/05/15 v2.6 Base part for package epstopdf
infwarerr.sty    2016/05/16 v1.4 Providing info/warning/error messages (HO)
  grfext.sty    2016/05/16 v1.2 Manage graphics extensions (HO)
kvdefinekeys.sty    2016/05/16 v1.4 Define keys (HO)
 ltxcmds.sty    2016/05/16 v1.23 LaTeX kernel commands for general use (HO)
kvoptions.sty    2016/05/16 v3.12 Key value format for package options (HO)
kvsetkeys.sty    2016/05/16 v1.17 Key value parser (HO)
etexcmds.sty    2016/05/16 v1.6 Avoid name clashes with e-TeX commands (HO)
ifluatex.sty    2016/05/16 v1.4 Provides the ifluatex switch (HO)
pdftexcmds.sty    2017/03/19 v0.25 Utility functions of pdfTeX for LuaTeX (HO)
   ifpdf.sty    2017/03/15 v3.2 Provides the ifpdf switch
epstopdf-sys.cfg    2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Live
 ***********

但是如果我在我的计算机上尝试使用更新版本的软件包:

 *File List*
 article.cls    2014/09/29 v1.4h Standard LaTeX document class
   fleqn.clo    2016/12/29 v1.2a Standard LaTeX option (flush left equations)
  size12.clo    2014/09/29 v1.4h Standard LaTeX file (size option)
 amsmath.sty    2017/09/02 v2.17a AMS math features
 amstext.sty    2000/06/29 v2.01 AMS text
  amsgen.sty    1999/11/30 v2.0 generic functions
  amsbsy.sty    1999/11/29 v1.2d Bold Symbols
  amsopn.sty    2016/03/08 v2.02 operator names
 environ.sty    2014/05/04 v0.3 A new way to define environments
trimspaces.sty    2009/09/17 v1.1 Trim spaces around a token list
    tikz.sty    2015/08/07 v3.0.1a (rcs-revision 1.151)
     pgf.sty    2015/08/07 v3.0.1a (rcs-revision 1.15)
  pgfrcs.sty    2015/08/07 v3.0.1a (rcs-revision 1.31)
everyshi.sty    2001/05/15 v3.00 EveryShipout Package (MS)
  pgfrcs.code.tex
 pgfcore.sty    2010/04/11 v3.0.1a (rcs-revision 1.7)
graphicx.sty    2017/06/01 v1.1a Enhanced LaTeX Graphics (DPC,SPQR)
  keyval.sty    2014/10/28 v1.15 key=value parser (DPC)
graphics.sty    2017/06/25 v1.2c Standard LaTeX Graphics (DPC,SPQR)
    trig.sty    2016/01/03 v1.10 sin cos tan (DPC)
graphics.cfg    2016/06/04 v1.11 sample graphics configuration
  pdftex.def    2018/01/08 v1.0l Graphics/color driver for pdftex
  pgfsys.sty    2014/07/09 v3.0.1a (rcs-revision 1.48)
  pgfsys.code.tex
pgfsyssoftpath.code.tex    2013/09/09  (rcs-revision 1.9)
pgfsysprotocol.code.tex    2006/10/16  (rcs-revision 1.4)
  xcolor.sty    2016/05/11 v2.12 LaTeX color extensions (UK)
   color.cfg    2016/01/02 v1.6 sample color configuration
 pgfcore.code.tex
pgfcomp-version-0-65.sty    2007/07/03 v3.0.1a (rcs-revision 1.7)
pgfcomp-version-1-18.sty    2007/07/23 v3.0.1a (rcs-revision 1.1)
  pgffor.sty    2013/12/13 v3.0.1a (rcs-revision 1.25)
 pgfkeys.sty    
 pgfkeys.code.tex
 pgfmath.sty    
 pgfmath.code.tex
  pgffor.code.tex
    tikz.code.tex
  spath3.sty    2016/02/19 v1.1 Functions for manipulating PGF soft paths
   expl3.sty    2018-11-19 L3 programming layer (loader) 
expl3-code.tex    2018-11-19 L3 programming layer 
l3pdfmode.def    2018-11-19 v L3 Experimental driver: PDF mode
  xparse.sty    2018-10-17 L3 Experimental document command parser
supp-pdf.mkii
epstopdf-base.sty    2016/05/15 v2.6 Base part for package epstopdf
infwarerr.sty    2016/05/16 v1.4 Providing info/warning/error messages (HO)
  grfext.sty    2016/05/16 v1.2 Manage graphics extensions (HO)
kvdefinekeys.sty    2016/05/16 v1.4 Define keys (HO)
 ltxcmds.sty    2016/05/16 v1.23 LaTeX kernel commands for general use (HO)
kvoptions.sty    2016/05/16 v3.12 Key value format for package options (HO)
kvsetkeys.sty    2016/05/16 v1.17 Key value parser (HO)
etexcmds.sty    2016/05/16 v1.6 Avoid name clashes with e-TeX commands (HO)
ifluatex.sty    2016/05/16 v1.4 Provides the ifluatex switch (HO)
pdftexcmds.sty    2018/09/10 v0.29 Utility functions of pdfTeX for LuaTeX (HO)
   ifpdf.sty    2018/09/07 v3.3 Provides the ifpdf switch
epstopdf-sys.cfg    2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Live
 ***********

我收到错误(随后收到许多其他错误):

! Undefined control sequence.
<argument> \g__prg_map_int 

l.54    \end{mycurly}

该错误似乎出在calligraphyTikZ 的库中,但自 2016/02/19 以来它一直没有改变。

我该如何解决这个错误?

答案1

在收紧某些概念的过程中expl3,删除了一些内部命令。在这里,一个命令被第三方软件包使用。(收紧的部分原因是不清楚第三方是否不应使用此代码,因此软件包作者没有错。)在那里的代码被修改之前,人们可以使用

\usepackage{expl3}
\ExplSyntaxOn
\int_new:N \g__prg_map_int 
\ExplSyntaxOff

\usetikzlibrary{decorations.pathreplacing, calligraphy, calc}

相关内容