I've just read this post linked in the xsim_manual on p.71 example 35 and i've some troubles to adapt it to my goal.

I want to add an environment resolution for each exercises of my database. This environment will contain the complete solution of an exercise. With equations, pictures, tikz schemes,... In the post linked, the goal is to write a shortsolution environment and to use the normal command for the resolution. But i prefer to keep the regular solution environment for short solutions because it allows me to define some options inside of my documents and it's this environment that i'll use more often.

Unfortunately, i'm facing an issue when i add some long stuff inside the resolution environment. In particular, double vertical line | around a vector (for a norm) create the following error : ! File ended while scanning use of \__tl_rescan:NNw.

Can you help me to fix this ? My attempts are :

  • Using double vertical lines | around my vector ;
  • Let an exercise be free of resolution without problem. I can't write a complete computer resolution for each exercises i've computed now.
  • Keep the regular solution environment as it is.

The code below is a MWE :


%%Adapted from https://texwelt.de/fragen/23968/xsim-ubung-losung-zusatzlich-kurzlosung

% we'll use a description list for the resolutions:
                \item[Résolution ##3]


    \section{My section}
        Foo exercise with no resolution
        Foo solution with no resolution.

        Bar exercise with a resolution
        This is the resolution of my \textbf{bar} exercise.

            ||\vec{F}|| %%here is the trouble
        This is a solution for bar


  • Your MWE compiles fine for me (up to date TeX Live). (As an aside: you don't need environ – you can also use \NewDocumentEnvironment{resolution}{+b}{\SetExerciseProperty{resolution}{#1}}{})
    – cgnieder
    Jan 29, 2020 at 20:29
  • @cgnieder yes, it missed the second vertical line | where i wrote the comment. I've just updated.
    – Piroooh
    Jan 29, 2020 at 21:59

1 Answer 1


As you've discovered || makes problems. The reason is that xsim uses || as a delimiter in its property lists. If you open the .xsim file you will see lines like


In your case this makes problems because your resolutions are used as entries in such a list:

\XSIM{resolution}{exercise-2=={This is the resolution of my \textbf {bar} exercise. \par \begin {equation*} ||\vec {F}|| \end {equation*}}}

(you might notice that this for example will also prevent usage of verbatim material in your resolutions).

There are two possible solutions:

  1. Use a different delimiter, something that isn't likely to be used in normal text, maybe something like this:

    \xsimsetup{split-aux-lists = |&|}

    The xsim manual actually documents this but is outdated. It documents a single | as list delimiter (which it was in early versions).

  2. I'd prefer a different solution and avoid the problem altogether: use \lVert\vec{F}\rVert. Or – even better – load the mathtools package and do something like this:


    You can than use the much more semantic \norm{\vec{F}}.

  • Thank you for the highlight : solution and origin of the problem ! I find ||\vec{F}|| more readable but i just compare the output and think i'll change for a macro using \norm{\vec{F}} because the spaces between || is nicer. Problem solved for me :) !
    – Piroooh
    Jan 31, 2020 at 7:56
  • An other question but do you think it's possible to create the new resolution environment such that i can make some calls like \printresolutions[chapter=2, section=3] to print the complete resolutions in a dedicated appendix chapter with separated section ? At the moment, it prints all resolutions of used exercises and i can't separate them by some headings/\clearpage or \section{Resolutions of chapter 2 section 3}. In short, make a second environment like solution with all dedicated options for \printsolutions.
    – Piroooh
    Jan 31, 2020 at 8:00
  • @Piroooh that's currently not really possible. I plan to add something in the future but I really can't tell when I will find the time to implement it…
    – cgnieder
    Feb 8, 2020 at 13:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.