I have defined a command, that is used in text scripts for stageplays.
At the moment, you can write:
\says[quietly]{Minka}{Hello, are you there?}
which compiles to something like:
*Minka*: (quietly) Hello, are you there?
where Minka
is bold and quietly
is slanted and colored.
however, I was asked, if i could provide "multiple square brackets" as they wanted to write:
\says{Minka}{[quietly]Hello, are you there? [shouting] Is anyone there?}
which should compile to:
*Minka*: (quieltly) Hello, are you there? (shouting) Is anyone there?
My question is, can I somehow parse the text that is given to \says{name}{text}
and replace all parts between square brackets with some command?
EDIT: Current Says Command:
\newlength\widest
\settowidth\widest{\textbf{Longest Name in document}}
\newcommand{\says}[2]{
\begin{description}[leftmargin=\dimexpr\widest+\labelsep\relax,labelindent=0pt,labelwidth=\widest]
\item[#1] #2
\end{description}
}
where the #2
should be the part on the right. I also redefine the command at the beginning of the script:
\newcommand\minka[1]{\says{Minka}{#1}} \newcommand\arthur[1]{\says{Arthur}{#1}}
and probably use more than one line or paragraph of text:
\minka{Hello, you//
[louder] yes, you there!
[normal voice] Is it you that helped me with that latex stuff?
}
\says{Minka}{\how{quietly} Hello, are you there? \how{shouting} Is anyone there?}
as @user605895 seems to be suggesting looks like cleaner markup to me.