On 2/20/2024 12:26 PM, madiazm.eoicc@gmail.com wrote:
Thanks Hans, I supposed that lua would be more suitable, but unfortunately I still did not learn it (I hope in summer I have time to read the manual)
The problem arises from the fact that for each line i will perform a different action and for \def\foo I need four arguments so that I can correctly format the lines. How can i get the result of string.splitlines (s) separated into four arguments to pass to the macro? then \foo would be \def\foo#1SEPARATOR#2SEPARATOR#3SEPARATOR#4
I now use:
\starttext %now I use the dirty trick of writing an ñ at the end of line so that the macro detects each argument; but for each question I have to manually add it, which is tedious; therefore I look for a solution to detect lines automatically
%the definition \def\tareaAbc #1ñ#2ñ#3ñ#4ñ{\item #1 \startitemgroup[lista1a] \item #2 \item #3 \item #4 \stopitemgroup}
%in the document /startitemgropu[lista1a] %I manually open the first level of the list so the first argument -the question- gets numbered
\tareaAbc In den Büchereien gibt es auch …ñ %the question; an item of first level … Kuchen.ñ %option a gets a new list of second level opened and argument 2 is the first item … Theater.ñ %option b another item … Workshops.ñ %option c last item and closes the second level list
%some more macros with more questions and options
/stopitemgroup %I manually close the first level list You have to provide more details about these lines. For instance, do you want to split on spaces?
Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------