5

I would like that the numbers "2, 3, 4, 5, 6" start from the same position as the number "1" in the previous footnote.

\documentclass{article}

\usepackage{hyperref}
\usepackage{xparse}

\ExplSyntaxOn

\NewDocumentCommand \footnotenumber { O{} }
  {
    \footnotemark
      {
        \tl_if_blank:nF { #1 }
          {
            \addtocounter { footnote } { -1 }
            \refstepcounter { footnote }
            \label { #1 }
          }
      }
  }

\NewDocumentCommand \footnotemultiple { O{} m }
  {
    \group_begin:
    \tl_if_blank:nF { #1 }
      {
        \clist_clear:N \l_tmpa_clist
        \clist_map_inline:nn { #1 }
          {
            \clist_put_right:Nn \l_tmpa_clist { \ref{ ##1 } }
          }
        \def \thefootnote { \clist_use:Nn \l_tmpa_clist { , } }
      }
    \footnotetext { #2 }
    \group_end:
  }

\ExplSyntaxOff


\begin{document}

Lorem ipsum dolor sit amet, consectetur\footnote{Morbi ac rhoncus mi, at porttitor erat. Aliquam fringilla erat nec tortor placerat ullamcorper.} adipiscing\footnotenumber[fn1] elit. Nunc non nisl\footnotenumber[fn2] sed orci suscipit porta\footnotenumber[fn3]. Nulla et arcu placerat\footnotenumber[fn4], vehicula lorem id, imperdiet ante. Aenean\footnotenumber[fn5] et tortor purus.

\footnotemultiple[fn1,fn2,fn3,fn4,fn5]{Etiam porttitor bibendum neque et luctus. Ut volutpat, erat vitae dapibus condimentum, eros nunc suscipit eros, id imperdiet lectus massa eget metus.}

\end{document}

enter image description here

P. S. This way of numbering footnotes is shown here.

1 Answer 1

6

Update 2022/05/28

There shall soon be a new package multifootnote on CTAN. The answer of this question corresponds to the two package options:

enter image description here


Normally the footnote is typeset with list, where the label width is fixed. However, you can completely redefine this behavior by modifying \@makefntext. Notice that the @ here means that you need \makeatletter.

enter image description here

\documentclass{article}

\usepackage{hyperref}
\usepackage{xparse}

\makeatletter
\ExplSyntaxOn

\renewcommand{\@makefntext}[1]{
    \parbox{0pt}{\@makefnmark} \nobreakspace #1
}

\NewDocumentCommand \footnotenumber { O{} }
  {
    \footnotemark
      {
        \tl_if_blank:nF { #1 }
          {
            \addtocounter { footnote } { -1 }
            \refstepcounter { footnote }
            \label { #1 }
          }
      }
  }

\NewDocumentCommand \footnotemultiple { O{} m }
  {
    \group_begin:
    \tl_if_blank:nF { #1 }
      {
        \clist_clear:N \l_tmpa_clist
        \clist_map_inline:nn { #1 }
          {
            \clist_put_right:Nn \l_tmpa_clist { \ref*{ ##1 } }
          }
        \def \thefootnote { \clist_use:Nn \l_tmpa_clist { , } }
      }
    \footnotetext { #2 }
    \group_end:
  }

\ExplSyntaxOff
\makeatother

\begin{document}

Lorem ipsum dolor sit amet, consectetur\footnote{Morbi ac rhoncus mi, at porttitor erat. Aliquam fringilla erat nec tortor placerat ullamcorper.} adipiscing\footnotenumber[fn1] elit. Nunc non nisl\footnotenumber[fn2] sed orci suscipit porta\footnotenumber[fn3]. Nulla et arcu placerat\footnotenumber[fn4], vehicula lorem id, imperdiet ante. Aenean\footnotenumber[fn5] et tortor purus.

\footnotemultiple[fn1,fn2,fn3,fn4,fn5]{Etiam porttitor bibendum neque et luctus. Ut volutpat, erat vitae dapibus condimentum, eros nunc suscipit eros, id imperdiet lectus massa eget metus.}

\end{document}

If you wish to indent the first line of each footnote, simply add a \hspace* in the command.

\renewcommand{\@makefntext}[1]{
    \hspace*{1.5em}
    \parbox{0pt}{\@makefnmark} \nobreakspace #1
}

enter image description here

4
  • Is there a way I can keep the indent? So, just to move the first line of the footnote to the right.
    – Bolzano
    May 26 at 16:47
  • 2
    @Bolzano You mean indenting those lines containing footnote mark (in other words, the first line of each footnote entry)?
    – Jinwen
    May 26 at 16:49
  • 1
    @Bolzano I've edited my answer, let's see if this is want you want.
    – Jinwen
    May 26 at 16:52
  • Yes, thank you!
    – Bolzano
    May 26 at 16:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.