Latest news 2024-10-15: New blog post: Tales for Our Times Book Launch.

Bug Tracker RSS feed

I’m currently working on a major new version of the datatool package. This may take a while. Please be patient. (Experimental version available for testing.)

ID 83🔗
Date: 2015-04-13 07:08:42
Status Closed (Fixed)
Category datatooltk
Version 1.4
Summary fields repeat in the import of probsoln problems with data tool-gui interface on osx
OS OS X Yosemite

Sign in to subscribe to notifications about this report.

Description

I am a Spanish user of LaTeX. I am a Physics teacher. Congratulations for your extraordinary package Probsoln, and the gui interface of datatooltk 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

Download (3.26K)

%%
%% This is file `prob-probspaces.tex',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% probsoln.dtx  (with options: `prob-probspaces.tex,package')
%% 
%%  probsoln.dtx
%%  Copyright 2013 Nicola Talbot
%% 
%%  This work may be distributed and/or modified under the
%%  conditions of the LaTeX Project Public License, either version 1.3
%%  of this license of (at your option) any later version.
%%  The latest version of this license is in
%%    http://www.latex-project.org/lppl.txt
%%  and version 1.3 or later is part of all distributions of LaTeX
%%  version 2005/12/01 or later.
%% 
%%  This work has the LPPL maintenance status `maintained'.
%% 
%%  The Current Maintainer of this work is Nicola Talbot.
%% 
%%  This work consists of the files probsoln.dtx and probsoln.ins and the derived files probsoln.sty, sample-exclude.tex, sample.tex, sample2.tex, sample3.tex, sample4.tex, sample5.tex, sample6.tex, sample7.tex, sample8.tex, prob-1stprncp.tex, prob-args.tex, prob-easy.tex, prob-easy2.tex, prob-implicit.tex, prob-mchoice.tex, prob-mixed.tex, prob-newdata.tex, prob-nosoln.tex, prob-probspaces.tex, prob-probspaces2.tex, prob-tabmchoice.tex, prob-verb.tex.
%% 
%% \CharacterTable
%%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%%   Digits        \0\1\2\3\4\5\6\7\8\9
%%   Exclamation   \!     Double quote  \"     Hash (number) \#
%%   Dollar        \$     Percent       \%     Ampersand     \&
%%   Acute accent  \'     Left paren    \(     Right paren   \)
%%   Asterisk      \*     Plus          \+     Comma         \,
%%   Minus         \-     Point         \.     Solidus       \/
%%   Colon         \:     Semicolon     \;     Less than     \<
%%   Equals        \=     Greater than  \>     Question mark \?
%%   Commercial at \@     Left bracket  \[     Backslash     \\
%%   Right bracket \]     Circumflex    \^     Underscore    \_
%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%%   Right brace   \}     Tilde         \~}
%% randomly select 25 problems from derivatives.tex and add to
%% the data set called 'deriv'
%% Display the problems
%% You may need to change \theenumi back here
%% randomly select 25 problems from probspaces.tex and add to
%% the data set called 'spaces'
%% Display the problems
%% You may need to change \theenumi back here
 % This file is public domain
 %
 % 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,
\item heads 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}
}
\endinput
%%
%% End of file `prob-probspaces.tex'.

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.

Comments

0 comments.


Add Comment

Name (optional):

Are you human? Please confirm the bug report ID (which can be found at the top of this page) or login if you have an account.

Comment:


You can use the following markup:

Block:

[pre]Displayed verbatim[/pre]
[quote]block quote[/quote]

In line:

[tt]code[/tt]
[file]file/package/class name[/file]
[em]emphasized text[/em]
[b]bold text[/b]
[url]web address[/url] [sup]superscript[/sup]
[sub]subscript[/sub]

Ordered list:
[ol]
[li]first item[/li]
[li]second item[/li]
[/ol]

Unordered list:
[ul]
[li]first item[/li]
[li]second item[/li]
[/ul]

You can use the Preview button to review your message formatting before submitting.

Page permalink: https://www.dickimaw-books.com/bugtracker.php?key=83