GeneralPhantom

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
latexforever
Posts: 120
Joined: Fri Nov 14, 2008 9:40 pm

Phantom

Post by latexforever »

Hello,

I'm currently making a macro. Its aim is to simplify teacher's task when writing ``text-holes'' (it's called ``texte à trous'' in French).

Here is a MWE:

Code: Select all

\documentclass[10pt]{article}
\usepackage{ifthen}

\newboolean{Teachernotes}
\setboolean{Teachernotes}{true} % true if the output is the teacher's document, false if the output is the pupil's document

\newcommand{\Hole}[1]{
\ifthenelse{\boolean{Teachernotes}\equal true} % if the output is the teacher's document,
{\textbf{#1}} % pupil-hidden words are in bold
{\underline{\phantom{#1}}} % (else) at the place of the word (the pupil has to write down on his sheet), is a bar, to let him write. This bar has she size of the word.
}


\begin{document}



Here is a \Hole{test}.
\end{document}
I want this: when setting

Code: Select all

\setboolean{Teachernotes}{true}
, hidden words are displayed in bold (so we would have, here: ``Here is a test.''); when setting

Code: Select all

\setboolean{Teachernotes}{false}
, hidden words are hidden, and the space the hidden word is filled with a bar (so we would have, here: ``Here is a ____'').

It seems to work, but when I choose to have teacher's output, the output document contains the greek delta letter, and words are not displayed.

What can I do? It is easy, but I can't find the solution.

I've looked at the ifthen package's manual.

Thanks!

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

marco_d
Posts: 57
Joined: Tue Jan 20, 2009 7:49 pm

Phantom

Post by marco_d »

Hello

Hello that works:

Code: Select all

\documentclass[10pt]{article}
\usepackage{ifthen}

\newboolean{Teachernotes}
%\setboolean{Teachernotes}{true} % true if the output is the teacher's document, false if the output is the pupil's document

\newcommand{\Hole}[1]{
\ifthenelse{\boolean{Teachernotes}} % if the output is the teacher's document,
{\textbf{#1}} % pupil-hidden words are in bold
{\underline{\phantom{#1}}} % (else) at the place of the word (the pupil has to write down on his sheet), is a bar, to let him write. This bar has she size of the word.
}


\begin{document}
Here is a \Hole{test}. The number of the test is \Hole{$\pi$}
\end{document}
When you set a newboolean the argument is false.

regards
Marco
i am German. I can not use difficult words. :-)
latexforever
Posts: 120
Joined: Fri Nov 14, 2008 9:40 pm

Phantom

Post by latexforever »

Ok, but it works only for the student's document, doesn't it?
When I want the output to be the teacher's one, Teachernotes must be true. So, I have to use:

Code: Select all

\setboolean{Teachernotes}{true} % true if the output is the teacher's document, false if the output is the pupil's document
, don't I?

Thanks.
marco_d
Posts: 57
Joined: Tue Jan 20, 2009 7:49 pm

Phantom

Post by marco_d »

Hello,

Here the students version

Code: Select all

\documentclass[10pt]{article}
\usepackage{ifthen}

\newboolean{Teachernotes}
%\setboolean{Teachernotes}{true} % true if the output is the teacher's document, false if the output is the pupil's document

\newcommand{\Hole}[1]{
\ifthenelse{\boolean{Teachernotes}} % if the output is the teacher's document,
{\textbf{#1}} % pupil-hidden words are in bold
{\underline{\phantom{#1}}} % (else) at the place of the word (the pupil has to write down on his sheet), is a bar, to let him write. This bar has she size of the word.
}


\begin{document}
Here is a \Hole{test}. The number of the test is \Hole{$\pi$}
\end{document}
And here the teachers version:

Code: Select all

\documentclass[10pt]{article}
\usepackage{ifthen}

\newboolean{Teachernotes}
\setboolean{Teachernotes}{true} % true if the output is the teacher's document, false if the output is the pupil's document

\newcommand{\Hole}[1]{
\ifthenelse{\boolean{Teachernotes}} % if the output is the teacher's document,
{\textbf{#1}} % pupil-hidden words are in bold
{\underline{\phantom{#1}}} % (else) at the place of the word (the pupil has to write down on his sheet), is a bar, to let him write. This bar has she size of the word.
}


\begin{document}
Here is a \Hole{test}. The number of the test is \Hole{$\pi$}
\end{document}
Both work fine.

regards
Marco
i am German. I can not use difficult words. :-)
latexforever
Posts: 120
Joined: Fri Nov 14, 2008 9:40 pm

Re: Phantom

Post by latexforever »

Thanks. Sorry, I was a little bit perturbated because it does not work at all as C or C# do!

Thanks!
Post Reply