Concerning this project, I'm now trying to define an own tcolorbox environment for every conversational partner by creating a "conversational partner database" with the datatool
package and then using \DTLforeach
.
I wanted the first box to be blue and have the title "John Doe", but for some reason, the two boxes are both red and have the same title "Jane Stag". What do I have to change to make it work?
Or is there a more suitable way for creating this kind of database (without using external files)?
\documentclass{article}
\usepackage{lipsum}
\usepackage{tcolorbox}
\usepackage{datatool}
\begin{document}
\DTLnewdb{cp}% "cp" for "conversational partners".
\DTLnewrow{cp}
\DTLnewdbentry{cp}{name}{John Doe}
\DTLnewdbentry{cp}{shortcut}{JD}
\DTLnewdbentry{cp}{pfc}{blue}% "pfc" for "personal frame color"
\DTLnewrow{cp}
\DTLnewdbentry{cp}{name}{Jane Stag}
\DTLnewdbentry{cp}{shortcut}{JS}
\DTLnewdbentry{cp}{pfc}{red}
\DTLforeach{cp}{\NAME=name, \SHORTCUT=shortcut, \PFC=pfc}{%
\newtcolorbox{\SHORTCUT}{%
colframe={\PFC},
title={\NAME}
}
}
\begin{JD}%should be blue and have the title "John Doe", but is also red and has the title "Jane Stag".
\lipsum[1]
\end{JD}
\begin{JS}
\lipsum[1]
\end{JS}
\end{document}