On 12/08/2008, at 9:17 AM, Evan Berkowitz wrote:
I want one function to specify some amount of white space.
Couple of problems with your macro :) Here's a working version:
\documentclass{article} \usepackage{ifthen} \begin{document} \newcommand{\indentLength}{3} \newcommand{\indentUnit}{em} \newcommand{\indentFull}{\indentLength\indentUnit} \newcommand{\indents}[1]{% \ifthenelse{\numexpr#1\relax>0}{% \hspace{\indentFull}% \indents{#1-1}}{}% } hello \indents{3} hello \end{document}
The ifthen package doesn't provide \greaterthan. Also, you need that \numexpr in order to evaluate the #1-1 expression before it's used in the conditional. Recursion with the ifthen package is a bit awkward :) Also note that there's a \whiledo command in ifthen, as well.
Anyway, there's an easier way to do what you're after:
\newlength\IND \setlength\IND{3em} hello \hspace*{3\IND} hello
I.e., you could use something like \newcommand\indents[1] {\hspace*{#1\IND}}.
Hope this helps, Will