Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I've seen that sometimes (most in TikZ code) people use \pgfutil@empty to test a macro.

Is there any benefit from using \pgfutil@empty instead of the \empty macro?

Also, is there any usage or good practices for the preference of one over the other? Can you elaborate in which cases you prefer one over the other? Or even if one is obsolete and you should always use the other?

share|improve this question

1 Answer 1

up vote 10 down vote accepted

TikZ/PGF was designed to be usable with LaTeX, ConTeXt, and Plain TeX, and therefore cannot rely on certain things existing that might be considered "standard" by a LaTeX-only package. Therefore, PGF (re)defines a load of stuff that it knows it will use from the LaTeX core so that it can use it with ConTeXt and Plain TeX. These tend to be macros with the prefix pgfutil@. We thus have \pgfutil@empty, \pgfutil@firstofone, and so forth.

If you are writing something for general use that depends on TikZ/PGF then it is good practice to use these versions instead of the LaTeX ones since then whatever you are writing is more likely to work in the different engines - or even if you aren't bothered about it, then it makes it easier for someone else to adapt it. However, in your own private LaTeX code then it doesn't matter.

share|improve this answer
    
Can you point where all these internal macros are defined? –  Dror Sep 6 '13 at 5:54
1  
@Dror The \pgfutil@ macros are defined in pgfutil-common.tex. –  Loop Space Sep 6 '13 at 6:34

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.