Using \ifthenelse inside an option
Use a real optional argument
\newcommand{\introimg}[4][0.9]{
\begin{figure}
\centering
\includegraphics[width=#1\textwidth]{Figures/#2}
\caption{#4}
\label{#3}
\end{figure}
}
to be called like
\introimg{filename}{label}{caption}
or
\introimg[0.5]{filename}{label}{caption}
You don't need to use a conditional. The optional argument of a command is #1
, so you should define your command in the following way:
\documentclass{article}
\usepackage[demo]{graphicx}
\newcommand{\introimg}[4][.9]{
\begin{figure}
\centering
\includegraphics[width=#1\textwidth]{Figures/#2}
\caption{#3}
\label{#4}
\end{figure}
}
\begin{document}
\introimg{Foo}{Caption}{Fig:foo}
\introimg[.7]{Foo}{Caption}{Fig:foo}
\end{document}