\\
Source Link
David Carlisle
  • 648.8k
  • 58
  • 1432
  • 2250

I don't know where the problem comes from exactly, but you'd be better off using etoolbox rather than ifthen; see Why is the ifthen package obsolete?.

\documentclass{book}

\usepackage{etoolbox}

\newcounter{try}

\newcommand{\foo}[1]{\ifnumequal{#1}{1}{1}{0}}

\newcommand\test[1]{\setcounter{try}{\foo{#1}}%
\arabic{try}}

\begin{document}

\noindent
Result of foo\{3\}: \foo{3}\    \\
Result of test\{3\}: \test{3}\    \\
Result of foo\{1\}: \foo{1}\    \\
Result of test\{1\}: \test{1}

\end{document}

enter image description here

I don't know where the problem comes from exactly, but you'd be better off using etoolbox rather than ifthen; see Why is the ifthen package obsolete?.

\documentclass{book}

\usepackage{etoolbox}

\newcounter{try}

\newcommand{\foo}[1]{\ifnumequal{#1}{1}{1}{0}}

\newcommand\test[1]{\setcounter{try}{\foo{#1}}%
\arabic{try}}

\begin{document}

\noindent
Result of foo\{3\}: \foo{3}\    Result of test\{3\}: \test{3}\    Result of foo\{1\}: \foo{1}\    Result of test\{1\}: \test{1}

\end{document}

enter image description here

I don't know where the problem comes from exactly, but you'd be better off using etoolbox rather than ifthen; see Why is the ifthen package obsolete?.

\documentclass{book}

\usepackage{etoolbox}

\newcounter{try}

\newcommand{\foo}[1]{\ifnumequal{#1}{1}{1}{0}}

\newcommand\test[1]{\setcounter{try}{\foo{#1}}%
\arabic{try}}

\begin{document}

\noindent
Result of foo\{3\}: \foo{3}\\
Result of test\{3\}: \test{3}\\
Result of foo\{1\}: \foo{1}\\
Result of test\{1\}: \test{1}

\end{document}

enter image description here

replaced http://tex.stackexchange.com/ with https://tex.stackexchange.com/
Source Link

I don't know where the problem comes from exactly, but you'd be better off using etoolbox rather than ifthen; see Why is the ifthen package obsolete?Why is the ifthen package obsolete?.

\documentclass{book}

\usepackage{etoolbox}

\newcounter{try}

\newcommand{\foo}[1]{\ifnumequal{#1}{1}{1}{0}}

\newcommand\test[1]{\setcounter{try}{\foo{#1}}%
\arabic{try}}

\begin{document}

\noindent
Result of foo\{3\}: \foo{3}\    Result of test\{3\}: \test{3}\    Result of foo\{1\}: \foo{1}\    Result of test\{1\}: \test{1}

\end{document}

enter image description here

I don't know where the problem comes from exactly, but you'd be better off using etoolbox rather than ifthen; see Why is the ifthen package obsolete?.

\documentclass{book}

\usepackage{etoolbox}

\newcounter{try}

\newcommand{\foo}[1]{\ifnumequal{#1}{1}{1}{0}}

\newcommand\test[1]{\setcounter{try}{\foo{#1}}%
\arabic{try}}

\begin{document}

\noindent
Result of foo\{3\}: \foo{3}\    Result of test\{3\}: \test{3}\    Result of foo\{1\}: \foo{1}\    Result of test\{1\}: \test{1}

\end{document}

enter image description here

I don't know where the problem comes from exactly, but you'd be better off using etoolbox rather than ifthen; see Why is the ifthen package obsolete?.

\documentclass{book}

\usepackage{etoolbox}

\newcounter{try}

\newcommand{\foo}[1]{\ifnumequal{#1}{1}{1}{0}}

\newcommand\test[1]{\setcounter{try}{\foo{#1}}%
\arabic{try}}

\begin{document}

\noindent
Result of foo\{3\}: \foo{3}\    Result of test\{3\}: \test{3}\    Result of foo\{1\}: \foo{1}\    Result of test\{1\}: \test{1}

\end{document}

enter image description here

Source Link
jub0bs
  • 55.8k
  • 21
  • 187
  • 280

I don't know where the problem comes from exactly, but you'd be better off using etoolbox rather than ifthen; see Why is the ifthen package obsolete?.

\documentclass{book}

\usepackage{etoolbox}

\newcounter{try}

\newcommand{\foo}[1]{\ifnumequal{#1}{1}{1}{0}}

\newcommand\test[1]{\setcounter{try}{\foo{#1}}%
\arabic{try}}

\begin{document}

\noindent
Result of foo\{3\}: \foo{3}\    Result of test\{3\}: \test{3}\    Result of foo\{1\}: \foo{1}\    Result of test\{1\}: \test{1}

\end{document}

enter image description here