在之前的一个问题中这里并部分解决,此函数内会发生额外的执行循环。结果,发布了额外的标签。知道需要更正哪些循环逻辑吗?
什么命令可以将每个循环中流经的一些计数器和数据作为原始数据打印到最终输出中?这对 tikz 专家来说可能是基础。
感谢您的回复。谢谢!
以下是完整的 MWE
\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{,{{śamya}}}{4}{1}
\end{tikzpicture}
}
\end{subfigure}
\end{figure}
\end{document}