Based on this answer to my question Footnote marker in text should be superscript lining figure, but footnote marker in the footnote should be full size old style figure, I have the following code for formatting the appearance of footnotes:
\documentclass{article}
\usepackage{fontspec} % Unicode
\setmainfont{Libertinus Serif}
\newfontfamily\footfont{Libertinus Serif}[% for footnote markers in the footnote
Numbers = {Monospaced, OldStyle}]
\usepackage{scrextend} % KOMA script
\newcommand*\footnotemarkspace{1em} % set distance of the footnote text from the margin
\deffootnote{\footnotemarkspace}% use distance from above
{\parindent}% paragraph indent in footnotes (footnotes should never have paragraphs!)
{\makebox[\footnotemarkspace][l]{\footfont\thefootnotemark.}} % footfont with period for footnote marks in footnote
\begin{document}
Foobar\footnote{First footnote}\footnote{Second footnote}\footnote{Third footnote}\footnote{Fourth footnote}\footnote{Fifth footnote}\footnote{Sixth footnote}\footnote{Seventh footnote}\footnote{Eighth footnote}\footnote{Ninth footnote}\footnote{Tenth footnote}\footnote{Eleventh footnote}\footnote{Twelfth footnote}
\end{document}
A problem appears when I reach the tenth footnote in my text, i.e. when the footnote mark goes from a single digit to two digits. The output from the code above is this:
The problem is that footnotemarkspace
sets the distance from the left margin to the footnote text, with no parameter for setting the distance from the right edge of the footnote mark to the text.
The best solution, as it seems to me, would be to right-align the footnote marks, so that the single digits have the same right edge as the double digits, which would allow for a uniform distance from the right edge of the footnote mark to the text. Ideally, then, the left edge of the double digit footnote mark should align with the left margin of the document text area.
How can I accomplish this? The same question has been asked before, but in that case, neither the question nor the proposed answers use KOMA script, which I am using in this case.