Warning "Command \underbar has changed"

You have really nothing to worry about, provided you don't use sectsty for underlining section titles.

The package does a check on \underbar and on \underline, because it wants to redefine them but it just does so when typesetting those titles.

So, if you don't use underlining (and you're better not to), there should be no problem.

Something actually can be done to fully disable those redefinitions (only risky if you happen to use \underbar in a section title, actually).

\documentclass{article}

\usepackage{amsmath}
\usepackage{unicode-math}
\usepackage[english,greek]{babel}
\usepackage[immediate]{silence}
\WarningFilter[temp]{latex}{Command} % silence the warning
\usepackage{sectsty}
\DeactivateWarningFilters[temp] % So nothing unrelated gets silenced

\makeatletter % disable the runtime redefinitions
\let\[email protected]\relax
\let\[email protected]\relax
\makeatother

\setmainfont[
    UprightFont = *,
    BoldFont = *Bold,
    ItalicFont = *It,
    BoldItalicFont = *BoldIt,
    Extension = .otf,
    Ligatures = TeX,
]{GFSArtemisia}
\setsansfont{GFSArtemisia.otf}
\setmathfont{latinmodern-math.otf}

\sectionfont{\RaggedRight}


\begin{document}

Text

\end{document}

The warning is caused by a check sectsty runs on the definition of \underbar. If it doesn't match one of the definitions it expects, it warns you.

You can avoid this warning but I don't recommend it. The warning is telling you something important: that sectsty has found a definition of \underbar which is not what it expects and that things may not work properly.

In truth, I would recommend not using sectsty with LuaTeX/XeTeX. In particular, I wouldn't use it with unicode-math.

If you insist, for LuaTeX, you can avoid that particular warning by loading the package earlier. For XeTeX, you can avoid that warning by loading the package earlier.

For example,

\documentclass{article}
\usepackage{sectsty}
\usepackage{amsmath}
\usepackage{unicode-math}
\usepackage[english,greek]{babel}
\usepackage{fontspec}
\setmainfont
[
    UprightFont = *,
    BoldFont = *Bold,
    ItalicFont = *It,
    BoldItalicFont = *BoldIt,
    Extension = .otf,
    Ligatures = TeX,
]{GFSArtemisia}
\setsansfont
[
    Ligatures = TeX,
]{GFSArtemisia.otf}
\setmathfont{latinmodern-math.otf}
\sectionfont{\RaggedRight}
\begin{document}

Text

\end{document}

However, I get other warnings with LuaTeX.

Tags:

Warnings