Latest news 2021-09-06: new blog post "Legacy Documents and TeX Live Docker Images".

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.

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

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=66