GeneralHow to compare empty string using \equal

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
fractal.generator
Posts: 66
Joined: Tue Oct 07, 2008 9:39 am

How to compare empty string using \equal

Post by fractal.generator »

Dear all,

I want to detect whether a parameter is an empty string.

Here is the illustration.

Code: Select all

\documentclass{article}
\usepackage{ifthen}

\newcommand\print[1][]
{%
\ifthenelse{\equal{#1}{}}% It does NOT work
{EMPTY}
{#1}
}

\begin{document}
\print

\print[fulltime]
\end{document}

Thank you in advance.


hayashi

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

phi
Posts: 577
Joined: Tue Oct 21, 2008 8:10 pm

How to compare empty string using \equal

Post by phi »

Hi,
i just tried it and it works. Output is:

Code: Select all

EMPTY
fulltime
Post Reply