不同 texlive 版本之间的 tikz 代码编译错误

不同 texlive 版本之间的 tikz 代码编译错误

作为我正在写的书的一部分,其中一章包含 8 年前用 tikz 绘制的几幅图画。这个论坛中的许多人都为此提供了帮助,包括贡萨洛·梅迪纳

我现在正尝试在安装了 2023 版 texlive (MacTex) 的新电脑上编译相同的代码,但 tikz 中出现了错误。作为参考,我有两台电脑:一台运行 2015 版 texlive,一切正常,另一台较新的 PC 运行在此处输入图片描述2023 版 MacTex。两台电脑都是 Mac OS。我想出了一个 MWE 示例,不幸的是它很长,粘贴在下面。

任何解决此问题的指示都会有所帮助。看来 tikz 中发生了一些变化,或者 subfigure 的操作在 2015 年至 2023 年之间发生了变化

期望输出:

平均能量损失

\documentclass[12pt]{memoir}
\usepackage{multicol} % just to get narrow columns on one page
\usepackage{polyglossia} % the multilingual support package
\usepackage{tikz}
\usepackage{subcaption}
\usetikzlibrary{calc,shapes.geometric}
\usepackage{amsmath}
\usepackage{ifthen}
\usepackage{perpage}
\usepackage{dblfnote}
\DFNalwaysdouble

