Internal footnotes (aka nested footnotes)

Hi devs,

I’ve been asked what design we could propose (and a cost estimation) for the ability to have footnotes for figure macro, that would generate something like the following visually when exported to PDF using the LaTeX exporter (this is basically what is expected to mimick):

footnote-inside-figure

Basically the need is:

  1. To be able to create footnote namespace or footnote groups, and so that when using the {{putFootnotes}} inside a given footnote group, it would display all the footnotes from that group. And the main document’s footnote area would not count/see footnotes from inside a nested group.
  2. The second need is to able to use letters instead of numbers for footnotes.

Option 1: {{footnoteGroup}} macro

For 1), my idea would be to introduce a {{footnoteGroup}} macro that is inline-editable and to be able to write something like the following:

As can be seen{{footnote}}if you look closely{{/footenote}} in the following table everything is alright.

{{footnoteGroup}} 
{{figure}}
{{figureCaption}}{{id name=”X”/}}Example of footnote{{footnote}}… in the caption as well!{{/footnote}} space{{/figureCaption}}
 
|Ovid: Metamorphoses{{footnote}}in nova fert animus mutates dicere formas copora{{/footnote}}|Cicero: De Re Publica
{{figure}}
{{/footnoteGroup}}

where the closing of the {{footnoteGroup}} macro would display foonotes (similar to explicity calling {{putFootnotes/}}) as in:

As can be seen{{footnote}}if you look closely{{/footenote}} in the following table everything is alright.

{{footnoteGroup}} 
{{figure}}
{{figureCaption}}{{id name=”X”/}}Example of footnote{{footnote}}… in the caption as well!{{/footnote}} space{{/figureCaption}}
 
|Ovid: Metamorphoses{{footnote}}in nova fert animus mutates dicere formas copora{{/footnote}}|Cicero: De Re Publica
{{figure}}

{{putFootnotes/}}
{{/footnoteGroup}}

The only potential problem I can imagine would be in the LaTeX exporter since there’s code there to have the figure macro display its content centered., and the {{footnoteGroup}} and/or {{putFootnotes}} LaTeX templates would need to do the same. I guess this could be solved by having {{footnoteGroup}} start a minipage environment. That would need to be tested but I think it’s a LaTeX extension issue and not a generic XWiki issue.

For 2), there are 2 ideas I can think of:

  1. Add a parameter to the {{putFootnotes}} macro (e.g. {{putFootnotes style="letter|number|..."/}})
  2. Add a parameter to the {{footnoteGroup}} macro (e.g. {{footnoteGroup style="letter|number|..."/}})

The problem with 1) is that it requires an explicit usage of the {{putFootnotes}} macro so 2) feels better. We would need an Admin UI section to configure the default footnote group style.

Option 2: {{part}} macro

This would be the same as option 1 but more generic, since we would introduce a {{part}} macro which would allow having a nested document inside a document. And upon {{/part}} we would display the footnotes as we do for the main document. Right now, it would be used only by the footnote macro, but maybe there are other use cases where it’s interesting to demarcate different parts of a document and reset all counters (e.g. I can think of the {{toc}} macro, or for the numbering feature if you don’t want to number a given part or reset the numbering, etc).

Option 3: Specific to the figure macro

An option would be to not make the feature generic and have it only specific to the figure macro. Something like:

{{figure footnotes="true" footnoteStyle="letter|number|..."}}
{{figureCaption}}{{id name=”X”/}}Example of footnote{{footnote}}… in the caption as well!{{/footnote}} space{{/figureCaption}}
 
|Ovid: Metamorphoses{{footnote}}in nova fert animus mutates dicere formas copora{{/footnote}}|Cicero: De Re Publica
{{figure}}

The limitation obviously is that this would work only for the figure macro and would create a dependency between the Figure macro extension and the Footnote macro. Now the footnote macro is currently in rendering so it would not cause a problem at least to have the figure macro depend on the footnote macro. It would not allow being able to have separate footnotes for other types of content though.

