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

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

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