I undertook to build a database of my exercises and to store them, i wrote in subfolders. When needed, i called them with xsim package.

At the moment, the classification acts as follows :

enter image description here

And there are 4 difficulty.tex files at the end. I tried to use tags but was unsuccessful.

To make the call easier in a document and to compile only a part of a document, i've build the two files :

  • 5M4_AlgebreFinanciere_CollectDeclaration.tex (in '5M4_AlgebreFinanciere')
  • 5M4_AlgebreFinanciere_CollectExercises.tex (also)

So i can (un)comment the import if i don't need to compile those parts.

In those two files, i want to call the corresponding .tex files with commands to make it more flexible if i've to change names, create a new folder,...

Compilation when i write all the files manually works. But when i use something like : \collectexercises{\ExOption_\ExPart_\ExSubPart_\ExDifficulty1} with command defined to make a good path, everything work except that no exercise are printed. Collection seems to be declared in a good way and exercises are collected (see 'Exercises_Generating_Folder').

My question is : Why exercises are printed with path/names properly wrote and are not, although it compiles successfully, when i use \command ?

Here, i reduce the project to a MWE :

Main.tex :


    path = {Exercises_Generating_Folder},   %%Avoid flooding of exercises files

%%Declaration exercices


\chapter{Algebre Financière}


 %%Set up the commands to implement correctly this file

 %%Declare Global Collection for the part

 %%Declare a subpart of the Global Collection
 \DeclareExerciseCollection{\ExOption_\ExPart_\ExSubPart}    %%To declare Collection{5M4_AlgebreFinanciere_InteretsSimples}
 \DeclareExerciseCollection{\ExOption_\ExPart_\ExSubPart_\ExDifficulty1} %%And   Collection{5M4_AlgebreFinanciere_InteretsSimples_Difficulty1}


 %%Set up the commands to implement correctly this file

 \collectexercises{\ExOption_\ExPart}         %%Open Global collection.
  \collectexercises{\ExOption_\ExPart_\ExSubPart}      %%Open Global subpart collection.
   \collectexercises{\ExOption_\ExPart_\ExSubPart_\ExDifficulty1} %%Open Global subpart collection for the corresponding difficulty.
    \subimport*{\ExSubPart/}{\ExOption_\ExPart_\ExSubPart_\ExDifficulty1.tex} %%
                   %%Import the files where corresponding exercises are.
                   %%This file is in the folder 'AlgebreFinanciere/InteretsSimples'


    Can you print me ?
    No, you can't !

Thanks for any help or advice !

EDIT : The problem comes from the command \ExOption and \ExPart in collection name. In the .aux file, there are spaces or brackets (if i add them after using commands) in collection name who do not allowed me to call the collection with the proper name. I'm looking for a solution to make these commands usable.


The question is solved in this post.

The problem came from the usage of \ExOption and ExPart who did not expand when i call them in \DeclareExerciseCollection{\ExOption_\ExPart} and in \collectexercises{\ExOption_\ExPart}. Tracked by looking the .aux files where the collection was declared with the following name : {collection:\ExOption _\ExPart }{}

So i wasn't able to call the collection to print it in my document with a wrong name.

Thanks to David Carlisle and Frougon for their help to expand the command.

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.