现在我需要另一个密钥stepstrokes=true
,它产生
这意味着:'地图'的文本现在是灰色的,并且'步进'覆盖(并且'起点'或'箭头'[见下文]是一个选项)。
我希望这是可以理解的。
该解决方案可能很容易编程,但我现在不知道。
梅威瑟:
\documentclass{article}
\usepackage{verbatimbox}
\usepackage{tikz}
%\usepackage{xcolor}
\usepackage{expkv}
\usepackage{expkv-def}
\tikzset{
CommonStyle/.style={baseline=0em, anchor=base, remember picture},
SymbolTextColor/.style={text=#1},
SymbolTextColor/.default={black},
}
\newcommand\TheSymbol{%
\noindent\begin{tikzpicture}[CommonStyle]
\node[] (tempcoordinate-0) {S0};
\end{tikzpicture}}
\newcommand\TheMap{\foreach \n in {1,2,3}{%
\noindent\begin{tikzpicture}[CommonStyle]
\node[] (tempcoordinate-\n) {S0(\n)};
\end{tikzpicture}}}
\newcommand\TheStepStrokes{\foreach \n in {1,2,3}{%
\noindent\begin{tikzpicture}[CommonStyle]
\node[text=gray] (tempcoordinate-\n) {S0(\n)};
\node[] at (tempcoordinate-\n) {S\n};
\end{tikzpicture}}}
\newcommand\TheArrows{%
\begin{tikzpicture}[CommonStyle, overlay]
\node[text=red] at (tempcoordinate-0.south){x0};
\end{tikzpicture}}
\newcommand\TheStepArrows{\foreach \n in {1,2,3}{%
\begin{tikzpicture}[CommonStyle, overlay]
\node[text=red] at (tempcoordinate-\n.south){x\n};
\end{tikzpicture}}}
\newcommand\TheStartpoints{%
\begin{tikzpicture}[CommonStyle, overlay]
\node[text=blue] at (tempcoordinate-0.north){y0};
\end{tikzpicture}}
\newcommand\TheStepStartpoints{\foreach \n in {1,2,3}{%
\begin{tikzpicture}[CommonStyle, overlay]
\node[text=blue] at (tempcoordinate-\n.north){y\n};
\end{tikzpicture}}}
\ekvdefinekeys{cmd}{
,data color = \mycolor
,boolTF map = \mymapTF
,boolTF stepstrokes = \mystepstrokesTF
,boolTF arrows = \myarrowsTF
,boolTF startpoints = \mystartpointsTF
}
\newcommand\cmd[1][]
{%
\begingroup
\ekvset{cmd}{#1}%
\mycolor\color{}% hier stepstrokes
\mymapTF{\TheMap}{\TheSymbol}%
\mystepstrokesTF{\TheStepStrokes}{}%
\myarrowsTF{\myarrowsTF{\mymapTF{\TheStepArrows}{\TheArrows}}{NOTHING}}{}%
\mystartpointsTF{\mystartpointsTF{\mymapTF{\TheStepStartpoints}{\TheStartpoints}}{NOTHING}}{}%
\endgroup
}
% For the presentation:
\usepackage[most]{tcolorbox}
\tcbset{colback=white, colframe=white, fontupper=\ttfamily,
enhanced, borderline south={1pt}{-2pt}{black}}
\begin{document}
%Test: \TheMap
\begin{tcblisting}{}
(1) \cmd[map]
\end{tcblisting}
\begin{tcblisting}{}
(2) \cmd[map, arrows]
\end{tcblisting}
\begin{tcblisting}{}
(3) \cmd[map=false, arrows]
\end{tcblisting}
\begin{tcblisting}{}
(4) \cmd[map=false, arrows=false]
\end{tcblisting}
\begin{tcblisting}{}
(5) \cmd[map, startpoints]
\end{tcblisting}
\begin{tcblisting}{}
(6) \cmd[map, arrows, startpoints]
\end{tcblisting}
\begin{tcblisting}{}
For the last one I have no idea
\cmd[map=true, stepstrokes=true]
\end{tcblisting}
\texttt{it should look -only- something like that:}
\TheStepStrokes \\
\texttt{That means: Text of 'map' is gray now and the 'stepstrokes' overlay; and 'startpoints' or 'arrows' is futhermore an option.}
\end{document}
答案1
map
在我看来,你根本不想评估是否stepstrokes
为真,因为 的输出stepstrokes
已经包含了 的输出map
。下面通过将 的测试放在\mymapTF
的假分支内来实现这一点\mystepstrokesTF
:
\documentclass{article}
\usepackage{verbatimbox}
\usepackage{tikz}
%\usepackage{xcolor}
\usepackage{expkv}
\usepackage{expkv-def}
\tikzset{
CommonStyle/.style={baseline=0em, anchor=base, remember picture},
SymbolTextColor/.style={text=#1},
SymbolTextColor/.default={black},
}
\newcommand\TheSymbol{%
\noindent\begin{tikzpicture}[CommonStyle]
\node[] (tempcoordinate-0) {S0};
\end{tikzpicture}}
\newcommand\TheMap{\foreach \n in {1,2,3}{%
\noindent\begin{tikzpicture}[CommonStyle]
\node[] (tempcoordinate-\n) {S0(\n)};
\end{tikzpicture}}}
\newcommand\TheStepStrokes{\foreach \n in {1,2,3}{%
\noindent\begin{tikzpicture}[CommonStyle]
\node[text=gray] (tempcoordinate-\n) {S0(\n)};
\node[] at (tempcoordinate-\n) {S\n};
\end{tikzpicture}}}
\newcommand\TheArrows{%
\begin{tikzpicture}[CommonStyle, overlay]
\node[text=red] at (tempcoordinate-0.south){x0};
\end{tikzpicture}}
\newcommand\TheStepArrows{\foreach \n in {1,2,3}{%
\begin{tikzpicture}[CommonStyle, overlay]
\node[text=red] at (tempcoordinate-\n.south){x\n};
\end{tikzpicture}}}
\newcommand\TheStartpoints{%
\begin{tikzpicture}[CommonStyle, overlay]
\node[text=blue] at (tempcoordinate-0.north){y0};
\end{tikzpicture}}
\newcommand\TheStepStartpoints{\foreach \n in {1,2,3}{%
\begin{tikzpicture}[CommonStyle, overlay]
\node[text=blue] at (tempcoordinate-\n.north){y\n};
\end{tikzpicture}}}
\ekvdefinekeys{cmd}{
data color = \mycolor
,boolTF map = \mymapTF
,boolTF stepstrokes = \mystepstrokesTF
,boolTF arrows = \myarrowsTF
,boolTF startpoints = \mystartpointsTF
}
\newcommand\cmd[1][]
{%
\begingroup
\ekvset{cmd}{#1}%
\mycolor\color{}% hier stepstrokes
\mystepstrokesTF{\TheStepStrokes}{\mymapTF{\TheMap}{\TheSymbol}}%
\myarrowsTF{\myarrowsTF{\mymapTF{\TheStepArrows}{\TheArrows}}{NOTHING}}{}%
\mystartpointsTF{\mystartpointsTF{\mymapTF{\TheStepStartpoints}{\TheStartpoints}}{NOTHING}}{}%
\endgroup
}
% For the presentation:
\usepackage[most]{tcolorbox}
\tcbset{colback=white, colframe=white, fontupper=\ttfamily,
enhanced, borderline south={1pt}{-2pt}{black}}
\begin{document}
%Test: \TheMap
\begin{tcblisting}{}
(1) \cmd[map]
\end{tcblisting}
\begin{tcblisting}{}
(2) \cmd[map, arrows]
\end{tcblisting}
\begin{tcblisting}{}
(3) \cmd[map=false, arrows]
\end{tcblisting}
\begin{tcblisting}{}
(4) \cmd[map=false, arrows=false]
\end{tcblisting}
\begin{tcblisting}{}
(5) \cmd[map, startpoints]
\end{tcblisting}
\begin{tcblisting}{}
(6) \cmd[map, arrows, startpoints]
\end{tcblisting}
\begin{tcblisting}{}
For the last one I have no idea
\cmd[map=true, stepstrokes=true]
\end{tcblisting}
\texttt{it should look -only- something like that:}
\TheStepStrokes \\
\texttt{That means: Text of 'map' is gray now and the 'stepstrokes' overlay; and 'startpoints' or 'arrows' is futhermore an option.}
\end{document}