I am using \NewDocumentCommand
from xparse for creating customized commands. The actual commands I am creating have a lot of parameters, so I am giving a simpler example here. I would like to have key-values (or named values) that apparently pgfkeys provides. I tried to read some document and play around with it (for about 2 hours now) without much success.
Current version (Working but not ideal):
\documentclass[11pt]{article}
\usepackage{xparse}
\usepackage{tikz}
\NewDocumentCommand \myline {O{0}O{0}O{0}O{0}}
{
\draw [very thick, ->] (#1,#2) -- (#3,#4);
}
\begin{document}
\begin{tikzpicture}
\myline[7][5][][1] %uses default value (0) for #3
\end{tikzpicture}
\end{document}
Output:
The problem is that when the number of parameters becomes large (10 or so), writing something like:
\diagram[arr][4][600][2][4][8][6][{1,7,2,9}]
is clearly a horrendous way of setting things up :(
What I would like instead is:
\documentclass[11pt]{article}
\usepackage{xparse}
\usepackage{tikz}
\NewDocumentCommand \myline {O{0}O{0}O{0}O{0}}
{
\draw [very thick, ->] (#1,#2) -- (#3,#4);
}
\begin{document}
\begin{tikzpicture}
%--------- RELEVANT CHANGE -------
\myline[x1=7, y1=5, y2=1] %want to use default value for x2
\end{tikzpicture}
\end{document}
Call and output of actual code for anyone interested in understanding the scope of the problem:
\begin{tikzpicture}
\memory{data}{8}{320}{6}{4}{4}{8}{{12.5, 6.4, 8.5, 9.6, -3.4, -6.8, 0, -4.5}}
\end{tikzpicture}
\draw
?