TransWikia.com

Using the cmbright package in a limited range of my document

TeX - LaTeX Asked on April 7, 2021

Using the cmbright package results in a complete change from serif to sans serif text and math fonts, including even lowercase, sans serif Greek letters.

However, I’d like to use the cmbright package only in a limited range of my document — for example, in the most recent edition of the Feynman Lectures on Physics, the cmbright package appears to be used for figures and their captions only:

enter image description here

How exactly can I achieve this? At the very least, I’d be interested in using the lowercase and uppercase sans serif Greek letters from the cmbright package whilst otherwise using the standard Computer Modern fonts for text and math.

One Answer

In PDFLaTeX,

documentclass{article}
usepackage[T1]{fontenc}
usepackage{cmbright}
usepackage[paperwidth=10cm]{geometry}

renewcommandfamilydefault{rmdefault}

begin{document}
Text in Computer Modern Roman,
textsf{and Computer Modern Bright.}
end{document}

Computer Modern Roman and Bright sample

To change only the sans-serif text font, and not the default font or the math fonts:

documentclass{article}
usepackage[T1]{fontenc}
renewcommand{sfdefault}{cmbr}

begin{document}
Text in Computer Modern Roman,
textsf{and Computer Modern Bright.}
end{document}

Then add sffamily to every type of text you want to appear in sans-serif, such as captions.

If you wanted to use CM Bright Greek letters in math mode, the simplest way to do that is probably to load it as the OML sans-serif math alphabet through isomath.

You could also do something like (untested):

DeclareSymbolFont        {sans} {OML}{cmbrm}{m}{it}
SetSymbolFont      {sans}{bold} {OML}{cmbrm}{b}{it}

DeclareMathSymbol{alpha}{mathalpha}{sans}{11}
DeclareMathSymbol{beta}{mathalpha}{sans}{12}
DeclareMathSymbol{gamma}{mathalpha}{sans}{13}
DeclareMathSymbol{delta}{mathalpha}{sans}{14}
DeclareMathSymbol{epsilon}{mathalpha}{sans}{15}
DeclareMathSymbol{zeta}{mathalpha}{sans}{16}
DeclareMathSymbol{eta}{mathalpha}{sans}{17}
DeclareMathSymbol{theta}{mathalpha}{sans}{18}
DeclareMathSymbol{iota}{mathalpha}{sans}{19}
DeclareMathSymbol{kappa}{mathalpha}{sans}{20}
DeclareMathSymbol{lambda}{mathalpha}{sans}{21}
DeclareMathSymbol{mu}{mathalpha}{sans}{22}
DeclareMathSymbol{nu}{mathalpha}{sans}{23}
DeclareMathSymbol{xi}{mathalpha}{sans}{24}
DeclareMathSymbol{pi}{mathalpha}{sans}{25}
DeclareMathSymbol{rho}{mathalpha}{sans}{26}
DeclareMathSymbol{sigma}{mathalpha}{sans}{27}
DeclareMathSymbol{tau}{mathalpha}{sans}{28}
DeclareMathSymbol{upsilon}{mathalpha}{sans}{29}
DeclareMathSymbol{phi}{mathalpha}{sans}{30}
DeclareMathSymbol{chi}{mathalpha}{sans}{31}
DeclareMathSymbol{psi}{mathalpha}{sans}{32}
DeclareMathSymbol{omega}{mathalpha}{sans}{33}
DeclareMathSymbol{varepsilon}{mathalpha}{sans}{34}
DeclareMathSymbol{vartheta}{mathalpha}{sans}{35}
DeclareMathSymbol{varpi}{mathalpha}{sans}{36}
DeclareMathSymbol{varrho}{mathalpha}{sans}{37}
DeclareMathSymbol{varsigma}{mathalpha}{sans}{38}
DeclareMathSymbol{varphi}{mathalpha}{sans}{39}
DeclareMathSymbol{Gamma}{mathalpha}{sans}{0}
DeclareMathSymbol{Delta}{mathalpha}{sans}{1}
DeclareMathSymbol{Theta}{mathalpha}{sans}{2}
DeclareMathSymbol{Lambda}{mathalpha}{sans}{3}
DeclareMathSymbol{Xi}{mathalpha}{sans}{4}
DeclareMathSymbol{Pi}{mathalpha}{sans}{5}
DeclareMathSymbol{Sigma}{mathalpha}{sans}{6}
DeclareMathSymbol{Upsilon}{mathalpha}{sans}{7}
DeclareMathSymbol{Phi}{mathalpha}{sans}{8}
DeclareMathSymbol{Psi}{mathalpha}{sans}{9}
DeclareMathSymbol{Omega}{mathalpha}{sans}{10}

In LuaTeX or XeTeX:

documentclass{article}
usepackage{unicode-math}
usepackage[paperwidth=10cm]{geometry}

setsansfont{CMU Bright}[Scale=MatchLowercase]

begin{document}
Text in Computer Modern Roman,
textsf{and Computer Modern Bright.}
end{document}

To load only its Greek letters in math mode, you would do something like:

setmathfont{Latin Modern Math}
setmathfont{CMU Bright}[range=up/{Greek,greek}]
setmathfont{CMU Bright Italic}[range=it/{Greek,greek}]

Answered by Davislor on April 7, 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