4

By selecting the feature VerticalPosition = Numerator/Superior/Inferior etc... one may vary the relative position of numbers and other character with respect to the baseline.

For example, this code

\documentclass[12pt, a5paper]{memoir}

\usepackage[italian]{babel}
\usepackage{fontspec}

\setmainfont{Linux Biolinum}

\def\Text{1Inizio del Vangelo secondo me, che sono io. 2Come è scritto nel rotolo del professor Richard: Voce di uno che grida: 3Delle onde fate la trasformata!}

\begin{document}

\Text

\addfontfeature{VerticalPosition = Superior}
\Text

\end{document}

gives as a result this:

enter image description here

The problem holds also if you select other options, like Numerator. Is there any way to limit the vertical position to the only numbers?

1
  • I think you should use the superscript digits.
    – egreg
    Commented Nov 5, 2016 at 18:26

2 Answers 2

5

In TeX Live 2016, you can use fonts.handlers to adjust font features. Here, I make a new feature, which I’ve called nsup (for “numerical superiors”), defining superiors for numbers only:

\documentclass[12pt,a5paper]{memoir}
\usepackage[italian]{babel}
\usepackage{fontspec}
\directlua{
fonts.handlers.otf.addfeature {
    name = "nsup",
    {
        type = "substitution",
        data = {
            one = "¹",
            two = "²",
            three = "³",
            four = "⁴",
            five = "⁵",
            six = "⁶",
            seven = "⁷",
            eight = "⁸",
            nine = "⁹",
            zero = "⁰",
        }
    },
    "superior numerals only"
  }
}
\setmainfont{linuxbiolinumo}% my system doesn’t recognize the name you used
\def\Text{1Inizio del Vangelo secondo me, che sono io. 2Come è scritto
  nel rotolo del professor Richard: Voce di uno che grida: 3Delle onde
  fate la trasformata!}
\begin{document}
\addfontfeature{RawFeature=+nsup}
\Text
\end{document}

output

Before 2016, you could write your own feature file, but I no longer have an older system to play with, so I won’t provide an example of that approach (there are questions about it elsewhere on this site). Best to learn the new one, anyway.

This approach is for luatex only, not xetex.

3

You should use the superscript digits, in my opinion.

Anyway, with XeLaTeX you can use the interchar tokens feature.

\documentclass[12pt, a5paper]{memoir}

\usepackage[italian]{babel}
\usepackage{fontspec}

\setmainfont{Linux Biolinum O}
\newfontfamily{\super}{Linux Biolinum O}[VerticalPosition = Superior]

\newXeTeXintercharclass\superior
\XeTeXcharclass`0=\superior
\XeTeXcharclass`1=\superior
\XeTeXcharclass`2=\superior
\XeTeXcharclass`3=\superior
\XeTeXcharclass`4=\superior
\XeTeXcharclass`5=\superior
\XeTeXcharclass`6=\superior
\XeTeXcharclass`7=\superior
\XeTeXcharclass`8=\superior
\XeTeXcharclass`9=\superior
\XeTeXinterchartoks 0 \superior = {\begingroup\super}
\XeTeXinterchartoks 4095 \superior = {\begingroup\super}
\XeTeXinterchartoks \superior 0 = {\endgroup}
\XeTeXinterchartoks \superior 4095 = {\endgroup}


\def\Text{%
  1Inizio del Vangelo secondo me, che sono io. 
  2Come è scritto nel rotolo del professor Richard: Voce di uno che grida: 
  3Delle onde fate la trasformata!%
}

\begin{document}

\Text

\XeTeXinterchartokenstate=1
\Text

\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .