Open ghost opened 6 years ago
I looked further into it and I turned out that explicitly setting Latin Modern Math
by
\setmathfont{Latin Modern Math}
as the math font solves the issue as can be shown by the following two test cases.
\documentclass{scrartcl}
\usepackage{fontspec}
\usepackage{unicode-math}
% \setmathfont{Latin Modern Math}
\renewcommand{\vec}[1]{\mathbf{#1}}
\begin{document}
$ \vec{a} $
\end{document}
\documentclass{scrartcl}
\usepackage{fontspec}
\usepackage{unicode-math}
\setmathfont{Latin Modern Math}
\renewcommand{\vec}[1]{\mathbf{#1}}
\begin{document}
$ \vec{a} $
\end{document}
I forgot the mention that all files were compiled by LuaTeX-1.0.4.
unicode-math waits until \begin{document} to setup the default font and the default definitions. So if you don't use \setmathfont, you should delay your redefinition. I would also recommend to use \symbf instead of \mathbf:
\documentclass{scrartcl}
\usepackage{fontspec}
\usepackage{unicode-math}
\AtBeginDocument{\renewcommand{\vec}[1]{\symbf{#1}}}
\begin{document}
$ \vec{a} $
\end{document}
Thanks for the fast response. I couldn't find the information that the definitions were defined with the \begin{document} command so that really got me on the wrong foot, I have to admit. It still seems a bit odd to me, so perhaps you could mention it for future users in your manual. But as the issue is solved for me, I think you could close the issue now.
Description
I tried to redefine the vector definition with
\usepackage{unicode-math}
statement in the preamble but I could not get it working.Check/indicate
\setmainlanguage{german}
)A not working minimal example (CaseA.tex) demonstrating the issue
A working minimal example (CaseB.tex) demonstrating the issue
Further details
As the two files only differ in the import of the
unicode-math
I would suspect the error within theunicode-math
error. Alsonewcommand
work as expected:Log and PDF files are attached below
CaseA.log CaseA.pdf CaseB.log CaseB.pdf