TransWikia.com

Bold greek letters using alphabeta and cfr-lm

TeX - LaTeX Asked by Jan Hajer on February 14, 2021

I am using the alphabeta package in order to get upright greek letters in text mode.
I also want to use bold and sans serif upright greek letters in text mode.
This works well with computer modern and latin modern (using lmodern) fonts but not with others.
In particular I want to use the feature richer latin modern implementation from cfr-lm.

documentclass{article}    
usepackage{alphabeta}    
% usepackage{lmodern} % <- works just as computer modern
% usepackage{cfr-lm} % <- different result compared to computer modern    
begin{document}    
AbGammadelta123
textbf{AbGammadelta123}
textsf{AbGammadelta123}    
end{document}

The textbf and textsf commands have no effect on the greek letters when using cfr-lm.
What is going wrong here?
Which part of the implementation difference between lmodern and cfr-lm breaks this feature?
How can I fix it?

Partial fix:
When I use

DeclareFontFamilySubstitution{LGR}{clm2j}{cmr}

I can fix the bold letters, but is this the right way to go forward?

One Answer

There are no Greek font files (such as lgrclm2j.fd) for cfr-lm. NFSS therefore tries to fall back to cmr, which happens to work for the serif fonts, albeit with a warning message, but fails for sans-serif (and would also fail for ttfamily).

You could do the following:

documentclass{article}  
usepackage[LGR,T1]{fontenc}  
usepackage{alphabeta}
% usepackage{lmodern} % <- works just as computer modern
usepackage{cfr-lm} % <- different result compared to computer modern    
usepackage{substitutefont}

substitutefont{LGR}{clm2j}{cmr}
substitutefont{LGR}{clm2js}{cmss}

begin{document}    
AbGammadelta123
textbf{AbGammadelta123}
textsf{AbGammadelta123}    
end{document}

This tells NFSS to fall back to Computer Modern Roman and Computer Modern Sans Serif, which works.

If you can use LuaLaTeX or XeLateX, you could instead use the OpenType New Computer Modern, with

usepackage[default]{fontsetup}

Correct answer by Davislor on February 14, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP