I am defining a \newcommand called \eventsperiodslist which call some other commands: \event[]{Digits}{} and \period[]{Digits}{Digits}{}
The arguments called "Digits" in \event and \period contains digits that I am trying to extract to find the minimum and maximum values of all numbers within \eventsperiodslist.
I do not know where to start:
- With a
\foreach, I would need to know how many\eventand\periodare in\eventsperiodslistwhich I don't know. - With functions from the
xstringpackage, I have problems with the curly brackets.
Any suggestions?
EDIT @egreg's comment
From the values in the MWE below, I expect to be able to call \findminmax{\eventsperiodslist} with the expected output being something like \newcommand{\myminvalue}{-6} and \newcommand{\mymaxvalue}{23}.
EDIT: I do not mind defining my events and periods from an array and later build the commands \event and \period from this array.
MWE (at least of the \eventsperiodslist command)
\documentclass{article}
\begin{document}
\newcommand{\event}[3][non-dated]{*Some command*}
\newcommand{\period}[4][right]{*Some other command*}
\newcommand{\findminmax}[1]{
*Some code to identify the minimum and maximum values*
\newcommand{\myminvalue}{*calculated minimum value*}% Here: minimum is -6
\newcommand{\mymaxvalue}{*calculated maximum value*}% Here: maximum is 23
}
\newcommand{\eventsperiodslist}{
\event[dated]{-6}{Some text}
\period{1}{5}{Nothing}
\period[center]{2}{7}{Something else}
\period[left]{4}{10}{Random text}
\event[dated]{23}{Making a test}
\findminmax{\eventsperiodslist}
\end{document}
}
