4

I use the package "answers" in a Markdown file. After compilation with Pandoc the PDF I get is ok (solutions at the right place) but the option of the following LaTeX command \Optionsolutionfile{ans}[ex1] produces the writing of [ex1]. How to avoid that?

I precise that there are two series of exercises in my document and each series is followed by the solutions.

That's why I use \Optionsolutionfile{ans}[ex1] and then \Optionsolutionfile{ans}[ex2] at another place.

Thanks in advance

2 Answers 2

4

Pandoc doesn't like the option in brackets after the latex command. In order to make it work you have to use a recent version of pandoc that supports generic raw attributes. Now you can create a raw latex block around the offending command:

```{=latex}
\Opensolutionfile{ans}[ex1] 
```

Or inline:

`\Opensolutionfile{ans}[ans1]`{=latex}
2
  • Thanks DG but it's not good. Which version of pandoc should I use ?
    – imotep81
    Nov 12, 2017 at 10:13
  • It works with the most recent: 2.0.1.1
    – DG'
    Nov 12, 2017 at 10:18
1

In fact it works even with pandoc old version (1.12 debian jessie)

In the file default.latex I've created a newcommand

\newcommand{\fic}[1]{ \Optionsolutionfile{ans}[ex#1] }

and inside my file.md I call the command by

\fic {1}

at the right place to get the solutions of the first serie of exercises and the

\fic {2}

to get the second serie of solutions etc...

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .