[Tex/LaTex] Bold math in Latex

amsmathbmboldmathmath-mode

I understand that there is numeriuos questions already posted here regarding the math bolding in latex. But I can't make any of them work.

This is my preamble:

\usepackage{natbib}
\usepackage{changes}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{setspace}
\usepackage{subcaption}
\usepackage{minted}
\usepackage{pgfplots}
\usepackage{url}
\usepackage{longtable}
\usepackage{booktabs}
\usepackage{tikz}
\usepackage{adjustbox}
\usepackage{float}
\usepackage{amsmath}

Somehere in my big document I try:

\begin{equation}
\bar{\mathbf{\sigma}}=\frac{\mathbf{\sigma}}{1-d}
\end{equation}

However, I get this:
enter image description here

if I use \boldsymbol nothing gets bolded. Then if I use \bm, at first it gives an error:

! Undefined control sequence.
l.100 \bar{\bm
              {\sigma}}=\frac{\bm{\sigma}}{1-d}

If I add \usepackage{bm} to my preamble I get an error:

! Improper alphabetic constant.

                   \mitsigma 
l.100 \bar{\bm{\sigma}
                      }=\frac{\bm{\sigma}}{1-d}

Why is it so difficult to make my math bold? What is happening in my case and what I am doing wrong?

EDIT: To add: I am using MiKTeX with TeXworks and I render with XeLaTeX

EDIT2: As requested for full minimal example:

\documentclass[11pt]{article}

\usepackage{natbib}
\usepackage{changes}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{setspace}
\usepackage{subcaption}
\usepackage{minted}
\usepackage{pgfplots}
\usepackage{url}
\usepackage{longtable}
\usepackage{booktabs}
\usepackage{tikz}
\usepackage{adjustbox}
\usepackage{float}
\usepackage{amsmath}

\begin{document}
\begin{equation}
\bar{\boldsymbol{\sigma}}=\boldsymbol{\sigma}(1-d)
\end{equation}

\end{document}

But everything works here. So this means the problem lies in the document class I am using. It is provided by my university.. Any ideas how could I override something that broke my bold math?

EDIT3: The snippet from my university class (I did not add the whole thing as it is 1000 lines long). That's the only place where math is mentioned trough out the whole class.

\if@nativefonts
    %% The native font is Utopia Regular with Fourier math. We use Latin Modern
    %% as a fallback, since Utopia lacks support for sans-serif and monospace.
    \RequirePackage[T1]{fontenc}
    \RequirePackage[utf8]{inputenc}
%    \RequirePackage{lmodern}
    \if@roman
%      \RequirePackage{lato}
%      \RequirePackage{helvet}
      \RequirePackage[thin]{roboto}
      \RequirePackage{fourier}
    \else
      \RequirePackage[thin]{roboto}
%      \RequirePackage[default]{lato}
      \RequirePackage{helvet}
      \renewcommand{\familydefault}{\sfdefault}
    \fi
    \def\largetitlefont{\fontfamily{Roboto-LF}}
    \def\largetitleseries{\fontseries{t}}
    \def\largetitleshape{\fontshape{n}}
    \def\largetitlestyle{\largetitlefont\largetitleseries\largetitleshape}
    \def\titleshape{\fontshape{n}}
    \if@roman
        \renewcommand{\familydefault}{\rmdefault}
        \def\titlefont{\fontfamily{fla}}
        \def\sectitleshape{\fontshape{n}}
        \def\sectitlestyle{\rmfamily\titleshape\bfseries}%{\familydefault\bfseries}
        \def\chaptitlestyle{\rmfamily\titleshape}
    \else
%        \renewcommand{\familydefault}{\tudsffamily}
%        \def\titleshape{\fontshape{n}}
        \def\titlefont{\fontfamily{fla}}
        \def\sectitlestyle{\sffamily\titleshape\bfseries}%        \def\sectitlestyle{\titleshape\bfseries}
        \def\chaptitlestyle{\sffamily\titleshape}
    \fi
%    \def\largetitleshape{\upshape}
%    \if@print
    \def\titlestyle{\titlefont\titleshape}
%    \else
%        \def\titlestyle{\titlefont\titleshape}
%        \def\sectitlestyle{\sffamily\titleshape\bfseries}
%    \fi
%    \def\titlestyle{\titlefont\titleshape\bfseries}
%    \if@print
%        \def\headerstyle{\titlefont\titleshape\bfseries}
%    \else
        \def\headerstyle{\titlefont}
%    \fi
\else
    %% Apart from Bookman Old Style and Arial, we use Courier New for monospace
    %% and Cambria for math.
    \RequirePackage{unicode-math}
    \setmainfont[
        Path = fonts/,
        Extension = .ttf,
        BoldFont = *-Bold,
        ItalicFont = *-Italic,
        BoldItalicFont = *-BoldItalic
    ]{BookmanOldStyle}
    \setsansfont[
        Path = fonts/,
        Extension = .ttf,
        BoldFont = *_Bold,
        ItalicFont = *_Italic,
        BoldItalicFont = *_Bold_Italic]{Arial}
    \setmonofont[
        Path = fonts/,
        Extension = .ttf,
        UprightFont = *MT,
        BoldFont = *-BoldMT,
        ItalicFont = *-ItalicMT,
        BoldItalicFont = *-BoldItalicMT
    ]{CourierNewPS}
    \setmathfont[
        Path = fonts/,
        Extension = .ttf
    ]{CambriaMath}
    %% The default style for text is Tahoma (sans-serif).
%    \setlength\@largetitlesize{96pt}
    \renewcommand*\familydefault{\sfdefault}
    %% The default style for titles is Bookman Old Style (serif). 
    \def\titlefont{\tudsffamily}
    \def\largetitlefont{\tudtitlefamily}
    \def\titleshape{}
    \def\largetitleshape{\titleshape}
    \def\largetitleseries{}
    \def\largetitlestyle{\largetitlefont\largetitleseries\largetitleshape}
    \def\chaptitlefamily{\tudsffamily}
%    \if@print
%        \def\titlestyle{\titlefont\titleshape}
%%        \def\largetitlestyle{\largetitlefont\titleshape\bfseries}
%        \def\sectitlestyle{\tudsffamily\titleshape\bfseries}
%    \else
        \def\titlestyle{\titlefont\titleshape}
%        \def\largetitlestyle{\largetitlefont\titleshape}
        \def\sectitlestyle{\tudsffamily\titleshape\bfseries}
        \def\chaptitlestyle{\chaptitlefamily}
%    \fi
    \def\headerstyle{\titlestyle}
\fi

Best Answer

As you are compiling with xelatex I assume from your snippets that you are using unicode-math and Cambria Math as math font. With this setup standard solutions like \boldsymbol and \bm will often not work. With unicode-math you can use \symbf and \symbfit to get bold version of the symbols for which bold versions exist in unicode and your math font. You can set up a faked bolder math font for the case where the complete equation should be bolder (e.g. in headings).

\documentclass[11pt]{article}

\usepackage{amsmath,bm}
\usepackage{unicode-math}
\setmathfont[]{CambriaMath}
\setmathfont[version=bold,FakeBold=2]{CambriaMath}
\begin{document}
single symbols bolder:
\begin{equation}
123= \symbf{\alpha} = \bar{\symbf{\sigma}}
\end{equation}

everything bolder:
\mathversion{bold}
\begin{equation}
123= \alpha = \bar{\sigma}
\end{equation}

\end{document}

enter image description here

Related Question