mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 10:58:52 +00:00
Display footnote labels as superscripts
A new counter type \superarabic is introduced, that transforms the counter into superscript Unicode numbers. This is used for the footnote counter. The Foot inset layout is modified to use an empty LabelString (in size Normal, since the numbers could be too small). We use this occasion to set footnote text in footnotesize, as it should. A couple of changes are done to the code to make the button label and tooltip look better. Fixes bug #12238.
This commit is contained in:
parent
6d167e94f4
commit
6a8c10f0d6
@ -41,5 +41,4 @@ End
|
||||
Counter footnote
|
||||
GuiName Footnote
|
||||
Within chapter
|
||||
LabelString "\arabic{footnote}"
|
||||
End
|
||||
|
@ -84,6 +84,7 @@ End
|
||||
|
||||
Counter footnote
|
||||
GuiName Footnote
|
||||
LabelString "\superarabic{footnote}"
|
||||
PrettyFormat "Footnote ##"
|
||||
End
|
||||
|
||||
|
@ -49,17 +49,17 @@ InsetLayout Marginal
|
||||
End
|
||||
|
||||
InsetLayout Foot
|
||||
LabelString Foot
|
||||
LabelString ""
|
||||
LatexType Command
|
||||
LatexName footnote
|
||||
Counter footnote
|
||||
InheritFont false
|
||||
Font
|
||||
Size Small
|
||||
Size FootnoteSize
|
||||
EndFont
|
||||
LabelFont
|
||||
Color footlabel
|
||||
Size Small
|
||||
Size Normal
|
||||
EndFont
|
||||
MultiPar true
|
||||
RefPrefix fn
|
||||
|
@ -476,6 +476,9 @@ docstring Counters::labelItem(docstring const & ctr,
|
||||
if (numbertype == "fnsymbol")
|
||||
return fnsymbolCounter(val);
|
||||
|
||||
if (numbertype == "superarabic")
|
||||
return superarabicCounter(val);
|
||||
|
||||
return convert<docstring>(val);
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,9 @@ void InsetFoot::updateBuffer(ParIterator const & it, UpdateType utype, bool cons
|
||||
int val = cnts.value(count);
|
||||
if (cnts.hasCounter(count)) {
|
||||
cnts.step(count, utype);
|
||||
custom_label_ += ' ' + cnts.theCounter(count, lang->code());
|
||||
if (!custom_label_.empty())
|
||||
custom_label_ += ' ';
|
||||
custom_label_ += cnts.theCounter(count, lang->code());
|
||||
if (deleted)
|
||||
// un-step after deleted counter
|
||||
cnts.set(count, val);
|
||||
@ -107,7 +109,7 @@ docstring InsetFoot::toolTip(BufferView const & bv, int x, int y) const
|
||||
if (isOpen(bv))
|
||||
// this will give us something useful if there is no button
|
||||
return InsetCollapsible::toolTip(bv, x, y);
|
||||
return toolTipText(custom_label_+ ": ");
|
||||
return toolTipText(custom_label_+ " ");
|
||||
}
|
||||
|
||||
|
||||
|
@ -12,6 +12,8 @@
|
||||
#include <config.h>
|
||||
|
||||
#include "support/counter_reps.h"
|
||||
|
||||
#include "support/convert.h"
|
||||
#include "support/docstring.h"
|
||||
#include "support/lstrings.h"
|
||||
|
||||
@ -132,4 +134,15 @@ docstring const fnsymbolCounter(int const n)
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
docstring const superarabicCounter(int const n)
|
||||
{
|
||||
docstring superarabic = convert<docstring>(n);
|
||||
static char_type map[] = {0x2070, 0x00b9, 0x00b2, 0x00b3, 0x2074,
|
||||
0x2075, 0x2076, 0x2077, 0x2078, 0x2079 };
|
||||
for (char_type & c : superarabic)
|
||||
c = map[c - char_type('0')];
|
||||
return superarabic;
|
||||
}
|
||||
|
||||
} // namespace lyx
|
||||
|
@ -27,6 +27,7 @@ char hebrewCounter(int const n);
|
||||
docstring const romanCounter(int const n);
|
||||
docstring const lowerromanCounter(int const n);
|
||||
docstring const fnsymbolCounter(int const n);
|
||||
docstring const superarabicCounter(int const n);
|
||||
|
||||
} // namespace lyx
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user