Latest news 2020-05-02: new blog post "Book Samples."

# Bug Tracker

ID: 83 🔗 Closed (Fixed) datatooltk 1.4 OS X Yosemite José Antonio Torralba Hernández 2015-04-13 07:08:42 fields repeat in the import of probsoln problems with data tool-gui interface on osx

## Report

I am a Spanish user of LaTeX. I am a Physics teacher. Congratulations for your extraordinary package Probsoln, and the gui interface of datoooltk that avoid to import directly tex probsoln files with problems.

I am trying to import your sample file: "prob-probspaces.tex" into the gui interface of datooltk that i installed in my macbook pro (OS X Yosemite), in a java environment, but imports the same contents into questions and answer fields. I do not have to resolve the problem.

### MWE

%%
% Finite probability spaces
\newproblem{weightedcoin}{%
A coin is weighted so that heads is four times as likely
as tails. Find the probability that:
\begin{textenum}
\item tails appears,
\end{textenum}}{%
Let $p=P(T)$, then $P(H)=4p$. We require $P(H)+P(T)=1$,
so $4p+p=1$, hence $p=\frac{1}{5}$. Therefore:
\begin{textenum}
\item $P(T)=\frac{1}{5}$,
\item $P(H)=\frac{4}{5}$
\end{textenum}}

\newproblem*{validprobspaces}{%
Under which of the following functions does
$S=\{a_1,a_2\}$ become a probability space?
\par
\begin{textenum}
\begin{tabular}{ll}
\incorrectitem $P(a_1)=\frac{1}{3}$, $P(a_2)=\frac{1}{2}$
&
\correctitem $P(a_1)=\frac{3}{4}$, $P(a_2)=\frac{1}{4}$
\\
\correctitem $P(a_1)=1$, $P(a_2)=0$
&
\incorrectitem $P(a_1)=\frac{5}{4}$, $P(a_2)=-\frac{1}{4}$
\end{tabular}
\end{textenum}
}


## Evaluation

At first I thought this was a bug as well, but I realise that this is due to the definition of \newproblem. The datatooltk import function works by inserting all text contained inside the onlyproblem environment into the Question field and all text contained inside the onlysolution environment into the Answer field. Any text in the problem that occurs outside of either of these environments is placed in both fields (as it would appear in the document regardless of the answers/noanswers setting). The \newproblem command is defined such that
 \newproblem[⟨n⟩][⟨default args⟩]{⟨label⟩}{⟨problem⟩}{⟨solution⟩}

is equivalent to
\begin{defproblem}[⟨n⟩][⟨default args⟩]{⟨label⟩}%
⟨problem⟩%
\begin{onlysolution}%
\begin{solution}%
⟨solution⟩%
\end{solution}%
\end{onlysolution}%
\end{defproblem}

(See section 6 "Defining a Problem" in the probsoln manual.) This means that ⟨problem⟩ isn't inside the onlyproblem environment which is why it ends up in both fields. If you use prob-probspaces2.tex instead of prob-probspaces.tex which uses defproblem instead of \newproblem then the import function works as expected.

Since it makes more sense for the import function to treat the ⟨problem⟩ argument of \newproblem as though it was inside onlyproblem I will modify the import function. (I can't change the definition of \newproblem within probsoln.sty as that would break backward compatibility, but I could get the import function to temporarily redefine it.)

Update 2015-04-20: fixed in version 1.5.

## Watch This Report

If you supply your name, it will be used in the email greeting, which provides a more personal message, otherwise you'll just get a generic greeting. If you have previously supplied your name when signing up for notifications, you don't need to resupply it unless you want to change it.

If you have previously subscribed to notifications for this report, you can unsubscribe by clicking on the "Stop Notification" button.

The "Confirm Bug ID" field helps to protect against spambots. Please enter the bug ID (which you can find at the top of this page).

Name: (Optional.)