TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm not fully grasping how the \ifx command handles types.

How should the following def's read to make the \ifx statement true when pdflastypos is at the zero coordinate?


  TRUE \newline
  FALSE \newline
share|improve this question
up vote 8 down vote accepted

No, \ifx will be false for that definition. TeX doesn't really believe in types. \ifx just compares the token lists in the definition and the token 0 is not the same as the token \pdflastypos


would test to true as \ifnum expands tokens to find a <number>

share|improve this answer

The explicit question is already answered by David Carlisle. Thus this answer adds a more complete use case. \pdflastxpos and \pdflastypos cannot be used in a direct way. Previously \pdfsavepos must be called and the positions are availabe at shipout time. Thus the values \pdflastxpos and \pdflastypos needs to be written to a auxiliary file. Then in the next LaTeX run the stored values from the auxiliary file can be used. Package zref-savepos (of project zref) provides an interface for the \pdfsavepos feature that remembers the values in references:


  \typeout{Y-position: unknown}%
  \ifnum\zposy{somewhere}=0 %
    \typeout{Y-position: zero}%
    \typeout{Y-position: \zposy{somewhere}sp}%
share|improve this answer

Your Answer


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.