Bug Tracker 
| ID | 66🔗 |
|---|---|
| Date: | 2014-09-03 12:44:51 |
| Status | Closed (Not a Bug) |
| Category | probsoln |
| Version | 3.04 |
| Summary | Default args are ignored |
| OS | Win7 64b, MikTex 2.9 |
Sign in to subscribe to notifications about this report.
I'm looking for a volunteer to take over
probsoln. If you are interested, please use the contact page.
Description
I have some problems which take no args, and a couple which do. When I try to compile with 1 required arg and a default value, pdflatex fails to compile, complaining that I need to provide a value (when using\thisproblem) or breaking the environment (using \useproblem).
MWE
Download (430B)
\documentclass[a4paper,12pt]{article}
\usepackage[draft]{probsoln}
\begin{document}
\begin{defproblem}[1][{2}]{diffsin}
Differentiate $f(x)=\sin(#1x)$.
\begin{onlysolution}%
\begin{solution}
$f’(x) = #1\cos(#1x)$
\end{solution}
\end{onlysolution}
\end{defproblem}
\begin{enumerate}
\item \useproblem{diffsin}
%Same thing with \foreachproblem{\item\thisproblem}
\end{enumerate}
\end{document}
Evaluation
The default arguments are only used by \thisproblem together with the package option usedefaultargs. Like this:
\documentclass[a4paper,12pt]{article}
\usepackage[usedefaultargs]{probsoln}
\begin{document}
\begin{defproblem}[1][{2}]{diffsin}
Differentiate $f(x)=\sin(#1x)$.
\begin{onlysolution}%
\begin{solution}
$f'(x) = #1\cos(#1x)$
\end{solution}
\end{onlysolution}
\end{defproblem}
\begin{enumerate}
\foreachproblem{\item\thisproblem}
\end{enumerate}
\end{document}
This is documented in the manual, but I will add a note to make it clearer.Comments
0 comments.
Add Comment
Page permalink: https://www.dickimaw-books.com/bugtracker.php?key=66
