I am developing a class that fits the needs of both academics and non-academics; the latter often need to write highly legible numbers that are not math (they will be prices, reference numbers, dates, etc.).

For this purpose, the choice of fonts is very limited – we need a free, old-style font with as many alphabets as we can get, including at least all of Latin Extended and Greek (some medieval alphabets are a good point). It also needs to be reasonably XeLaTeX and copy-paste friendly. I settled for Junicode (though I am open to suggestions).

The problem is that Junicode has an old-style 1 that looks just like a lowercase I, hence it is suitable for academics and general page designs, but not for the contents of non-academic documents. The developer does not seem to have been active lately – we asked for an alternate old-style 1. My current solution is to create an option (academic vs. others) that affects the old-style numbers feature for the entire document.

What are other solutions that would allow me to switch numbers in a clean and subtle (contextual) way?

  • By using a different set of numbers throughout the documents (I have tried several solutions that change the catcodes, but then footnotes failed to superscript). See the code below.
  • By switching to lining numbers on non-academic documents but only for text that is directly inputed by the user after \begin{document} (not class-defined macros, unless specified).
  • By using a specific command that changes the font (this one is easy to implement, so the question is: what would be a wise, ergonomic and user-friendly way to do it, otherwise the extra hassle for the end-user is not worth it).
  • I am not into tweaking the font itself, since the idea is to release the class (but another compatible font would be ok).
  • Or anything else you can think of.

My first attempt was as follows. It works just fine, except \textsuperscript numbers are set at normal size on the baseline (e.g. \footnotemark) — and I suspect this hack would cause other problems when used in a long or complex document that includes bibliographies, indexes, etc.



\XeTeXinterchartokenstate = 1

\XeTeXinterchartoks 0 \charnumbers = {\begingroup\numbersfont}
\XeTeXinterchartoks 255 \charnumbers = {\begingroup\numbersfont}
\XeTeXinterchartoks \charnumbers 0 = {\endgroup}
\XeTeXinterchartoks \charnumbers 255 = {\endgroup}

Does anyone have an idea to solve this issue or provide an alternative solution that does not require too much from the end-user? (As explained above.)

  • 3
    Why are oldtyle numbers only suitable for academics? I suspect most 'non-academics' would not be thrown by an oldstyle number 1. I'd recommend instead providing a class option that allows the user to pick whether oldstyle numbers should be used or not rather than mixing oldstyle and non-oldstyle numbers; you can add the 'specific command' too for the special cases that are sure to arise. And look at etoolbox's \AtBeginEnvironment and \AtEndEnvironment for hooking into various environments. – jon Jul 5 '14 at 19:50
  • I personally do not mind old-style figures anywhere, but in legal documents we need 1 to look like a 1 no matter what. Hence the question – I would like to keep using OSF as much as possible because they are suitable, but I need to find a proper way to either switch fonts or replace them by lining figures when needed. The goal is to avoid forcing users to use tons of environments or commands just to get what they want – or to find an implementation that is at least sensible (e.g. it could function as some kind of "semi-math" mode). – ienissei Jul 5 '14 at 22:33
  • What about the STIX fonts? They have wide coverage. (But I haven't checked the appearance of figures.) Deja Vu also has wide coverage. – cfr Jul 6 '14 at 0:59
  • @cfr Thanks for the suggestion. If we could reasonably use "réales" such as those (Times New Roman sort of style), we definitely would have a wider range of possible fonts – even modern fonts would be easy (just use Latin Modern). Trust me, I have envisioned a lot of possibilities, and Junicode mostly stood out because it is old fashioned while being highly legible, and (over all other such existing fonts) it can be replaced with Adobe Garamond Pro pretty much without changing line breaks (and there are lots of people who do use Adobe's fonts). So I really am looking for a LaTeX solution. – ienissei Jul 6 '14 at 11:36
  • 1
    I think you must take another look, because I can cut/paste small caps of EB Garamond (at least with Evince). On the other hand, it might be easier to find a «general purpose» font (as the one you require) and combine it a polytonic greek font. – Ludenticus Feb 12 '15 at 22:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.