With reference to the following answer

https://tex.stackexchange.com/questions/484753/true-false-type-questions-with-xsim-package/484760?noredirect=1#[True False question with xsim][1]

How to print like following : The question should look like below:

The earth is the fourth planet from the sun. (True/False).

The answer should look like :

The earth is the fourth planet from the sun. (True/False).

The normal hide or show answer should also work.

3 Answers 3


This is just to get you started: The format of true/false has been adjusted, especially that it also repeats the question. For an answer you need to add the respective "True" or "False" in an environment on its own (I do not think you can avoid it easily given how xsim handles solutions, so I cannot even prepare a thin wrapper for you).

What I did not include at this point is the exact answer formatting. First of all, you would need to retrieve the solution body and then you would have to make comparisons to check whether true or false should be bold. The current implementation just outputs the correct answer.

Please note that setting the appropriate keys (truefalse, booleansolution) with their show/hide options will work independently from the normal exercise/solution pair.


% arara: pdflatex: {shell: 1}


  exercise-env = truefalse ,
  solution-env = booleansolution ,
  exercise-name = Question ,
  solution-name = Solution ,
  exercise-template = tf ,
  solution-template = tf ,
  counter = exercise

  truefalse/print = true,
  booleansolution/print = true,
  file-extension = tex,
  exercise/template = bonus,
  grading-table/template = default*

        The earth is the fourth planet from the sun.
  • Thank you so much.
    – cosmicraga
    Apr 15, 2019 at 18:36

Using the solution option of the exercise environment (which means that the exercise body is used as solution as well) the simplest way is pretty straight forward: just use \IfInsideSolutionTF:




  The earth is the fourth planet from the sun. \FALSE

  The earth is the third planet from the sun. \TRUE



enter image description here

 \def \lb {\LARGE\bf}

   \lb{Question 1} &\\&\\
    \l{  Earth is the fourth planet from the
    \lb{ Answer 1} & \lb{TRUE}

This looks better. You can repeat this with copy and paste. Please check it.


You must log in to answer this question.

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