Dear list, These are the following first four lines of a CSV file: ,, "About \LuaTeX\ and \ConTeXt","about.pdf","https://www.pragma-ade.com/general/manuals/about.pdf" "l2r, r2l: A Few Tips","bidi.pdf","https://www.pragma-ade.com/general/manuals/bidi.pdf" "Flowcharts","charts-mkiv.pdf", Faking a command such as \cA, \cB and \cC (for contents of columns A, B or C) I would like to create a source document with an enumeration that contains: \doiftext{\cB} {\item {\em\cA}\attachment[file=\cB]% \doiftext{\cC}{ (also available at \cC)}.} I would like to do that with the "database" module. So far I have adapted the itemize environment, but I don't get the contents for items right: \usemodule[database] \starttext \def\ItemContents#1#2#3{\doiftext{#2} {\item {\em #1}\attachment[file=#2]% \doiftext{#3}{ (also available at #3)}.}} \defineseparatedlist [test] [separator={,}, % tab quotechar={"}, % tab before={\startitemize[n]},after={\stopitemize}, first={\ItemContents},last={.}, left={\{},right={\}}] \processdatabasefile[test][context-documents.csv] \stoptext I get an error about an unexpected symbol near "\" in the line of "\processdatabasefile". Could anyone enlighten me about what I am missing here? Many thanks for your help, Pablo
On 11/5/23 13:56, Pablo Rodriguez via ntg-context wrote:
[...] I get an error about an unexpected symbol near "\" in the line of "\processdatabasefile".
Could anyone enlighten me about what I am missing here?
Replying to myself, thanks to the wiki (https://wiki.contextgarden.net/Commands_with_optional_arguments). It seems that the command has to be defined as unexpanded, such as in: \setupinteraction[state=start] \setupattachments[method=hidden] \usemodule[database] \starttext \unexpanded\def\ItemContents#1#2#3{\doiftext{#2} {\item {\em #1}\attachment[file=#2, name=\currentitemnumber-#2]% \doiftext{#3}{ (also available at #3)}}} \defineseparatedlist [test] [separator={,}, quotechar={"}, before={\startitemize[n]},after={\stopitemize}, first={\ItemContents},last={.}, left={\{},right={\}}] \processdatabasefile[test][context-documents.csv] \stoptext It is not clear for me why is this needed, but it might be one of the many aspects of expansion that average users cannot understand from TeX. Many thanks for your help, Pablo
participants (1)
-
Pablo Rodriguez