On 8/23/2023 4:12 AM, Andres Conrado Montoya wrote:
I have been using the following macro to add a bunch of sections to the start of chapters in a book, it works but I think is kind of weak:
%%%%%%%%%%%%%%%%%%%
\define[7]\metadatos{ \startsection[title={Resumen}] #1 \stopsection \startsection[title={Palabras clave}] #2 \stopsection \start \language[en] \startsection[title={Abstract}] #3 \stopsection \startsection[title={Keywords}] #4 \stopsection \stop \startsection[title={¿Cómo citar este capítulo? / How to cite this book?}] \startsubsection[title={Apa}] #5 \stopsubsection \startsubsection[title={Chicago}] #6 \stopsubsection \startsubsection[title={MLA}] #7 \stopsubsection \stopsection }
\starttext % Then I call the macro like this: \metadatos{spanish abstract \input knuth}{some, comma, separated, keywords, in, spanish}{english abstract \input knuth}{same, comma, separated, keywords, in, english}{Apa citation style for this article}{Chicago citation style for this article}{MLA citation style for this article} \stoptext %%%%%%%%%%%%%%%%%%%
I've been exploring different ways to do it better, but with not much luck, I was thinking something based in key=value assignments? setups? datasets? Not really sure, but If you know a better solution or point me in the direction of something I can use to replace that macro, it would be greatly appreciated. \startsetups [document:start] \doifdocumentvariable {englishabstract} { \startsection[title={Resumen}] \documentvariable{englishabstract} \stopsection } \doifdocumentvariable {spanisabstract} { \startsection[title={Palabras clave}] \documentvariable{spanishabstract} \stopsection } ... \stopsetups
\startbuffer english ... \stopbuffer \startbuffer spanish ... \stopbuffer \startsetups [document:stop] ... \stopsetups \startdocument [spanisabstract={\getbuffer[spanish]}, ....] ... \stopdocument untested, just keyed in ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------