0

How to write bold and italics \usepackage[cm]{sfmath} provided?

\documentclass[12pt,a4paper,hidelinks]{report}
       
\usepackage{booktabs}
\usepackage[cm]{sfmath}

\newcommand{\pinom}{\hbox{$\mathcal{\pi}$}}

\usepackage{physics}
\usepackage{bm}  
\begin{document}

\begin{align*}
& \pinom = P (\vb*{\Theta}_\mathrm{M} | M \vb*{D}) \\ 
\end{align*}

\end{document}

enter image description here

The desired result is to get D and theta in italics.

7
  • 2
    please fix your example so that it shows the problem that you are having, as posted it produces no output at all. Note that bm should always be loaded after any other font packages, and you are loading it first. May 20 at 13:50
  • I am sorry. I copied it wrong. I tried to set bm later, but it did not help.
    – Elena Greg
    May 20 at 14:54
  • what is the intention of \newcommand{\pinom}{\hbox{$\mathcal{\pi}$}} ? I don't know any font set that has anything the could be called calligraphic Greek? Just use \newcommand{\pinom}{\pi} to get an italic D you could just type D May 20 at 15:28
  • \pinom is in a different font than just \pi, but it is not important. I know that I get an italic D by typing D, but how to get bold and simultaneously italics D? The same I would like for theta.
    – Elena Greg
    May 20 at 15:46
  • bm can only access bold fonts that are available. the sfmath package you are using documents the cm option with % \sfdefault is cmss % no slanted bold letters % no slanted bold capital Greeks May 20 at 16:09
1

The comments in the package detail the available fonts for each option, for cm that is

  % \sfdefault is cmss
  % no slanted bold letters
  % no slanted bold capital Greeks

so as no bold fonts are declared, \bm can not access them.

If you use px then the package documents

  % \sfdefault is pxss (pxfonts.sty)
  % slanted bold letters
  % slanted bold capital Greeks

enter image description here

\documentclass[12pt,a4paper,hidelinks]{report}
       
\usepackage{booktabs}
\usepackage[px]{sfmath}

% no!! \newcommand{\pinom}{\hbox{$\mathcal{\pi}$}}

% \usepackage{physics}
\usepackage{amsmath}
\usepackage{bm}  
\begin{document}

\begin{align*}
% & \pinom = P (\vb*{\Theta}_\mathrm{M} | M \vb*{D}) \\ 
& \pi =P(\bm{\mathsl{\Theta}}_{\mathrm{M}}\mid M\bm{D})
\end{align*}

\end{document}
5
  • Thank you, I got an error :/Program Files/MiKTeX 2.9/fonts/enc/dvips/base/8r.enc} !pdfTeX error: pdflatex (file rtxbsssl): Font rtxbsssl at 720 not found ==> Fatal error occurred, no output PDF file produced!
    – Elena Greg
    May 20 at 16:38
  • you have an incomplete installation the px fonts are in texlive and miktex, sorry I can't help with miktex specifics as I don't use it, but you should see pxfonts or newpx or some such in the miktex console @ElenaGreg May 20 at 16:48
  • I have installed both packages, but it did not help
    – Elena Greg
    May 20 at 18:22
  • @ElenaGreg sorry I can't help with miktex installs, does it work with tx instead of px that also has the bold fonts. May 20 at 18:54
  • I tried another computer with linux instead of windows and it works. Thank you very much.
    – Elena Greg
    May 20 at 19:15
0

The sansmathfonts package has outline bold italic math fonts based on Computer Modern Sans Serif:

\documentclass[12pt,a4paper,hidelinks]{report}
       
\usepackage{booktabs}
\usepackage{sansmathfonts}

\newcommand{\pinom}{\hbox{$\mathcal{\pi}$}}

\usepackage{physics}
\usepackage{bm}  

\newcommand\mathbfit[1]{\bm{\mathit{#1}}}

\begin{document}

\begin{align*}
& \pinom = P (\mathbfit{\Theta}_\mathrm{M} | M \mathbfit{D}) \\ 
\end{align*}

\end{document}

sansmathfonts sample

The \vb* command you used is package-specific and gets you bitmap fonts. I defined a \mathbfit command instead. This is the same syntax as isomath or unicode-math, two other packages you can use to get bold Italic mathematical Greek, so changing the fonts or copy-pasting into a new document should be easy.

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.