1

I'm trying to create a template in pdfLaTeX using the excellent XCharter package. According to the documentation, the osf package option should load old-style figures, and the numeral 1 should be displayed like a shortened 1, while the osfI option should load old-style figures with the numeral 1 like a shortened I.

However, I am getting the shortened I version even with the osf option. Here is a MWE:

\documentclass[11pt]{article}
\usepackage[osf]{XCharter}
\begin{document}

This is the numeral 1.

\end{document}

I've also made the MWE on Overleaf. As you can clearly see, what is displayed is the shortened I numeral 1. What's going on?

I thought perhaps this might have to do with the Overleaf version of packages, but the logs clearly show that the latest version of XCharter is being used. Compiling locally on my machine shows the same.

enter image description here

Venkat
  • 179

2 Answers2

3

Well, it's weird indeed. When I compile your MWE using LuaLatex I get the desired output without a hitch, but using PDFLatex gives the same output as you provided, no matter how I use the oldstyle option.

Putting \osfstyle in front of the 1 however gives the correct output even in PDFLatex.

\documentclass[11pt]{article}

\usepackage[osf]{XCharter}

\begin{document}

This is the numeral 1.

This is the numeral \osfstyle 1.

\end{document}

alchemist
  • 1,761
  • 2
    The traditional form of the lowercase 1, the one that resembles a small cap i, is the default lowercase 1 in the .otf file; the other lowercase 1, which the O.P. prefers, is in the cv01 feature. There’s probably a way to make pdflatex use it by redefining something in XCharter.sty. – Thérèse Feb 07 '23 at 19:25
  • Ah of course, its pdflatex's fault! Yeah this seems to be a bug when using pdflatex. @Thérèse do you think there's a way to redefine this only for my document? Like assigning old style 1 to be the one I want while using pdflatex. I've already convinced myself that the right answer is to always use xelatex – Venkat Feb 07 '23 at 19:50
  • As I started to migrate from PDFLatex to LuaLatex I came across some issues with ‘older’ fonts. I used the Charter set of mathdesign to denote the Greek upright symbols in my chemistry entries. That option is based on Charter BT. I tried XCharter as an alternative. Works fine under LuaLatex, but under PDFLatex I had the feeling it was off a bit. – alchemist Feb 07 '23 at 19:55
  • 1
    @Venkat Using lualatex is better since, unlike xelatex, it’s very actively maintained. I haven’t used pdflatex in years, so I’m not the person to suggest fixes to the .sty file. – Thérèse Feb 07 '23 at 20:01
  • @Thérèse wasn’t XCharter specifically developed to be used with fontspec / Unicode coding instead of the traditional fontenc / utf8 coding? Thought I came across a remark to that effect somewhere. – alchemist Feb 07 '23 at 20:16
2

I'm absolute beginner, but after some digging into the code I found the following:

  • The correct 1 can be obtained with pdfLatex by using the option proportional (default is tabular)

    \usepackage[osf,proportional]{XCharter}
    
  • To obtain the correct 1 while still using the default tabular option, I modified the encoding file AppData\Local\Programs\MiKTeX\fonts\enc\dvips\xcharter\xch1_dp2hrq.enc by changing

    %30
      /zero.tosf /one.tosf /two.tosf /three.tosf /four.tosf /five.tosf /six.tosf /seven.tosf
      /eight.tosf /nine.tosf /colon /semicolon /less /equal /greater /question
    

    into

    %30
      /zero.tosf /one.Alt.tosf /two.tosf /three.tosf /four.tosf /five.tosf /six.tosf /seven.tosf
      /eight.tosf /nine.tosf /colon /semicolon /less /equal /greater /question
    

    and thus changing the style of the 1.

    Why this file? Well, I looked it in AppData\Local\Programs\MiKTeX\fonts\map\dvips\xcharter\XCharter.map to see which file corresponds to XCharter1-Roman-tosf-t1.

I don't have any experience with fonts or Tex code, but for me this worked. Hope it helps!

Nicolas
  • 21