1

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

1

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.

xsim

% arara: pdflatex: {shell: 1}
\documentclass[10pt,a4paper]{article}
\usepackage[verbose,clear-aux]{xsim}
\usepackage{amssymb}

\DeclareExerciseEnvironmentTemplate{tf}
  {%
    \UseExerciseTemplate{begin}{default}%
    \IfInsideSolutionT{\GetExerciseBody{exercise}\bfseries}%
  }
  {%
    \IfInsideSolutionF{(True/False).}%
    \UseExerciseTemplate{end}{default}%
  }

\DeclareExerciseType{tf}{
  exercise-env = truefalse ,
  solution-env = booleansolution ,
  exercise-name = Question ,
  solution-name = Solution ,
  exercise-template = tf ,
  solution-template = tf ,
  counter = exercise
}

\xsimsetup{
  truefalse/print = true,
  booleansolution/print = true,
  path=./exercises,
  file-extension = tex,
  exercise/template = bonus,
  grading-table/template = default*
}

\begin{document}
    \begin{truefalse}
        The earth is the fourth planet from the sun.
    \end{truefalse}
    \begin{booleansolution}
      True.
    \end{booleansolution}
\end{document} 
1
  • Thank you so much.
    – cosmicraga
    Apr 15, 2019 at 18:36
1

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:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[no-files]{xsim}

\newcommand*\FALSE{(True/\IfInsideSolutionT{\textbf}{False})}
\newcommand*\TRUE{(\IfInsideSolutionT{\textbf}{True}/False)}

\begin{document}

\begin{exercise}[solution]
  The earth is the fourth planet from the sun. \FALSE
\end{exercise}

\begin{exercise}[solution]
  The earth is the third planet from the sun. \TRUE
\end{exercise}

\printsolutions

\end{document}

enter image description here

-1
 \def \lb {\LARGE\bf}
  \def\l{\LARGE}
  \begin{document}

   \begin{tabular}{ll}
   \lb{Question 1} &\\&\\
    \l{  Earth is the fourth planet from the
    sun}&\lb{TRUE/FALSE}\\&\\
    \lb{ Answer 1} & \lb{TRUE}
    
    \end{tabular}
    \end{document}

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

1

You must log in to answer this question.

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