0

I am using Minion Pro (with fontspec under LuaLaTeX), and the character ϱ(= \varrho, but in text mode) doesn't show.

input: ϱυϑμὸν
output: �υϑμὸν

Is there a way to globally remap only this character to a different font? I can, of course, use a different font for every instance (or all Greek text, for that matter) but would rather not.

8
  • you can setup a fallback font, see e.g. tex.stackexchange.com/a/572220/2388 Nov 27 '20 at 14:48
  • Thanks. I'm not having trouble with emojis, but the principle should be the same. I'll give it a shot tonight.
    – Ingmar
    Nov 27 '20 at 14:55
  • 2
    I do know that emoiji and greek symbols are something different ;-). But yes the principle is the same. Nov 27 '20 at 15:02
  • 2
    Probably you want to substitute it with a standard rho, don't you?
    – egreg
    Nov 27 '20 at 15:05
  • 1
    @Ingmar The original text has a rho, the graphical realization of which depends on the printer/typographer or copyist.
    – egreg
    Nov 27 '20 at 17:22
1

I don’t have Minion Pro to test this, but you can set the character active with newunicodechar, look up whether the current font contains ϱ with \iffontchar, and return the character if so, e.g.

\iffontchar\font`ϱ\symbol"03F1\else\symbol"03C1\fi

In practice, you might want to wrap this further in \ifmmode to use \varrho in math mode, e.g.

\ifmmode%
  \varrho%
\else%
  \iffontchar\font`ϱ%
    \symbol"03F1%
  \else\symbol"03C1%
  \fi%
\fi

You hit on using Gentium as a fallback font, instead of ρ as a fallback glyph, which is a great idea. You might want to load the supplemental font with Scale=MatchLowercase so the letters come out the same size. Also be sure to enclose the font change in a group, so it does not bleed through to the following text.

\newfontfamily\gentium{Gentium}[Scale=MatchLowercase]

\newunicodechar{^^^^03f1}{%
  \ifmmode%
    \varrho%
  \else%
    \iffontchar\font`ϱ%
      \symbol"03F1%
    \else{{\gentium\symbol"03F1}}%
    \fi%
  \fi}
3
  • Thank you for pointing me in the right direction. Ultimately it was much easier: \newfontfamily{\gentium}{Gentium} \newunicodechar{ϱ}{\gentium ϱ} is all it took.
    – Ingmar
    Nov 27 '20 at 17:19
  • 1
    @Ingmar You at least want an extra pair of braces, \newunicodechar{ϱ}{{\gentium ϱ}}, or the font will stay switched to Gentium afterward.
    – Davislor
    Nov 27 '20 at 19:04
  • Thanks for pointing that out!
    – Ingmar
    Nov 28 '20 at 7:21
1

I am answering my own question, as it allows me more formatting than a simple comment, and to sum up the various answers and comments I have received. I have since discovered that my font is missing another character, ɔ, so my solution deals with both of them:

\documentclass{scrartcl}
\usepackage{newunicodechar}
\usepackage{fontspec}

\setmainfont{MinionPro.otf}   % Any defective font will do. Font files kept in the 
                              % current directory to eliminate all path issues etc.
% The fallback font:
\newfontfamily{\gentium}[Scale=MatchLowercase]{GentiumPlus-Regular.ttf}

% (Only) if character is not found in current font, fall back to Gentium:
\newunicodechar{ϱ}{\iffontchar\font`ϱ ϱ\else{{\gentium ϱ}}\fi}
\newunicodechar{ɔ}{\iffontchar\font`ɔ ɔ\else{{\gentium ɔ}}\fi}

\begin{document}
{\huge Hellɔ woϱld!}
\end{document}
3
  • 1
    Might be worthwhile to load gentium with Scale=MatchLowercase so the glyphs are the same size. An \ifmmode would additionally let you use the symbols in math mode.
    – Davislor
    Nov 28 '20 at 8:08
  • Duly noted. That said, I do quite a bit more than that, actually (loading font variants, providing for small caps features, ligatures and the like) but didn't consider it necessary for a minimal example. And I never need math mode: but since these answers seemingly live on forever, this is definitely an important point to consider for some.
    – Ingmar
    Nov 28 '20 at 9:19
  • Fair enough! Good self-answer.
    – Davislor
    Nov 28 '20 at 23:39

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.