# Lining numbers for footnote

Referring to this old thread: OldStyle Numbers in Body Text Only—Lining Numbers Otherwise, I'd like to know how can I set the superscript lining numbers only for footnotes (in both footnote numbers inside text body and in the foot of the page). Note that my font has real .superior glyphs which are not used even i set

\textsuperscript


but only of I write

{\addfontfeatures{VerticalPosition=Superior}<number>}


This one is a MWE:

\documentclass[a4paper,12pt]{article}
\usepackage{fontspec}
\usepackage[english]{babel}
\babelfont[english]{rm}[Ligatures=TeX,Numbers={Proportional,OldStyle}]{Garamond Premier Pro}
\frenchspacing
\begin{document}
To be\footnote{xxx}, or not to be\footnote{xxx}: that is the question\footnote{xxx}:
Whether ‘tis nobler in the mind to suffer\footnote{xxx}
The slings and arrows of outrageous fortune\footnote{xxx},
Or to take arms against a sea of troubles\footnote{xxx},
And by opposing end them\footnote{xxx}? To die: to sleep\footnote{xxx};
No more\footnote{xxx}; and by a sleep\footnote{xxx} to say we end\footnote{xxx}
The heart-ache\footnote{xxx} and the thousand natural shocks\footnote{xxx}
That flesh is heir to, ‘tis a consummation\footnote{xxx}
Devoutly to be wish’d\footnote{xxx}. To die, to sleep\footnote{xxx};

A{\textsuperscript{163}}.
\end{document}


You'll note that only if I add

{\addfontfeatures{VerticalPosition=Superior}{<number>}


superior numbers are lining and really the .superior glyphs of the font.

I'm interested in setting them as all superior lining in all notes numbers, "in accordance to the tradition of professional typography – for reasons of legibility.

Thank you

Referring to my problem with not working kerning, I found this thread: Adjusting kerning with LuaTeX and realscripts. So I ask you if this is the only solution, even if it's very inconvenient because it makes it necessary to add all the kerning pairs in the .tex file after they have been created even inside the font, or if there is another strategy to solve both problems: get access to the real superscript glyphs, but also take advantage of the kerning natively present in the font.

In any case, I don't understand how it would be possible use the solution indicated in the thread above in the case of automatic numbering of footnotes.

From some tests, I realized that some problems derive from the internal structure of the font I'm working on. I changed something within the font itself and now the footnotes are indicated correctly following you code. Unfortunately, for some reason that I can not understand, the kerning with the superscript numbers does not work for the number of footnotes inside the text.

Consider this pic:

I set a paroxysmal kerning between number 1 and period. It works only in a case (see last line), but not for footnote mark inside the text. The code is the following one:

A{\addfontfeatures{VerticalPosition=Superior}321}.

A{\textsuperscript{321}}.


In case, I can attach the font. >If I'm not the wrong guy...

• Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – DG' Feb 8 at 21:37
• What about using the realscripts package? This will adjust \textsuperscript so that it does use the .superior glyphs of the font. – David Purton Feb 8 at 22:15
• Only a further question: realscriptsreally uses .superior glyphs, if present in the font? For I adjusted some kerning for .superior numbers and period, but I don't see any effect... – user41063 Feb 8 at 23:01
• @user41063, I made an attempt on your kerning issue. But if it proves to have side effects you might be better off asking a new question and referencing this one and the other one you note to see if others have better ideas. – David Purton Feb 9 at 13:58
• @user41063, this site works best with one question per question. Please ask a new question asking why your kerning works with \texsuperscript but not with the footnote marks in the text. – David Purton Feb 9 at 21:51

# Yet another update

Your kerning problem is caused by the fact that the footnote mark is set inside an \hbox. This destroys the kerning between 'A' and '¹'. Consider this code using my patched \realsuperscript macro from below:

A{\addfontfeatures{VerticalPosition=Superior}1}.
A{\textsuperscript{1}}.
A\footnote{1}.}


When we show this we get:

