# Circled footnote symbols with pifont showing arrows instead of circled numbers

I like the change of the footnote appearances with the pifont package

\usepackage{pifont}
\renewcommand\thefootnote{\ding{\numexpr171+\value{footnote}}}


but I have many footnotes [though never more than 20 a page] and after a while, I get the arrows 212, 213 and so on which can be viewed below:

How do I make a loop to start again at 172 ? Or better, how can I get numbers 11,12,13 circled instead of beginning from 1,2,3 each time ?

There is a fix here http://valis.cs.illinois.edu/blog/?p=5809 but I get that my counters are too large...

Would it be simpler to use the libertine fonts since they seem to have more circled numbers: Good way to make \textcircled numbers?

Also, I must add that I use the mathdesgin package so perhaps it is even easier to use its \figurecircled command as stated in the previous link ?

## Counter representation command

With circled numbers of package pifont only twenty (or ten) values for the footnote counter can be used. Thus there should be a warning or error, if the footnote counter is out of this range.

For this purpose, we define a counter representation command \circnum that behaves similar to \alph:

\documentclass{article}
% smaller image for TeX.SX
\usepackage[paperwidth=20mm,paperheight=20mm,margin=1mm]{geometry}

\usepackage{pifont}
\makeatletter
\newcommand*{\circnum}[1]{%
\expandafter\@circnum\csname c@#1\endcsname
}
\newcommand*{\@circnum}[1]{%
\ifnum#1<1 %
\@ctrerr
\else
\ifnum#1>20 %
\@ctrerr
\else
\ding{\the\numexpr 171+(#1)\relax}%
\fi
\fi
}
\makeatother

\renewcommand*{\thefootnote}{\circnum{footnote}}

\begin{document}
\footnote{First}
\dots
\footnote{Last}
% \footnote{Error}
\end{document}


If the latest footnote is activated, it throws an error:

! LaTeX Error: Counter too large.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
...

l.30 \footnote{
Error}
?


## Reset counter for each page

If the footnote counter is not reset from time to time, it will likely run out of its allowed range. Then it might be helpful to reset the footnote counter for each page. There are several packages for this purpose:

• Package footmisc with option perpage:

\usepackage[perpage]{footmisc}

• Package perpage:

\usepackage{perpage}
\MakePerPage[1]{footnote}


Downside: The footnote is reset at the second LaTeX run, causing errors in the first run.

• Package zref-perpage:

\usepackage{zref-perpage}
\zmakeperpage{footnote}


The following example file uses the latest method:

\documentclass{article}
% smaller image for TeX.SX
\usepackage[paperwidth=20mm,paperheight=20mm,margin=1mm]{geometry}

\usepackage{zref-perpage}
\zmakeperpage{footnote}

\usepackage{pifont}
\makeatletter
\newcommand*{\circnum}[1]{%
\expandafter\@circnum\csname c@#1\endcsname
}
\newcommand*{\@circnum}[1]{%
\ifnum#1<1 %
\@ctrerr
\else
\ifnum#1>20 %
\@ctrerr
\else
\ding{\the\numexpr 171+(#1)\relax}%
\fi
\fi
}
\makeatother

\renewcommand*{\thefootnote}{\circnum{footnote}}

\begin{document}
\footnote{First}
\dots
\footnote{Last}
% \footnote{Error}
\newpage
\footnote{New page}
\end{document}


The second page:

• There is a problems when I use the above code in enumerate environment which in a table. See below code. – Coeus Wang Jul 8 '18 at 13:29
• @CoeusWang Answer updated to make \@circnum more expandable to get it work inside longtable. – Heiko Oberdiek Jul 8 '18 at 13:58
\documentclass{article}
\usepackage{tikz}

\newcommand*\circled[1]{%
\tikz[baseline=(char.base)]\node[shape=circle,draw,inner sep=0.2pt,font=\tiny,minimum size=8pt] (char) {#1};}
\renewcommand\thefootnote{\protect\circled{\arabic{footnote}}}

\newcommand\Ftext{text\footnote{this is some text for the footnote}}% just for the example

\begin{document}

\null\vfill% just for the example
\Ftext\ \Ftext\ \Ftext\ \Ftext\ \Ftext\ \Ftext\ \Ftext\ \Ftext\ \Ftext\ \Ftext\ \Ftext    \Ftext\ \Ftext\ \Ftext\ \Ftext\ \Ftext\ \Ftext\ \Ftext\ \Ftext\ \Ftext\ \Ftext\ \Ftext    \Ftext\ \Ftext\ \Ftext\ \Ftext\ \Ftext\ \Ftext\ \Ftext\ \Ftext\ \Ftext\ \Ftext\ \Ftext
\end{document}


In my opinion, this will make the text look horrible. Footnote without circled markers are already distracting; circling the markers just make them even more distracting.