I would like to use an auxiliary file to read and write some information.
Context
In this case, I am using this auxiliary file to record the widths used in the footnote formatting. Indeed, I want my footnote numbers to be right-aligned, like this :
So I need to know in advance (using information from previous compilations) the width of the widest footnote number (\@widthFootnoteNum
for a "normal" footnote, \@mpwidthFootnoteNum
for a footnote in a minipage).
If I only take into account "normal" footnotes, I have no particular problem. The value of \@widthFootnoteNum
is written in an auxiliary file (called \jobname.foot
) at the end of the compilation and read at the beginning of the next compilation.
However, if I do the same thing with footnotes in a minipage environment, things get complicated. Several values are written to the auxiliary file and I have to read this file to find the correct widths and write to it to give the correct widths for the next compilation in parallel.
My tests are not conclusive... I manage to write all the necessary information, but I can't read it afterwards.
MWE
Consider the following MWE:
A simple file containing 20 "normal" footnotes and two minipage
environments containing 2 and 7 notes.
\documentclass{article}
\usepackage{fontspec}
\setmainfont[Numbers={Proportional}]{LibertinusSerif}
\usepackage{etoolbox}
\makeatletter
\newcommand*\@symbolesnum[1]{% new numerotation for minipage footnote
\ifcase#1\unskip \or \unskip * \or \unskip † \or \unskip ‡ \or \unskip ** \or \unskip †† \or \unskip ‡‡ \or \unskip *** \or \unskip ††† \or \unskip ‡‡‡ \or \unskip **** \or \unskip †††† \or \unskip ‡‡‡‡ \or \unskip ***** \or \unskip ††††† \or \unskip ‡‡‡‡‡ \else\@ctrerr \fi%
}
\newlength{\@widthCurrentFootnoteNumTemp} % width of the current footer number
\newlength{\@maxWidthFootnoteNumTemp} % maximum footnote number width
\newlength{\@widthFootnoteNum} % width set after reading the auxiliary file
\AtBeginDocument{% Creating and opening the auxiliary file
\newwrite\auxFootnoteOutput%
\immediate\openout\auxFootnoteOutput=\jobname.foot%
\setlength{\@maxWidthFootnoteNumTemp}{0pt}%
}
\AtEndDocument{%
\immediate\write\auxFootnoteOutput{\the\@maxWidthFootnoteNumTemp}% Writing the value of \@widthFootnoteNum
\immediate\closeout\auxFootnoteOutput% Closing the auxiliary file
}
% For each footnote, the width of the footnote number is measured by \@widthCurrentFootnoteNumTemp.
% This width is compared to \@maxWidthFootnoteNumTemp.
% If \@widthCurrentFootnoteNumTemp is greater than \@maxWidthFootnoteNumTemp then \@maxWidthFootnoteNumTemp will take the value of \@widthCurrentFootnoteNumTemp.
% Thus, the width \@maxWidthFootnoteNumTemp corresponds to the width of the widest footnote number.
\renewcommand\@makefntext[1]{%
\settowidth{\@widthCurrentFootnoteNumTemp}{{\footnotesize\liningnums{\@thefnmark}}}%
\ifdim \@maxWidthFootnoteNumTemp < \@widthCurrentFootnoteNumTemp%
\global\setlength{\@maxWidthFootnoteNumTemp}{\@widthCurrentFootnoteNumTemp}%
\fi%
\makebox[\@widthFootnoteNum][r]{\liningnums{\@thefnmark}}.\enspace% right aligned footnote number using "\@widthFootnoteNum"
#1%
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Idem for minipage :
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newlength{\@mpwidthCurrentFootnoteNumTemp}
\newlength{\@mpmaxWidthFootnoteNumTemp}
\newlength{\@mpwidthFootnoteNum}
\def\thempfootnote{\@symbolesnum{\c@mpfootnote}}
\AtBeginEnvironment{minipage}{%
\setlength{\@mpmaxWidthFootnoteNumTemp}{0pt}%
%
\renewcommand\@makefntext[1]{%
\settowidth{\@mpwidthCurrentFootnoteNumTemp}{{\footnotesize\liningnums{\@thefnmark}}}%
\ifdim \@mpmaxWidthFootnoteNumTemp < \@mpwidthCurrentFootnoteNumTemp%
\global\setlength{\@mpmaxWidthFootnoteNumTemp}{\@mpwidthCurrentFootnoteNumTemp}%
\fi%
\makebox[\@mpwidthFootnoteNum][r]{\liningnums{\@thefnmark}}\enspace% right aligned footnote number using the value of "\@mpwidthFootnoteNum" for this particular minipage
#1%
}
}
\AtEndEnvironment{minipage}{% write the maximum width for the current mini-page
\immediate\write\auxFootnoteOutput{\the\@mpmaxWidthFootnoteNumTemp}
}
\makeatother
\begin{document}
Lorem ipsum dolor sit amet\footnote{A footnote.}, consectetur adipiscing elit. Sed ornare, risus sit amet lacinia lacinia, lacus erat tristique est, et consequat nunc dolor id lorem. Suspendisse lobortis, metus vitae semper volutpat, nulla metus mollis tortor, non finibus sem quam id mauris\footnote{A footnote.}. Fusce ut velit ac magna aliquet ullamcorper vitae nec massa. Nunc suscipit ipsum tortor, sed facilisis nisi ultrices finibus. Cras efficitur felis felis, sit amet aliquam dolor posuere et. Curabitur ut condimentum lorem. Etiam ac nisi augue. Nullam congue purus et metus fringilla malesuada. Praesent faucibus fermentum mi eget fringilla. Morbi velit ipsum, lacinia sed dolor id, fermentum auctor velit\footnote{A footnote.}. Donec quis ante eget enim tempor ultrices.
Pellentesque ultrices efficitur ipsum ut bibendum. Sed ut vestibulum mi. Sed neque neque, efficitur nec sem eget, pulvinar ultricies lectus. Nam ullamcorper dolor sed nulla ultricies varius. Donec mattis cursus dolor eu vehicula. Fusce molestie at ipsum vel commodo\footnote{A footnote.}. Vivamus eu malesuada metus. Praesent sed cursus ex. Fusce justo eros, elementum quis libero et, vestibulum pretium tortor. In rhoncus ex eu posuere placerat. Aenean fringilla sem a nisi aliquet egestas\footnote{A footnote.}. Fusce vestibulum leo nibh, vel sollicitudin mauris interdum sed.
Curabitur tincidunt augue et rutrum laoreet. Morbi pharetra lacus ac mi finibus condimentum. Nunc id venenatis neque. Fusce sed purus quis magna accumsan euismod a ac augue. Integer venenatis vulputate lacus, vel dapibus augue hendrerit sed\footnote{A footnote.}. Donec eget mattis arcu, nec hendrerit ante. Donec rutrum est ut massa blandit, id semper metus tincidunt. Suspendisse nec vulputate risus, nec efficitur ex. Donec condimentum risus ligula, at consectetur erat lacinia sed. Aenean vel euismod purus. Vestibulum interdum neque vitae erat rhoncus fermentum. Aenean convallis nisl velit, sit amet volutpat dui vulputate a.
Sed nec augue pellentesque, commodo diam quis, vehicula libero\footnote{A footnote.}. In hac habitasse platea dictumst. Phasellus tincidunt ligula vitae arcu tempor, eu facilisis augue fringilla. Curabitur id pulvinar ipsum, et gravida nisl. Aenean eget faucibus dolor, vel fermentum metus\footnote{A footnote.}. Quisque risus purus, porta vel eleifend nec, tempus sit amet diam. Sed sit amet commodo odio. Curabitur in tempor lorem. Sed venenatis malesuada odio, ac scelerisque nisi finibus ac. Aliquam cursus aliquet eleifend.
Duis in nisi vitae augue lacinia sodales sed vel libero. Duis vehicula, justo commodo ultrices blandit, purus sem ultrices velit, in imperdiet ligula sem vel sem\footnote{A footnote.}. Nam diam turpis, pulvinar ac lorem at, sagittis cursus nibh. Sed id gravida enim, id rutrum felis. Nam aliquet leo vel venenatis volutpat. Integer laoreet tincidunt mi, in faucibus nunc. Fusce porta et lorem id consectetur. Praesent ac vehicula metus, quis hendrerit tellus\footnote{A footnote.}. Maecenas consequat eleifend ante, non vehicula risus aliquet vitae. Duis et velit elit. Mauris nec lorem vel lorem rhoncus congue vitae in arcu.
Lorem ipsum dolor sit amet\footnote{A footnote.}, consectetur adipiscing elit. Sed ornare, risus sit amet lacinia lacinia, lacus erat tristique est, et consequat nunc dolor id lorem. Suspendisse lobortis, metus vitae semper volutpat, nulla metus mollis tortor, non finibus sem quam id mauris\footnote{A footnote.}. Fusce ut velit ac magna aliquet ullamcorper vitae nec massa. Nunc suscipit ipsum tortor, sed facilisis nisi ultrices finibus. Cras efficitur felis felis, sit amet aliquam dolor posuere et. Curabitur ut condimentum lorem. Etiam ac nisi augue. Nullam congue purus et metus fringilla malesuada. Praesent faucibus fermentum mi eget fringilla. Morbi velit ipsum, lacinia sed dolor id, fermentum auctor velit\footnote{A footnote.}. Donec quis ante eget enim tempor ultrices.
Pellentesque ultrices efficitur ipsum ut bibendum. Sed ut vestibulum mi. Sed neque neque, efficitur nec sem eget, pulvinar ultricies lectus. Nam ullamcorper dolor sed nulla ultricies varius. Donec mattis cursus dolor eu vehicula. Fusce molestie at ipsum vel commodo\footnote{A footnote.}. Vivamus eu malesuada metus. Praesent sed cursus ex. Fusce justo eros, elementum quis libero et, vestibulum pretium tortor. In rhoncus ex eu posuere placerat. Aenean fringilla sem a nisi aliquet egestas\footnote{A footnote.}. Fusce vestibulum leo nibh, vel sollicitudin mauris interdum sed.
Curabitur tincidunt augue et rutrum laoreet. Morbi pharetra lacus ac mi finibus condimentum. Nunc id venenatis neque. Fusce sed purus quis magna accumsan euismod a ac augue. Integer venenatis vulputate lacus, vel dapibus augue hendrerit sed\footnote{A footnote.}. Donec eget mattis arcu, nec hendrerit ante. Donec rutrum est ut massa blandit, id semper metus tincidunt. Suspendisse nec vulputate risus, nec efficitur ex. Donec condimentum risus ligula, at consectetur erat lacinia sed. Aenean vel euismod purus. Vestibulum interdum neque vitae erat rhoncus fermentum. Aenean convallis nisl velit, sit amet volutpat dui vulputate a.
Sed nec augue pellentesque, commodo diam quis, vehicula libero\footnote{A footnote.}. In hac habitasse platea dictumst. Phasellus tincidunt ligula vitae arcu tempor, eu facilisis augue fringilla. Curabitur id pulvinar ipsum, et gravida nisl. Aenean eget faucibus dolor, vel fermentum metus\footnote{A footnote.}. Quisque risus purus, porta vel eleifend nec, tempus sit amet diam. Sed sit amet commodo odio. Curabitur in tempor lorem. Sed venenatis malesuada odio, ac scelerisque nisi finibus ac. Aliquam cursus aliquet eleifend.
Duis in nisi vitae augue lacinia sodales sed vel libero. Duis vehicula, justo commodo ultrices blandit, purus sem ultrices velit, in imperdiet ligula sem vel sem\footnote{A footnote.}. Nam diam turpis, pulvinar ac lorem at, sagittis cursus nibh. Sed id gravida enim, id rutrum felis. Nam aliquet leo vel venenatis volutpat. Integer laoreet tincidunt mi, in faucibus nunc. Fusce porta et lorem id consectetur. Praesent ac vehicula metus, quis hendrerit tellus\footnote{A footnote.}. Maecenas consequat eleifend ante, non vehicula risus aliquet vitae. Duis et velit elit. Mauris nec lorem vel lorem rhoncus congue vitae in arcu.
\begin{minipage}{\textwidth}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed ornare, risus sit amet lacinia lacinia, lacus erat tristique est, et consequat nunc dolor id lorem. Suspendisse lobortis, metus vitae semper volutpat, nulla metus mollis tortor, non finibus sem quam id mauris. Fusce ut velit ac magna aliquet ullamcorper vitae nec massa. Nunc suscipit ipsum tortor, sed facilisis nisi ultrices finibus\footnote{A footnote.}. Cras efficitur felis felis, sit amet aliquam dolor posuere et. Curabitur ut condimentum lorem. Etiam ac nisi augue. Nullam congue purus et metus fringilla malesuada. Praesent faucibus fermentum mi eget fringilla. Morbi velit ipsum, lacinia sed dolor id, fermentum auctor velit. Donec quis ante eget enim tempor ultrices.
Pellentesque ultrices efficitur ipsum ut bibendum. Sed ut vestibulum mi. Sed neque neque, efficitur nec sem eget, pulvinar ultricies lectus. Nam ullamcorper dolor sed nulla ultricies varius. Donec mattis cursus dolor eu vehicula. Fusce molestie at ipsum vel commodo\footnote{A footnote.}. Vivamus eu malesuada metus. Praesent sed cursus ex. Fusce justo eros, elementum quis libero et, vestibulum pretium tortor. In rhoncus ex eu posuere placerat. Aenean fringilla sem a nisi aliquet egestas. Fusce vestibulum leo nibh, vel sollicitudin mauris interdum sed.
Curabitur tincidunt augue et rutrum laoreet. Morbi pharetra lacus ac mi finibus condimentum. Nunc id venenatis neque. Fusce sed purus quis magna accumsan euismod a ac augue. Integer venenatis vulputate lacus, vel dapibus augue hendrerit sed. Donec eget mattis arcu, nec hendrerit ante. Donec rutrum est ut massa blandit, id semper metus tincidunt. Suspendisse nec vulputate risus, nec efficitur ex. Donec condimentum risus ligula, at consectetur erat lacinia sed. Aenean vel euismod purus. Vestibulum interdum neque vitae erat rhoncus fermentum. Aenean convallis nisl velit, sit amet volutpat dui vulputate a.
\end{minipage}
\begin{minipage}{\textwidth}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed ornare, risus sit amet lacinia lacinia, lacus erat tristique est, et consequat nunc dolor id lorem. Suspendisse lobortis, metus vitae semper volutpat, nulla metus mollis tortor, non finibus sem quam id mauris. Fusce ut velit ac magna aliquet ullamcorper vitae nec massa\footnote{A footnote.}. Nunc suscipit ipsum tortor, sed facilisis nisi ultrices finibus\footnote{A footnote.}. Cras efficitur felis felis, sit amet aliquam dolor posuere et. Curabitur ut condimentum lorem. Etiam ac nisi augue. Nullam congue purus et metus fringilla malesuada. Praesent faucibus fermentum mi eget fringilla. Morbi velit ipsum, lacinia sed dolor id, fermentum auctor velit. Donec quis ante eget enim tempor ultrices.
Pellentesque ultrices efficitur ipsum ut bibendum. Sed ut vestibulum mi. Sed neque neque, efficitur nec sem eget, pulvinar ultricies lectus\footnote{A footnote.}. Nam ullamcorper dolor sed nulla ultricies varius. Donec mattis cursus dolor eu vehicula. Fusce molestie at ipsum vel commodo\footnote{A footnote.}. Vivamus eu malesuada metus. Praesent sed cursus ex. Fusce justo eros, elementum quis libero et, vestibulum pretium tortor. In rhoncus ex eu posuere placerat. Aenean fringilla sem a nisi aliquet egestas. Fusce vestibulum leo nibh, vel sollicitudin mauris interdum sed.
Curabitur tincidunt augue et rutrum laoreet\footnote{A footnote.}. Morbi pharetra lacus ac mi finibus condimentum. Nunc id venenatis neque. Fusce sed purus quis magna accumsan euismod a ac augue. Integer venenatis vulputate lacus, vel dapibus augue hendrerit sed. Donec eget mattis arcu, nec hendrerit ante. Donec rutrum est ut massa blandit, id semper metus tincidunt. Suspendisse nec vulputate risus, nec efficitur ex. Donec condimentum risus ligula, at consectetur erat lacinia sed\footnote{A footnote.}. Aenean vel euismod purus. Vestibulum interdum neque vitae erat rhoncus fermentum. Aenean convallis nisl velit, sit amet volutpat dui vulputate a\footnote{A footnote.}.
\end{minipage}
\end{document}
I get the following auxiliary file:
6.704pt
11.40799pt
7.752pt
The first value is the value of \@mpwidthFootnoteNum
for the first minipage environment.
The second value is the value of \@mpwidthFootnoteNum
for the second minipage environment.
The third value corresponds to the value of \@widthFootnoteNum
for the "normal" footnote.
So I manage to save all the information needed for the next compilation in an auxiliary file.
The issue
The problem is that I can't use these different values when compiling, because the auxiliary file is successively read and written during the same compilation. So the file is overwritten with each new write.
How can we get around this?
What I tried
I thought of storing all the values at the beginning of the compilation in a kind of numbered list from which one could take out the last value to assign it to \@widthFootnoteNum
and take out the other values to assign them to the different \@mpwidthFootnoteNum
of the different minpage. The goal is to have to read the auxiliary file only once. But I don't know how to do it.
I tried to use the arrayjob
package by putting the auxiliary file in an array, but without success.
I also tried to use two auxiliary files. A file A would be used to write the various @widthFootnoteNum
and @mpwidthFootnoteNum
during compilation. At the start of the next compilation, file A would be copied to a file B, which would be read in at the time of compilation and would give the values of the widthFootnoteNum
and mpwidthFootnoteNum
calculated at the time of the next compilation. Again, I haven't managed to do this, as I can't seem to copy file A into file B.
Finally, I tried to store the different values that @mpwidthFootnoteNum
should take in a syntax ifcase #1 ...
where #1
represents the number of the minipage
environment. For each minipage
environment, \@mpwidthFootnoteNum
thus takes a different value.
Here is the preamble:
\documentclass{article}
\usepackage{fontspec}
\setmainfont[Numbers={Proportional}]{LibertinusSerif}
\usepackage{etoolbox}
\makeatletter
\begingroup
\catcode`<=1 \catcode`>=2
\catcode`{=12 \catcode`}=12 \catcode`#=12
\gdef\curlyBracketL<{>
\gdef\curlyBracketR<}>
\gdef\hashtag<#>
\endgroup
\newcommand*\@symbolesnum[1]{% new numerotation for minipage footnote
\ifcase#1\unskip \or \unskip * \or \unskip † \or \unskip ‡ \or \unskip ** \or \unskip †† \or \unskip ‡‡ \or \unskip *** \or \unskip ††† \or \unskip ‡‡‡ \or \unskip **** \or \unskip †††† \or \unskip ‡‡‡‡ \or \unskip ***** \or \unskip ††††† \or \unskip ‡‡‡‡‡ \else\@ctrerr \fi%
}
\newlength{\@widthCurrentFootnoteNumTemp} % width of the current footer number
\newlength{\@maxWidthFootnoteNumTemp} % maximum footnote number width
\newlength{\@widthFootnoteNum} % width set after reading the auxiliary file
\AtBeginDocument{% Creating and opening the auxiliary file
\IfFileExists{\jobname.foot}{\input{\jobname.foot}}{}%
\newwrite\auxFootnoteOutput%
\immediate\openout\auxFootnoteOutput=\jobname.foot%
\immediate\write\auxFootnoteOutput{\unexpanded{\makeatletter}}%
\immediate\write\auxFootnoteOutput{%
\unexpanded{\newcommand*{\@mpwidthFootnoteNum}[1]} \curlyBracketL \unexpanded{\ifcase} \hashtag 1 \unexpanded{\unskip}%
}
\setlength{\@maxWidthFootnoteNumTemp}{0pt}%
}
\AtEndDocument{%
\immediate\write\auxFootnoteOutput{%
\unexpanded{\else 1em \fi} \curlyBracketR%
}%
\immediate\write\auxFootnoteOutput{\unexpanded{\setlength} { \unexpanded{\@widthFootnoteNum} }{\the\@maxWidthFootnoteNumTemp}}% Writing the value of \@widthFootnoteNum
\immediate\write\auxFootnoteOutput{\unexpanded{\makeatother}}
\immediate\closeout\auxFootnoteOutput% Closing the auxiliary file
}
% For each footnote, the width of the footnote number is measured by \@widthCurrentFootnoteNumTemp.
% This width is compared to \@maxWidthFootnoteNumTemp.
% If \@widthCurrentFootnoteNumTemp is greater than \@maxWidthFootnoteNumTemp then \@maxWidthFootnoteNumTemp will take the value of \@widthCurrentFootnoteNumTemp.
% Thus, the width \@maxWidthFootnoteNumTemp corresponds to the width of the widest footnote number.
\renewcommand\@makefntext[1]{%
\settowidth{\@widthCurrentFootnoteNumTemp}{{\footnotesize\liningnums{\@thefnmark}}}%
\ifdim \@maxWidthFootnoteNumTemp < \@widthCurrentFootnoteNumTemp%
\global\setlength{\@maxWidthFootnoteNumTemp}{\@widthCurrentFootnoteNumTemp}%
\fi%
\makebox[\@widthFootnoteNum][r]{\liningnums{\@thefnmark}}.\enspace% right aligned footnote number using "\@widthFootnoteNum"
#1%
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Idem for minipage :
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcounter{mpNum}
\setcounter{mpNum}{0}
\newlength{\@mpwidthCurrentFootnoteNumTemp}
\newlength{\@mpmaxWidthFootnoteNumTemp}
\def\thempfootnote{\@symbolesnum{\c@mpfootnote}}
\AtBeginEnvironment{minipage}{%
\stepcounter{mpNum}%
\setlength{\@mpmaxWidthFootnoteNumTemp}{0pt}%
%
\renewcommand\@makefntext[1]{%
\settowidth{\@mpwidthCurrentFootnoteNumTemp}{{\footnotesize\liningnums{\@thefnmark}}}%
\ifdim \@mpmaxWidthFootnoteNumTemp < \@mpwidthCurrentFootnoteNumTemp%
\global\setlength{\@mpmaxWidthFootnoteNumTemp}{\@mpwidthCurrentFootnoteNumTemp}%
\fi%
\makebox[\@mpwidthFootnoteNum{\thempNum}][r]{\liningnums{\@thefnmark}}\enspace% doesn't work. \@mpwidthFootnoteNum is defined in the auxiliary file
#1%
}
}
\AtEndEnvironment{minipage}{% write the maximum width for the current mini-page
\immediate\write\auxFootnoteOutput{%
\unexpanded{\or \unskip} \the\@mpmaxWidthFootnoteNumTemp%
}
}
\makeatother
This gives the following auxiliary file:
\makeatletter
\newcommand *{\@mpwidthFootnoteNum }[1] {\ifcase #1 \unskip
\or \unskip 6.704pt
\or \unskip 11.40799pt
\else 1em \fi }
\setlength { \@widthFootnoteNum }{7.752pt}
\makeatother
This seems correct, but when compiling, I have several errors.
Alternative
I tried using the eqparbox
package as advised by Werner and while it works fine for "normal" footnotes, the problem persists with footnotes in a minipage
environment, as you can see from the following images:
Here is the preamble:
\documentclass{article}
\usepackage{fontspec}
\setmainfont[Numbers={Proportional}]{LibertinusSerif}
\usepackage{etoolbox}
\usepackage[showframe]{geometry}
\usepackage{eqparbox}
\makeatletter
\newcommand*\@symbolesnum[1]{% new numerotation
\ifcase#1\unskip \or \unskip * \or \unskip † \or \unskip ‡ \or \unskip ** \or \unskip †† \or \unskip ‡‡ \or \unskip *** \or \unskip ††† \or \unskip ‡‡‡ \or \unskip **** \or \unskip †††† \or \unskip ‡‡‡‡ \or \unskip ***** \or \unskip ††††† \or \unskip ‡‡‡‡‡ \else\@ctrerr \fi%
}
\renewcommand\@makefntext[1]{%
\eqmakebox[footnote][r]{\liningnums{\@thefnmark}}.\enspace%
#1%
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% For minipage :
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\thempfootnote{\@symbolesnum{\c@mpfootnote}}
\newcounter{mpNum}
\setcounter{mpNum}{0}
\AtBeginEnvironment{minipage}{%
\stepcounter{mpNum}%
\renewcommand\@makefntext[1]{%
\eqmakebox[mpfootnote][r]{\liningnums{\@thefnmark}}\enspace% doesn't work
% \eqmakebox[mpfootnote\thempNum][r]{\liningnums{\@thefnmark}}\enspace% doesn't work
#1%
}%
}
\makeatother
eqparbox
to extract the maximum width for you, rather than reinventing the wheel.\maxFootnoteWidthIs{9.40799pt}
. Then you when the aux file is read in at the beginning/end of the document, you have defined that command. That automatically reads it in, and you just need to process it.