\setdefaultlanguage{english} % this is mostly going to be English text, with
\setmainfont{Linux Libertine O}
\setsansfont[Ligatures=TeX, Scale=0.9]{Linux Biolinum O}
\setlength{\parskip}{12pt} % 1ex plus 0.5ex minus 0.2ex}
\setlength{\textwidth}{6.0in}
\newcommand*{\Largerdot}{\raisebox{-0.25ex}{\scalebox{1.1}{.}}}
\newcommand*{\Ldot}{\raisebox{1ex}{\scalebox{1.1}{.}}}
\newcommand{\du}[1]{$\overset{\Largerdot}{\mbox{{#1}}}$}  %% centrally align
\newcommand{\dl}[1]{$\underset{\Ldot}{\mbox{{#1}}}$}  %% centrally align


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% These are the core tikz functions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\tikzset{
  myshape/.style 2 args={
    inner sep=0pt,
    regular polygon,
    regular polygon sides=#1,
    minimum size=#2
  }
}

\newcommand\DrawShape[3]{
  \node[draw,myshape={#1}{#2},thick] (inner) {};
  \node[draw,myshape={#1}{#3},thick] (outer) {};
  \node[myshape={#1}{0.5*#3+0.5*#2}] (in) {};
  \node[myshape={#1}{#3+40pt}] (outside) {};
  \node[myshape={#1}{#2-40pt}] (inside) {};
  \foreach \Value in {1,...,#1}
  {
    \draw[thick]  (inner.corner \Value) -- (outer.corner \Value);
  }  
}

\newcommand\LabelsIn[3]{
  \foreach \Text [count=\Total] in {#1} {}
  \foreach \Value [count=\Num,evaluate=\Value as \Parts using \Value/\Total] in {1,...,\numexpr\Total-1\relax}
  {
    \draw[thick] 
      ( $ (inner.corner #2)!\Parts!(inner.corner #3) $ ) -- 
      ( $ (outer.corner #2)!($(inner.corner #2)!\Parts!(inner.corner #3)$)!(outer.corner #3) $ );
  }
  \foreach \Text [count=\Num,evaluate=\Text as \Parts using (\Num/\Total)-1/(2*\Total)] in {#1} 
  {
    \path[]
      ( $ (inner.corner #2)!\Parts!(inner.corner #3) $ ) -- node {\Text}
      ( $ (outer.corner #2)!($(inner.corner #2)!\Parts!(inner.corner #3)$)!(outer.corner #3) $ );
  }
}

\newcommand\LabelsInside[3]{
  \foreach \Text [count=\Total] in {#1} {}
  \foreach \Text [count=\Num,evaluate=\Text as \Parts using (\Num/\Total)-1/(2*\Total)] in {#1} 
  {
    \path[]
      ( $ (inner.corner #2)!\Parts!(inner.corner #3) $ ) -- node[pos=-0.4] {\Text}
      ( $ (outer.corner #2)!($(inner.corner #2)!\Parts!(inner.corner #3)$)!(outer.corner #3) $ );
  }
}

\newcommand\LabelsOutside[3]{
  \foreach \Text [count=\Total] in {#1} {}
  \foreach \Text [count=\Num,evaluate=\Text as \Parts using (\Num/\Total)-1/(2*\Total)] in {#1} 
  {
    \path[]
      ( $ (inner.corner #2)!\Parts!(inner.corner #3) $ ) -- node[pos=1.4] {\Text}
      ( $ (outer.corner #2)!($(inner.corner #2)!\Parts!(inner.corner #3)$)!(outer.corner #3) $ );
  }
}

% The non-standard FUNCTIONS
%

\newcommand\FirstShape[2]{%
% The basic shape
\draw[very thick] 
  (70:4) arc(70:275:4) -- 
  (270:3) arc(270:75:3) -- 
  (70:4) to[out=-90,in=110] 
  (45:2) to[out=-120,in=110]
  (0:1.5) to[out=-120,in=110]
  (-50:2) to[out=-130,in=80]
  (275:4) --
  (270:3) to[out=80,in=-130]
  (-60:1.3) to[out=110,in=-120]
  (20:0.85) to[out=110,in=-120]
  (60:1.8) to[out=110,in=-90]
  (75:3)
  (45:2) -- (60:1.8)
  (0:1.5) -- (20:0.85)
  (-50:2) -- (-60:1.3);
% The numbers inside
\foreach \Value [evaluate=\Value as \Step using {\Value*200/#1} ] in  {1,...,#1}
  { 
    \ifdim\dimexpr275pt-\Step pt\relax=75 pt\relax
    \else
      \draw[very thick]  ({275-\Step}:4) -- ++(275-\Step:-1);
      \node at ({275-\Step}:2.7) {\the\numexpr\Value+1\relax};
    \fi
  }  
\node[left] at (270:2.7) {1};
\node[left] at (73:2.7) {\the\numexpr#1+1\relax};
\node[left=2pt] at (60:1.8) {\the\numexpr#1+2\relax};
\node[left=2pt] at (20:0.85) {\the\numexpr#1+3\relax};
\node[left=2pt] at (-60:1.3) {\the\numexpr#1+4\relax};
% The texts outside
\foreach \Text [count=\Value,evaluate=\Value as \Step using {\Value*200/#1} ] in  {#2}
  \node at ({275-\Step}:4.5) {\Text}; 
\foreach \Text [
  count=\Value,
  evaluate=\Value as \Step using {\Value*200/#1} 
  ] in  {#2}
  {
    \node at ({275-\Step}:4.5) {\Text};
  }
% The constant texts in the right part
\node[right=2pt] at (70:4) {\sktuni{śa}};
\node[right=2pt] at (45:2) {\sktuni{vi}};
\node[right=2pt] at (0:1.5) {\sktuni{śa}};
\node[right=2pt] at (-50:2) {\sktuni{vi}};
\node[below=2pt] at (270:4) {\sktuni{śa}};
}

%%% END OF TIKZ FUNCTIONS


\begin{document}

% page 293
\begin{figure}
\begin{subfigure}[b]{0.50\textwidth}
\centering
\resizebox{\linewidth}{!}{
\begin{tikzpicture}
\DrawShape{4}{8cm}{12cm}
\LabelsIn{,}{1}{2}
\LabelsInside{1}{1}{2}
\LabelsOutside{{{sannipāta}}}{1}{2}
\LabelsIn{,}{2}{3}
\LabelsInside{4}{2}{3}
\LabelsOutside{,}{2}{3}
\LabelsIn{\du{S},|}{3}{4}
\LabelsInside{3}{3}{4}
\LabelsOutside{{{śamya}},{{tāla}}}{3}{4}
\LabelsIn{,S}{4}{1}
\LabelsInside{2}{4}{1}
\LabelsOutside{,{{śamya}}}{4}{1}
\end{tikzpicture}
}
\end{subfigure}
\begin{subfigure}[b]{0.50\textwidth}
\centering
% 293-2
\resizebox{\linewidth}{!}{
\begin{tikzpicture}
\DrawShape{4}{8cm}{12cm}
\LabelsIn{,}{1}{2}
\LabelsInside{1}{1}{2}
\LabelsOutside{{{śamya}}}{1}{2}
\LabelsIn{,}{2}{3}
\LabelsInside{4}{2}{3}
\LabelsOutside{,}{2}{3}
\LabelsIn{\du{S},|}{3}{4}
\LabelsInside{3}{3}{4}
\LabelsOutside{{{tāla}},{{śamya}}}{3}{4}
\LabelsIn{,S}{4}{1}
\LabelsInside{2}{4}{1}
\LabelsOutside{,{{tāla}}}{4}{1}
\end{tikzpicture}
}
\end{subfigure}
\begin{subfigure}[b]{0.50\textwidth}
\centering
% 293-3
\resizebox{\linewidth}{!}{
\begin{tikzpicture}
\DrawShape{4}{8cm}{12cm}
\LabelsIn{,}{1}{2}
\LabelsInside{1}{1}{2}
\LabelsOutside{{{tāla}}}{1}{2}
\LabelsIn{,}{2}{3}
\LabelsInside{4}{2}{3}
\LabelsOutside{,}{2}{3}
\LabelsIn{\du{S},|}{3}{4}
\LabelsInside{3}{3}{4}
\LabelsOutside{{{śamya}},{{tāla}}}{3}{4}
\LabelsIn{,S}{4}{1}
\LabelsInside{2}{4}{1}
%\LabelsOutside{,{\Large\sktuni{śamya}}}{4}{1}
\LabelsOutside{,{{śamya}}}{4}{1}
\end{tikzpicture}
}
\end{subfigure}
\end{figure}

\end{document}

误差尾部

LaTeX Info: Redefining \ttfamily on input line 141.

! Undefined control sequence.
<argument> \Value /\Total 
                          
l.163 }
   

错误发生在子图块的末尾:

\end{tikzpicture}
}

相关内容