2

Here is my code.

\documentclass{article}
\usepackage{fontspec}
\setmainfont[Fractions=On]{Linux Libertine O}
\begin{document}
% \addfontfeatures{RawFeature=+frac}

1/2 3/4 5/6 7/8 9/10 11/12 31415/27182 1000/1000000

\end{document}

Compiling with TeX Live LuaLaTeX on Lubuntu gives the following output:

enter image description here

According to this answer, it should be possible to achieve this effect with Libertine. The line I commented out in the code is another method I tried, which produced the same incorrect output as shown.

  • Might it be the case that thelibertineotf package provides additional code not found in the font itself? Note the difference between your code and the linked answer: You called the font directly, using fontspec, but the linked answer has \usepackage{libertineotf}. – user103221 Apr 4 '17 at 22:05
  • More: The libertineotf package is marked as obsolete, at CTAN. But it is still available. I looked at it, and it does indeed contain some code other than just the fonts. However, you can still get fractions the hard way (not very hard) by using features such as sups and subs (or sinf) for the separate numerators and denominators. So what you need can be done, but maybe in a way different than you expected. – user103221 Apr 4 '17 at 22:21
  • @RobtA Only because libertine.sty now handles the Unicode engines. And libertineotf.sty isn't only on CTAN. It is still part of the libertine package installed, for example, as part of TeX Live. Just it shouldn't be used for new documents. – cfr Apr 5 '17 at 0:18
  • @cfr Good clarification. I use only LuaLeTeX, and load fonts directly rather than via packages. No problem. Maybe this is the situation faced by the OP. – user103221 Apr 5 '17 at 0:57
2

Note that I used XeLaTeX for compilation. The code does not work with LuaLaTeX.

I get warnings, but the output looks as it looks in the linked answer.

Although libertineotf.sty is obsolete, this is only because libertine.sty now handles both the unicode engines and (to some limited extent) the traditional ones.

\documentclass{article}
\usepackage{libertine}
\begin{document}
\addfontfeatures{RawFeature=+frac}

1/2 3/4 5/6 7/8 9/10 11/12 31415/27182 1000/1000000

\end{document}

Libertine fractions

If you don't wish to use the libertine package for some reason, you can do exactly the same with fontspec. As a bonus, I don't get the warnings mentioned above in this case.

\documentclass{article}
\usepackage{fontspec}
\setmainfont[Fractions=On]{Linux Libertine O}
\begin{document}
\addfontfeatures{RawFeature=+frac}

1/2 3/4 5/6 7/8 9/10 11/12 31415/27182 1000/1000000

\end{document}

That is, simply uncommenting the line produces what I understand to be the desired output.

  • It is my understanding that the "RawFeature" is encoded in the accompanying *.sty file, rather than in the *.otf fonts. Perhaps this is confusing to those of us who approach fontspec from the direction of understanding fonts, rather than understanding TeX packages. – user103221 Apr 5 '17 at 0:59
  • @RobtA Why do you think that? – cfr Apr 5 '17 at 1:17
  • 1
    @RobtA There is no mention of frac in libertine.sty. RawFeature allows the use of features supported by the font, but with no fontspec interface. – cfr Apr 5 '17 at 1:18
  • 1
    @RobtA Please see edited answer above. – cfr Apr 5 '17 at 1:25
  • 1
    @KevinKeith I asked on the context list. The feature isn't currently supported in the fontloader code of context (and so it doesn't work with lualatex either). – Ulrike Fischer Apr 5 '17 at 22:41

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.