mystmd
mystmd copied to clipboard
LaTeX export for exercises
Hello,
I tried to export to pdf (through latex) a mysd-md document using the
new cool exercise and solution directives. It seems that this is not
yet supported:
⛔️ Unhandled LaTeX conversion for node of "exercise"
⛔️ Unhandled LaTeX conversion for node of "solution"
Proposal
The basic approach would be to generate \begin{exercise} and \begin{solution}
LaTeX environments, leaving up to the templates to implement those.
My use case is simple, with each exercise being followed by it's solution, so that
would do the job.
But of course, supporting exercise labels and solutions that are numbered according to their corresponding exercise would take more work.
Thanks in advance!
Thanks for opening your first issue here! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.
If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).
Welcome to the EBP community! :tada:
Notes:
- For now, I can do with plain admonitions, so no rush.
- The use case is to be able to print the exercise sheets -- without solutions -- for in-class on-paper work.
Hi @nthiery thanks for opening the issue! yes these don't yet have LaTeX translations defined for the nodes. I think they are easy to add, if we could define the desired LaTeX snippets/formatting.
Do you have a preferred style that you have used or have commonly seen? I note that there is an exercises package but have no experience of using that myself https://ctan.math.illinois.edu/macros/latex/contrib/exercises/exercises.pdf
Thanks @stevejpurves for the quick reaction!
For my simple use case, I am writing my own template anyway. So as soon as
:::{exercise} is mapped to some latex environment \begin{exercise},
and :::{exercise} truc to \begin{exercise}[truc], I am good to go (e.g. defining
an exercise "theorem" on the latex side).
That could be a sane first step, in waiting for more use cases to inform the generally desirable formatting on the latex side.
For ease of extensibility one could even possibly imagine that directives unknown to mystmd could (optionally) be mapped similarly to latex environments, possibly with a warning. Or maybe it's now worth worrying about it, since that need for easy extensibility will vanish as soon as mystmd will enable user defined directives.
I also have this problem. Would it be possible to have some fallback mechanism so that unhandled exercises and solutions get transformed into some other admonition when building pdf files?