Footnotes: distance between number and text
The issue with your code is that you put a \hspace
after setting the \@thefnmark
. You can fix this by changing LaTeX's version which is:
\newcommand\@makefntext[1]{%
\parindent 1em%
\noindent
\hb@[email protected]{\hss\@makefnmark}#1}
A more LaTeX like approach using ifthen
package would be:
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{libertine,blindtext,ifthen}
\makeatletter
\renewcommand\@makefntext[1]{%
\parindent 1em%
\noindent
\ifthenelse{\value{footnote}>99}{%
\hb@xt@ 30\p@
}{%
\ifthenelse{\value{footnote}<9}{%
\hb@xt@ 10\p@
}{%
\hb@xt@ 20\p@
}%
}%
{\sffamily\bfseries\@thefnmark\hss}#1}
\makeatother
\begin{document}
Hello\footnote{I am a footnote!}\footnote{I am another footnote
\blindtext}.
\addtocounter{footnote}{15}%
Hello\footnote{I am a footnote!}\footnote{I am another footnote
\blindtext}.
\addtocounter{footnote}{99}%
Hello\footnote{I am a footnote!}\footnote{I am another footnote
\blindtext}.
\end{document}
Adjust the length to suit yourself: I used 10pt as fixed distance and 0.5em for each digit.
This assumes the footnote mark expands to a positive number, of course.
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{libertine}
\usepackage{expl3}
\makeatletter
\renewcommand\@makefntext[1]{%
\proportionalnums{\bfseries
\makebox[\getfnmarkwidth\@thefnmark][l]{%
\proportionalnums{\@thefnmark}%
}%
}%
#1%
}
\makeatother
\ExplSyntaxOn
\cs_new_protected:Nn \getfnmarkwidth:n
{
\dim_eval:n { 10pt + .5em * \fp_eval:n { floor(ln(#1)/ln(10),0) + 1 } }
}
\cs_generate_variant:Nn \getfnmarkwidth:n { V }
\cs_set_eq:NN \getfnmarkwidth \getfnmarkwidth:V
\ExplSyntaxOff
\begin{document}
Hello\footnote{I am a footnote!}\footnote{I am another footnote.}
\setcounter{footnote}{9}
Hello\footnote{I am a footnote!}\footnote{I am another footnote.}
Hello\footnote{I am a footnote!}\footnote{I am another footnote.}
\setcounter{footnote}{99}
Hello\footnote{I am a footnote!}\footnote{I am another footnote.}
Hello\footnote{I am a footnote!}\footnote{I am another footnote.}
\end{document}
Explanation: floor(ln(#1)/ln(10),0)+1
is the number of digits of #1
.