On 2/19/2024 1:49 PM, Miguel Diaz wrote:
Dear list,
I want to format some language tests that different people are
preparing. Each one uses different software and there are always
problems in format that i want to solve.
for a a/b/c questions I receive text that I will format to a list
(comments are mine)
In den Büchereien gibt es auch … %the question
… Kuchen. %option a
… Theater. %option b
… Workshops. %option c
I need to detect \par or whatever sign marks the newline character as an
argument delimiter so that I dont have to paste hundreds of times braces
for each argument.
For the example, I use this macro definition (which does no work!)
\long\def\prueba
#1\par#2\par#3\par#4ñ{\framed[frame=off,width=0.8\textwidth,corner=round,offset=1em,align=flushleft]%
{{\bf Beispiel}: #1\\
\qquad a) #2\\
\qquad b) {\bf #3}\\
\qquad c) #4
}
I get: tex error on line 493 in file ./prueba.tex: The file ended when
scanning an argument.
the macro seems to read to the end of file not detecting \par; I know
its the \par that causes the problem; I used ^^M also which I read is a
sinonym for return but it also does not work.
Help would be appreciated (my computer keyboard would appreciate it too...)
better start thinking something:
\starttext
\def\foo#1{<<<#1>>>>\par}
\startluacode
local s = [[
line 1
line 2
line 3
line 4
]]
-- local s - io.loaddata("yourfile.txt")
local lines = string.splitlines(s)
for i=1,#lines do
if lines[i] ~= "" then
context.foo(lines[i])
end
end
\stopluacode
\stoptext
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the
Wiki!
maillist : ntg-context@ntg.nl /
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________