# The unicode-math package messes up MnSymbol symbols

Using TeXLive 2015.

The commands \lsem and \rsem of MnSymbol don’t work when the package unicode-math is loaded. Compare the codes, with unicode-math

\documentclass{scrreprt}
\usepackage{unicode-math}
\usepackage{MnSymbol}

\begin{document}
With unicode-math: $\lsem x \rsem$
\end{document}


and without unicode-math

\documentclass{scrreprt}
%\usepackage{unicode-math}
\usepackage{MnSymbol}

\begin{document}
Without unicode-math: $\lsem x \rsem$
\end{document}


as well as their respective outputs:

Question. How can I fix this and use \lsem and \rsem as inteded?

• MnSymbol is surely incompatible with unicode-math. – egreg Nov 18 '15 at 18:46
• @egreg Ok, what do you suggest? – k.stm Nov 18 '15 at 18:47
• See also the bug report, alas. – Arun Debray Nov 18 '15 at 18:48
• What do you need unicode-math for? Or, conversely, what do you need MnSymbol for? – egreg Nov 18 '15 at 18:49
• @egreg From unicode-math, I use the xits font and I type in some unicode math characters. I use MnSymbols for delimiters and other math symbols I can’t type in directly (actually I’m not sure for what I use MnSymbols – I have made a lot of math definitions a while ago and I don’t know anymore which of them use this package). – k.stm Nov 18 '15 at 18:51

MnSymbol aims at changing all math symbols, using its own. For this it redefines the standard math families to use its fonts. In particular it does

\DeclareSymbolFont{largesymbols}  {OMX}{MnSymbolE}{m}{n}
\DeclareSymbolFont{symbols}       {U}  {MnSymbolF}{m}{n}


but these declarations are later overridden by unicode-math, so when something is using the largesymbols math group, it ends up with a character in the current Unicode math font.

Making the package compatible with unicode-math means changing all symbol definitions using largesymbols and symbols to be different. For getting your \lsem and \rsem, you can do like this:

\documentclass{scrreprt}
\usepackage{MnSymbol}
\usepackage{unicode-math}

\DeclareSymbolFont{MNlargesymbols}{OMX}{MnSymbolE}{m}{n}
\makeatletter
\Decl@Mn@Open {\lsem}{MNlargesymbols}{'102}
\Decl@Mn@Close{\rsem}{MNlargesymbols}{'107}
\makeatother

\begin{document}
With unicode-math: $\lsem x \rsem$
\end{document}


You may need more redefinitions, but they're as easy as these ones: just look for the needed symbol's definition in MnSymbol.sty.

\lsem and \rsem are also available in the XITS font as \lBrack and \rBrack

\documentclass{article}
\usepackage{unicode-math}
\setmathfont{XITS Math}
\begin{document}
$\lBrack x \rBrack$
\end{document}