TransWikia.com

Trouble with Using Custom Theorems with Roboto Font

TeX - LaTeX Asked on August 14, 2021

I am having trouble with making a custom Theorem environment using Roboto font. Basically, I want the theorem header to use fontseries{medium} instead of bfseries. When working with this, I have made two observations:

  1. Only the number of the theorem takes on this new font.
  2. If I change the theorem body style to fontseries{medium}, only text that is emphasized using emph{} takes on the new font.

Here is a MWE and the resulting output:

documentclass[10pt]{article}

usepackage[sfdefault, light]{roboto}
usepackage{mathtools, amssymb, amsthm, bm}
newtheoremstyle{mytheoremstyle}
    {topsep}
    {topsep}
    {fontseries{medium}} % only changes emphasized text
    {}
    {fontseries{medium}} % only changes theorem number
    {}
    {0.5em}
    {}
    theoremstyle{mytheoremstyle}
    newtheorem{theorem}{Theorem}
usepackage[margin = 1in]{geometry}

begin{document}

    begin{theorem}
        The emph{expected value} of a continuous random variable (X) with support (Omega) is given by 
        begin{align*}
            mathbb{E}(X) coloneqq int_{Omega} mathrm{d} F(x) = int_{Omega} f(x) ;mathrm{d} x,
        end{align*}
        where (f) and (F) denote the pdf and cdf, respectively. 
    end{theorem}

end{document}

And here is the output:

enter image description here

What’s going on here?

One Answer

The light option of the roboto package, when you use Type 1 fonts, redefines the medium weight. What you want here is the robotomedium command:

documentclass[10pt]{article}

usepackage[sfdefault, light]{roboto}
usepackage{mathtools, amssymb, amsthm, bm}
newtheoremstyle{mytheoremstyle}
    {topsep}
    {topsep}
    {robotomedium} % changed
    {}
    {robotomedium} % changed
    {}
    {0.5em}
    {}
    theoremstyle{mytheoremstyle}
    newtheorem{theorem}{Theorem}
usepackage[margin = 1in]{geometry}

begin{document}

    begin{theorem}
        The emph{expected value} of a continuous random variable (X) with support (Omega) is given by 
        begin{align*}
            mathbb{E}(X) coloneqq int_{Omega} mathrm{d} F(x) = int_{Omega} f(x) ;mathrm{d} x,
        end{align*}
        where (f) and (F) denote the pdf and cdf, respectively. 
    end{theorem}

end{document}

This also works in LuaLaTeX or XeLaTeX, which make roboto use the OTF fonts.

Correct answer by Davislor on August 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