30

Here are two examples:

1

\documentclass[a4paper,10pt]{article}
\usepackage{amsmath}
\begin{document}
    $\boldsymbol x$
\end{document}

2

\documentclass[a4paper,10pt]{article}
\usepackage{amsmath}
\usepackage{stmaryrd}
\begin{document}
    $\boldsymbol x$
\end{document}

As far as I can see, both versions produce the same output when compiled with pdflatex: there is a single "x" in bold italics.

However, when I compile document 2, I also get the following warning:

LaTeX Font Warning: Font shape `U/stmry/b/n' undefined
(Font)              using `U/stmry/m/n' instead on input line ….

Why do I get this warning (which seems to suggest that Latex was not able to find the right font) but correct output?

How do I avoid the warning? I need both of the following in my document:

  • bold versions of normal math symbols (something that I can easily produce without stmaryrd)
  • regular versions of some symbols that are only provided in stmaryrd

1 Answer 1

28

Internally \boldsymbol effectively uses \boldmath so sets up an entire bold math setup whatever symbols are actually used in bold, hence you get this warning.

The silence package gives an interface for filtering out various LaTeX messages so you could filter out these or in this case, stmaryrd uses

\SetSymbolFont{stmry}{bold}{U}{stmry}{b}{n}
                                     %%%

To declare that the bold math version should use the bold font (which is never declared as it doesn't exist).

So an alternative would be to tell LaTeX to use the normal font in the bold version.

I get no warnings for this:

\documentclass[a4paper,10pt]{article}
\usepackage{amsmath}

\usepackage{stmaryrd}
\SetSymbolFont{stmry}{bold}{U}{stmry}{m}{n}
                                     %%%
\begin{document}


aa
    $\boldsymbol{x}$
\end{document}
6
  • @JukkaSuomela try now:-) Apr 3, 2013 at 16:28
  • This works, but (as expected) also hides valid warnings: $\boldsymbol{\llbracket}$, for example, produces no warnings and simply silently fails producing a bold (⟦ is one of the symbols stmaryrd defines). Is there a way of hiding the warning only when it is indeed spurious, thus, only when the document does not actively try to use bold symbols from the St Mary’s Road font? And, relatedly, can this problem be somehow corrected by changing the code of the stmaryrd package? (In which case I’d try to contact the authors.) Nov 16, 2020 at 15:16
  • 1
    @OlivierCailloux not easily as (unlike math alphabets \mathsf etc) math symbol fonts have to be set up before the math is started so symbols can be assigned fixed \mathchardef values so the font warning comes at that point even if you have no math at all. Nov 16, 2020 at 15:27
  • 2
    Note that the snippet code has to be inserted before packages using bold maths. For example, \usepackage{bm} \usepackage{stmaryrd} \SetSymbolFont{stmry}{bold}{U}{stmry}{m}{n} will produce a warning but \usepackage{stmaryrd} \SetSymbolFont{stmry}{bold}{U}{stmry}{m}{n} \usepackage{bm} will not.
    – Flewer47
    Jul 9, 2021 at 8:57
  • 2
    @Flewer47 as documented, bm if it is used must be loaded after any other changes to the math font setup so your first snippet is user error. Jul 9, 2021 at 10:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .