cgnieder / xsim

eXercise Sheets IMproved
67 stars 23 forks source link

Change the writing of external files by scantokens #30

Closed pablgonz closed 5 years ago

pablgonz commented 6 years ago

Hello, first of all, grateful for the great work with xsim, I have a suggestion (or idea) that I can maybe implement in xsim, I know that writing external files is necessary because of verbatim can not be used as an argument in macros, but, in some replies on tex.sx:

and pythontex package, they manage not to use external files and save verbatim material using scantokens. Could you implement this in xsim? Saludos

cgnieder commented 6 years ago

I am planning to add a solution as an alternative to the current behavior. I do not have as much time as I used to for (La)TeX currently. This will come one time…

cgnieder commented 5 years ago

I close this as a duplicate of issue #9

pablgonz commented 5 years ago

Hooo, I hadn't read (#9) when I wrote this. I wrote a comment on the previous commit 5ccf34d . Waiting for the new version :). Thank you for everything. The best. Pablo

cgnieder commented 5 years ago

I have seen the comment and I've noticed the scontents package. For the time being the switching-off of the external files will disable using verbatim material, though… scontents does

\NewDocumentCommand { \__scontents_verb_arg:w } { +v }

which is a little bit of cheating ;) \NewDocumentCommand is meant to define user commands while \__scontents_verb_arg:w clearly is an internal command for the package… I've misused \NewDocumentCommand, too, but not in xsim where I want to keep the code as clean as I can.

I might find another way, though :)

pablgonz commented 5 years ago

Yes, the truth is that \scontents_verb_arg:w is a bit misleading ... there was no other way out since \tl_rescan does not work properly with verbatim material, only the old \scantokens has that ability :) (for now) .

The code of xsim is pure and clear, we appreciate the comments you leave in source codes, otherwise I would never have understood how xsimverb worked.

The comment left it for the scontents environment rather than for the \Scontents command, basically it is the same idea as xsimverb, but, saving the content in \tl and modifying the blessed end of line ^^M :) (a headache) and stored this in a sequence.

With your new version I think I can move (at last) from exsheets to xsim.

Maybe an idea of the "star" type in environments not to write in external files? I see something like that in my mind:

\usepackage[no-files]{xsim}
\begin{exercise*}[...]
\scantokens{body} and save in prop list
\end{exercise*}
\begin{solution*}[...]
\scantokens{body} and save in prop list
\end{solution*}

and for xparse, solution of solution* are different (I don't mean the s argument) . maybe you could try something, I repeat, it's just an idea, and it's not that this against writing external files, it's just that, one of the things I liked most about exsheets was that. Saludos