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):
Basically the need is:
- 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. - 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:
- Add a parameter to the
{{putFootnotes}}
macro (e.g.{{putFootnotes style="letter|number|..."/}}
) - 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