This question led to a new package:
fnpct
Following up on my question on the kerning of footnote marks after punctuation marks, I'd like to know if there is a way to achieve the kerning of footnote marks over a comma or full stop automatically or with a better macro than the one I provided there. I'm going to repeat my result and the macro I suggested.
Here the footnote marks are moved to the left by a little less than a third of the width of the punctuation marks and the normal footnote marks (that is, those that come after any other symbol or letter) are moved right by the same amount, as inspired by http://www.read.seas.harvard.edu/~kohler/latex.html and shown in my comment:
This is achieved with the following code:
\documentclass{article}
% URW Classico is a font that makes the issue apparent
\renewcommand{\sfdefault}{uop}
\renewcommand{\familydefault}{\sfdefault}
% define punctuation-aware footnote macro
\let\origfootnote\footnote
\renewcommand{\footnote}[1]{\kern.06em\origfootnote{#1}}
\newcommand{\punctfootnote}[1]{\kern-.06em\origfootnote{#1}}
% define a very small
\setlength{\textwidth}{150pt}
\setlength{\textheight}{5\baselineskip}
\begin{document}
\noindent The three little pigs built their houses out of
straw,\punctfootnote{not to be confused with hay}
sticks\footnote{or lumber according to some sources} and
bricks.\punctfootnote{probably fired clay bricks}
\end{document}
Using LuaLaTeX is an option for me. I'm also aware of the existing question regarding automatic kerning but I know too little to adapt the LuaLaTeX code there to my problem.