2

Referring to this thread: OldStyle Numbers in Body Text Only—Lining Numbers Otherwisem how can I instruct LuaLatex to use lining numbers for \textsuperscript and footnote markers if my font use by default old style numbers and hasn't super- sub-script figures built-in? Thank you

Addendum

This is a very basic MWE

\documentclass[a4paper,12pt]{book}
\usepackage{fontspec}
\usepackage[english]{babel}
\babelfont[english]{rm}[Ligatures=TeX,Numbers={Proportional,OldStyle}]{EBGaramond}

\usepackage[perpage,bottom,hang,stable,norule]{footmisc}
\renewcommand{\footnotemargin}{0.01em}
\renewcommand{\hangfootparskip}{0pt}
\renewcommand{\footnotelayout}{\hspace{1em}}

\begin{document}

text\textsuperscript{abdx 136}

text\footnote{footnote text}

\end{document}

The fact is that my font (which is a test version, not EBGaramond used for my MWE) has not superior and inferior numbers, so I can't use realscript package

  • Please tell us which document class you employ, whether or not you load the fontspec package, and with which options and arguments you execute \setmainfont. – Mico May 27 at 14:56
  • 1
    Added a MWΕ See above – user41063 May 27 at 18:59
  • I vaguely remember that at least garamondx had an option for real superiors and inferiors. They might work also with your font and with EB Garamond. – Oleg Lobachev May 27 at 19:14
  • but my problem is if and only if I use a font [em]without[/em] real superiors and inferiors... If 've them, there is no problem in choosing if I want to adopt the one or the other form. Moreover, for I'm using Lualatex, I think the way to set alternative forms for glyphs is very different – user41063 May 27 at 19:33
2

You can just manually change the relevant LaTeX macros:

There are two parts: We begin with \textsuperscript. It is defined by default as

\DeclareRobustCommand*\textsuperscript[1]{%
  \@textsuperscript{\selectfont#1}}

We want to use lining numbers, so we have to add \liningnums{...}. We can omit \selectfont because \liningnums will set the font anyway:

\DeclareRobustCommand*\textsuperscript[1]{%
  \@textsuperscript{\liningnums{#1}}%
}

This changes \textsuperscript, but footnotes are not affected yet. The footnote marks are generated by \@makefnmark, which by default is defined as

\def\@makefnmark{\hbox{\@textsuperscript{\normalfont\@thefnmark}}}

On a first glance you might assume that we could have changed \@textsuperscript instead of \textsuperscript to affect this one too, but that is not the case: The \normalfont would have reverted the number style to old-style numbers. So we have to add \liningnums after \normalfont:

\renewcommand\@makefnmark{%
  \hbox{\@textsuperscript{\normalfont\liningnums{\@thefnmark}}}%
}

Put it all together, add some \makeatletter...\makeatother because we used macro names with @, and we get

\documentclass[a4paper,12pt]{book}
\usepackage{fontspec}
\usepackage[english]{babel}
\babelfont[english]{rm}[Ligatures=TeX,Numbers={Proportional,OldStyle}]{EBGaramond}

\usepackage[perpage,bottom,hang,stable,norule]{footmisc}
\renewcommand{\footnotemargin}{0.01em}
\renewcommand{\hangfootparskip}{0pt}
\renewcommand{\footnotelayout}{\hspace{1em}}
\makeatletter
\renewcommand\@makefnmark{%
  \hbox{\@textsuperscript{\normalfont\liningnums{\@thefnmark}}}%
}
\DeclareRobustCommand*\textsuperscript[1]{%
  \@textsuperscript{\liningnums{#1}}%
}
\makeatother

\begin{document}

text\textsuperscript{abdx 136}

abdx 136

text\footnote{footnote text}

\end{document}

enter image description here

  • Perfectly working. Thank you! – user41063 May 27 at 22:43

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.