Conclusion

Personally I think option 2 is a bit too ambitious ATM and we would need at least syntax/2.2 for it, with the ability to have a markup for it in the syntax, as a lot of macros or features would need to recognize it and adapt accordingly.

So for me, option 1 seems the best. Option 3 is interesting too but I fear it’s too limited and I’d prefer that we don’t link the Footnote and the Figure macros.

WDYT? Do you see any other idea? Any problem you can foresee?

Thank you

It’s been a while but I remember marking and placing footnotes in latex was relatively easy; , I think option 1 comes closest to how latex functions.

For the footnotegroup macro you could considering configuring default layouts centrally.

Yes, AFAIK in LaTeX you use a minipage environment, as in:

\documentclass{article}
% Using the geometry package with a small
% page size to create the article graphic
\usepackage[paperheight=6in,
   paperwidth=5in,
   top=10mm,
   bottom=20mm,
   left=10mm,
   right=10mm]{geometry}
\begin{document}
This is the start of a paragraph of text just before we switch to a \texttt{minipage} environment. This is an in-page footnote\footnote{Footnote before a minipage}.

\vspace{10pt}
\begin{minipage}{0.7\textwidth}
This is text in a \texttt{minipage} environment. Here is the first \texttt{minipage} footnote\footnote{First minipage footnote.}. And another \texttt{minipage} footnote\footnote{Second minipage footnote.}.
\end{minipage}
\vspace{10pt}

This is the start of a standard paragraph of text just after we finished a \texttt{minipage} environment. This is an in-page footnote\footnote{Footnote after a minipage}.
\end{document}

which gives:

Screenshot 2023-10-19 at 10.24.45

This is why I proposed options 1 and 2. Option 2 is the closest to the minipage concept but I’m not sure of the consequences of implementing this xwiki. Option 1 is more restricted (it’s only for footnotes while minipage works for anything) but it feels safer for now and it would always be possible to deprecate the footnotegroup macro for a more generic way of specifying a sub-document/page in the future.

This is not easy I think as it depends on the context. In the LaTeX example above, it’s controlled by \vspace{10pt} and \begin{minipage}{0.7\textwidth} I think. In our case, it’s the renderer that decides how to render the figure macro (more precisely it’s the CSS for it), and it’s not controlled by the {{footnotegroup}} macro. I’m also not sure that the rendering of the {{footnotegroup}} macro should always indent its content. For me it should be neutral re layout, to work in all cases (similar to the {{putFootnotes}} macro which is neutral). If the user needs indentation for it, I guess it could be done using some SSX.

Ideas welcome!

Thanks @Wardenburg

1 Like

Agreed with the rendering being neutral re layout!

When mentioning footnote layout I was more thinking of options that would help with adressing need 2: how the footnote is numbered, basically what you did with Option 3 but use it with Option 1 for the footnotegroup macro I.E.

{{/footnoteGroup }}

would imply:
{{/footnoteGroup style="numbers"}}

With additional option for how the footnotes are shown:
{{/footnoteGroup Style="letters|numbers|..." width="30em"}}

After taking a peek at Help:Footnotes - Wikipedia some other things to consider could be:

  • Reusing the same footnotes
  • Overwriting the footnote description
    image

This is what I proposed in Option 1 above actually :slight_smile:

See the following under option 1 above:

Regarding:

Yes, it’s a good idea but it’s a bit out of scope for this proposal. Unless you think it impacts the choice of the option (1, 2, or 3).

Re the overwrite, we kind of support this already with the {{putFootnotes}} macro (but it doesn’t support customization except by creating a wiki macro of the same name and a higher priority). What we don’t support ATM is footnote references.

Thanks

1 Like

Pretty sure I should (re-)take a reading course at some point :sweat_smile:

I’d put my vote for Option 1 then (for whatever that’s worth)

As always; thanks for all your contribution and hard work @vmassol !

1 Like

See also Loading...

1 Like