Skip to content

Instantly share code, notes, and snippets.

@shakthimaan
Created February 19, 2016 12:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shakthimaan/36c1f335fd1480f02f7e to your computer and use it in GitHub Desktop.
Save shakthimaan/36c1f335fd1480f02f7e to your computer and use it in GitHub Desktop.
ifthenelse example
\documentclass{article}
\usepackage{ifthen}
\newcommand{\test}[2]
{
\ifthenelse{\equal{#1}{}}
{#2} % No optional argument Expected: Second
{#2 #1} % With optional argument Expected: Second Argument
}
\begin{document}
\test[Argument]{Second} % Observed: A [rgument]Second. Why?
\end{document}
@shakthimaan
Copy link
Author

Need to use \newcommand{\test}[2][] % Add optional argument.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment