Missing \nabla Symbol in Unicode-Math – How to Redefine \div and \curl

amsmathmacrosunicode-math

I would like to redefine the \div and \curl commands to give \mbfnabla\cdot and \mbfnabla\vectimes.

In unicode-math breaks \DeclareMathOperator we get the hint that we need to wrap redefines inside an AtBeginDocument block.
While this seems to work for redefining \div with just giving the text div, using \nabla or \mbfnabla does not render the respective nabla symbol:

Maxwell equations with missing nabla symbols

The corresponding MVP code is:

\documentclass{scrartcl}

\usepackage{amsmath}
\usepackage{unicode-math}

\newcommand{\vdot}{\cdot}
\newcommand{\vcross}{\vectimes}
\newcommand{\vb}[1]{\symbfup{#1}}
\newcommand{\vu}[1]{\hat{\vb{#1}}}

\AtBeginDocument{   
    \let\div\relax
    \let\curl\relax
    \DeclareMathOperator{\div}{\mbfnabla\vdot}
    \DeclareMathOperator{\curl}{\mbfnabla\vectimes}
}

\begin{document}
    \begin{align}
        \div\vb{E}
        &=
        j_0
        &
        \div\vb{B}
        &=
        0
        \\
        \curl\vb{E}
        &=
        -\partial_t\vb{B}
        &
        \curl\vb{B}
        &=
        \vb{j}
        +
        \partial_t\vb{E}
    \end{align}
\end{document}

I am using LuaLaTex on MacOS where I recently updated all packages with tlmgr update -all.

Best Answer

The problem can be seen in the log file:

Missing character: There is no 𝛁 (U+1D6C1) in font [lmroman10-regular]

You can use a similar math font that has the glyph:

documentclass{scrartcl}

\usepackage{amsmath}
\usepackage{unicode-math}

\setmathfont{NewCMMath-Regular.otf}

\newcommand{\vdot}{\cdot}
\newcommand{\vcross}{\vectimes}
\newcommand{\vb}[1]{\symbfup{#1}}
\newcommand{\vu}[1]{\hat{\vb{#1}}}

\AtBeginDocument{%
  \renewcommand{\div}{\mbfnabla\vdot}%
  \newcommand{\curl}{\mbfnabla\vectimes}%
}

\begin{document}

\begin{align}
  \div\vb{E}  &= j_0               & \div\vb{B}  &= 0
  \\
  \curl\vb{E} &= -\partial_t\vb{B} & \curl\vb{B} &= \vb{j} + \partial_t\vb{E}
\end{align}

\end{document}

enter image description here

You might use \DeclareMathOperator, but the spacing will be not the best.

\documentclass{scrartcl}

\usepackage{amsmath}
\usepackage{unicode-math}

\setmathfont{NewCMMath-Regular.otf}

\newcommand{\vdot}{\cdot}
\newcommand{\vcross}{\vectimes}
\newcommand{\vb}[1]{\symbfup{#1}}
\newcommand{\vu}[1]{\hat{\vb{#1}}}

\AtBeginDocument{%
  \let\div\relax
  \DeclareMathOperator{\div}{\mathnormal{\mbfnabla\vdot}}%
  \DeclareMathOperator{\curl}{\mathnormal{\mbfnabla\vectimes}}%
}

\begin{document}

\begin{align}
  \div\vb{E}  &= j_0               & \div\vb{B}  &= 0
  \\
  \curl\vb{E} &= -\partial_t\vb{B} & \curl\vb{B} &= \vb{j} + \partial_t\vb{E}
\end{align}

\end{document}

enter image description here

But the definition can be, more simply,

\AtBeginDocument{%
  \renewcommand{\div}{\mathop{\mbfnabla\vdot}}%
  \newcommand{\curl}{\mathop{\mbfnabla\vectimes}}%
}
Related Question