Sign up ×
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.

This is a follow-up to my earlier question Merge separate footnotes into text.

I now have a similar case, where I need to check whether there actually are footnotes relating to a particular number:


\newcommand{\mylips}[1]{\printfootnote#1 \lipsum[#1]}

\def\printfootnote#1{\footnote{\csname extfootnote#1\endcsname}}
\def\definefootnote#1 #2\endfootnote{%
  \expandafter\def\csname extfootnote#1\endcsname{#2}}


footnotefile.tex would be

\definefootnote1 Some footnote\endfootnote
\definefootnote3 Another footnote\endfootnote
\definefootnote7 And another footnote\endfootnote 

The challenge is that I don't want the empty notes to appear at all.

How would I write a test for whether the result of a certain \printfootnote\arabic{somecounter} will be empty?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

Well, your \printfootnote should check whether the footnote was defined:

  \expandafter\ifx\csname extfootnote#1\endcsname\relax % by default \csname FOO\endcsname is \relax
 \stepcounter{footnote}\else % Even if we do not produce footnote, we step the number
 \footnote{\csname extfootnote#1\endcsname}\fi}

This works for me in your example.

enter image description here

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.