.\TU/SourceSerifPro(0)/m/n/12 A
.\TU/SourceSerifPro(1)/m/n/12 ¹
.\TU/SourceSerifPro(0)/m/n/12 .
.\glue(\spaceskip) 3.72801 plus 4.19398 minus 0.31067
.\TU/SourceSerifPro(0)/m/n/12 A
.\kern-1.68 (font)
.\TU/SourceSerifPro(0)/m/n/12 ¹
.\TU/SourceSerifPro(0)/m/n/12 .
.\glue(\spaceskip) 3.72801 plus 4.19398 minus 0.31067
.\TU/SourceSerifPro(0)/m/n/12 A
.\penalty 10000
.\hbox(9.936+0.0)x4.44, direction TLT
..\TU/SourceSerifPro(0)/m/n/12 ¹
.\insert253, natural size 12.00003; split(8.4,3.60004); float cost 20000
..\hbox(8.4+3.60004)x390.0, glue set 367.63995fil, direction TLT
...\localpar
....\localinterlinepenalty=0
....\localbrokenpenalty=0
....\localleftbox=null
....\localrightbox=null
...\hbox(8.28+0.0)x18.00003, glue set 14.30003fil, direction TLT
....\glue 0.0 plus 1.0fil minus 1.0fil
....\hbox(8.28+0.0)x3.7, direction TLT
.....\TU/SourceSerifPro(0)/m/n/10 ¹
...\hbox(8.4+0.0)x0.0, direction TLT
....\rule(8.4+0.0)x0.0
...\TU/SourceSerifPro(0)/m/n/10 󰀜
...\penalty 10000
...\rule(0.0+3.60004)x0.0
...\penalty 10000
...\glue(\parfillskip) 0.0 plus 1.0fil
...\glue(\rightskip) 0.0
.\TU/SourceSerifPro(0)/m/n/12 .


We can see that

1. In the first case there is a font change and no kerning is inserted.
2. In the second case there is no font change and kerning is inserted.
3. In the third case there is a \penalty and and then '¹' is placed inside an \hbox and therefore no kerning is inserted even though there is no font change.
4. I the third case the \hbox with the footnote mark and the final period is separated by the float material for the footnote text. Therefore any kerning between '¹' and '.' is lost.

So to work around this two things are needed:

1. Adjust the \@makefnmark macro (previously adjusted from the default by the realscripts package) to remove the penalty and not to use the \hbox. This could have unwanted side effects, of course :).
2. Use A\footnotemark.\footnotetext{…} instead of A\footnote{…}.

The first could be achieved by using something like:

\makeatletter
\def\@makefnmark{\unpenalty{\footnotemarkfont\textsuperscript{\@thefnmark}}}
\makeatother


## MWE

Here's a full MWE (I added some directlua to add kerning between '1' and '.'):

