# Print only existing footnotes / suppress empty footnotes

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:

\documentclass[a4paper]{article}

\usepackage{lipsum}
\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}}
\input{footnotefile}

\begin{document}
\mylips{1}
\mylips{2}
\mylips{3}
\mylips{4}
\mylips{5}
\mylips{6}
\mylips{7}
\end{document}


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?

-

Well, your \printfootnote should check whether the footnote was defined:
\def\printfootnote#1{%