There are probably other ways to do that, but I was happy I've found this code working just fine for my needs:
\documentclass{article}
\usepackage{tikz}
\newcounter{grpcnt}
\def\groups{grp1, grp2, grp3}
\def\keyvals{{ {"key 00/val 00, key 01/val 01"}, {"key 10/val 10, key 11/val 11, key 12/val 12"}, {"key 20/val 20"} }}
\begin{document}
\setcounter{grpcnt}{0}
\foreach \grp in \groups {
\section*{\grp}
\pgfmathparse{\keyvals[\thegrpcnt]}
\foreach \key/\val in \pgfmathresult
{
\textbf{\key}: \val \\[1ex]
}
\addtocounter{grpcnt}{1}
}
\end{document}
The problem I have is if I try to store any font styling in the 2nd array, say an \emph{}
on the first value 00:
\documentclass{article}
\usepackage{tikz}
\newcounter{grpcnt}
\def\groups{grp1, grp2, grp3}
\def\keyvals{{ {"key 00/val \emph{00}, key 01/val 01"}, {"key 10/val 10, key 11/val 11, key 12/val 12"}, {"key 20/val 20"} }}
\begin{document}
\setcounter{grpcnt}{0}
\foreach \grp in \groups {
\section*{\grp}
\pgfmathparse{\keyvals[\thegrpcnt]}
\foreach \key/\val in \pgfmathresult
{
\textbf{\key}: \val \\[1ex]
}
\addtocounter{grpcnt}{1}
}
\end{document}
Which will break compilation. I found out that some other types of commands are seen and interpreted correctly (e.g., some special characters like \AE
work just fine), but any font syling command I've tried (\large
, \textbf{}
, \itshape
, etc.) have failed. Any idea why and/or how I could store some font styling in the 2nd array? Thanks! :)
`
to mark your inline code as I did in my edit.