\documentclass[a4paper,12pt]{article}
\usepackage{fontspec}
\directlua {
name = "supkern",
type = "kern",
data = {
["¹"] = { ["."] =  -180 },
},
}
}
\usepackage{realscripts}
\usepackage[english]{babel}
\babelfont[english]{rm}[Ligatures=TeX,Numbers={Proportional,OldStyle},RawFeature=+supkern]{Source
Serif Pro}
\makeatletter
\def\@makefnmark{\unpenalty{\footnotemarkfont\textsuperscript{\@thefnmark}}}
\makeatother
\ExplSyntaxOn
\cs_new:Nn \__realscripts_numtosup:n
{
\str_set:Nn \l_tmpa_str {#1}
\str_map_inline:Nn \l_tmpa_str
{
\str_if_in:nnTF {0123456789} {##1}
{
\int_set:Nn \l_tmpa_int {##1}
\if_case:w \l_tmpa_int ⁰
\or: ¹
\or: ²
\or: ³
\or: ⁴
\or: ⁵
\or: ⁶
\or: ⁷
\or: ⁸
\or: ⁹
\fi:
}
}
}
\cs_generate_variant:Nn \__realscripts_numtosup:n { x }
\DeclareDocumentCommand \realsuperscript {m} {
\fontspec_if_fontspec_font:TF
{
\fontspec_if_opentype:TF
{ \fontspec_if_feature:nTF {+sups}
{ \__realscripts_numtosup:x{#1} }
{ \fakesuperscript{#1} }
}
{ \fontspec_if_aat_feature:nnTF {10} {1}
{ \__realscripts_numtosup:x{#1} }
{ \fakesuperscript{#1} }
}
}
{ \fakesuperscript{#1} }
}
\ExplSyntaxOff
\begin{document}
\null\vfill

A¹.

A{\textsuperscript{1}}.

A\footnote{1}.

\setcounter{footnote}{0}
A\footnotemark.\footnotetext{1}
\end{document}


# Update

Here's a nasty hack that tries to deal with the kerning update to your question.

I still use realscripts, but have redefined the \realsuperscript macro to substitute numbers with hard coded superscripts, i.e., 0→⁰, 1→¹, etc. Other characters still use the font sups feature, but on a character by character basis.

You could do something similar for the \realsubscript macro if you needed it.

It does seem to give better kerning. See the two A¹⁶³ lines.

Note that this works out of the box with Source Serif Pro, but other fonts may not have appropriate kerning pairs built into the font. You could define them though and they should work.

## MWE

\documentclass[a4paper,12pt]{article}
\usepackage{fontspec}
\usepackage{realscripts}
\usepackage[english]{babel}
\babelfont[english]{rm}[Ligatures=TeX,Numbers={Proportional,OldStyle}]{Source
Serif Pro}
\frenchspacing

\ExplSyntaxOn
\cs_new:Nn \__realscripts_numtosup:n
{
\str_set:Nn \l_tmpa_str {#1}
\str_map_inline:Nn \l_tmpa_str
{
\str_if_in:nnTF {0123456789} {##1}
{
\int_set:Nn \l_tmpa_int {##1}
\if_case:w \l_tmpa_int ⁰
\or: ¹
\or: ²
\or: ³
\or: ⁴
\or: ⁵
\or: ⁶
\or: ⁷
\or: ⁸
\or: ⁹
\fi:
}
}
}

\cs_generate_variant:Nn \__realscripts_numtosup:n { x }

\DeclareDocumentCommand \realsuperscript {m} {
\fontspec_if_fontspec_font:TF
{
\fontspec_if_opentype:TF
{ \fontspec_if_feature:nTF {+sups}
{ \__realscripts_numtosup:x{#1} }
{ \fakesuperscript{#1} }
}
{ \fontspec_if_aat_feature:nnTF {10} {1}
{ \__realscripts_numtosup:x{#1} }
{ \fakesuperscript{#1} }
}
}
{ \fakesuperscript{#1} }
}
\ExplSyntaxOff

\begin{document}
\null\vfill
In text numbers: 0123456789

To be\footnote{xxx}, or not to be\footnote{xxx}: that is the question\footnote{xxx}:
Whether ‘tis nobler in the mind to suffer\footnote{xxx}
The slings and arrows of outrageous fortune\footnote{xxx},
Or to take arms against a sea of troubles\footnote{xxx},
And by opposing end them\footnote{xxx}? To die: to sleep\footnote{xxx};
No more\footnote{xxx}; and by a sleep\footnote{xxx} to say we end\footnote{xxx}
The heart-ache\footnote{xxx} and the thousand natural shocks\footnote{xxx}
That flesh is heir to, ‘tis a consummation\footnote{xxx}
Devoutly to be wish’d\footnote{xxx}. To die, to sleep\footnote{xxx};

A{\textsuperscript{163}}.

\end{document}


I suggest you use the realscripts package which will make use of the OpenType superior features of your font.

## MWE

I've substituted with Source Serif Pro because I don't own your font.

\documentclass[a4paper,12pt]{article}
\usepackage{fontspec}
\usepackage{realscripts}
\usepackage[english]{babel}
\babelfont[english]{rm}[Ligatures=TeX,Numbers={Proportional,OldStyle}]{Source
Serif Pro}
\frenchspacing
\begin{document}
\null\vfill
In text numbers: 0123456789

To be\footnote{xxx}, or not to be\footnote{xxx}: that is the question\footnote{xxx}:
Whether ‘tis nobler in the mind to suffer\footnote{xxx}
The slings and arrows of outrageous fortune\footnote{xxx},
Or to take arms against a sea of troubles\footnote{xxx},
And by opposing end them\footnote{xxx}? To die: to sleep\footnote{xxx};
No more\footnote{xxx}; and by a sleep\footnote{xxx} to say we end\footnote{xxx}
The heart-ache\footnote{xxx} and the thousand natural shocks\footnote{xxx}
That flesh is heir to, ‘tis a consummation\footnote{xxx}
Devoutly to be wish’d\footnote{xxx}. To die, to sleep\footnote{xxx};


• Now it seems to work with kerning correctly. Only: is there no way to avoid \footnotemark.\footnotetext{…} instead of \footnote{…} with a redefinition of the last command? – user41063 Feb 10 at 14:55