# Undocumented incompatibility between changes and siunitx? [duplicate]

I am currently using the changes package to track some modifications in a document, along with the siunitx package for number formatting.

Whenever I try to have a \SI{}{} call iside a \replaced{}{} or \deleted{} call, pdflatex throws me an error though the ouput file seems fine.

This issue does not seem to be documented, either in the user manual or on the git repo.

Here is a MWE to illustrate the issue

\documentclass[]{article}
\usepackage{changes}
\usepackage{siunitx}
\begin{document}
This is a new length of \SI{8}{\meter};
This is a new length of \deleted{\SI{8}{\meter}}.
This is a new length of \replaced{\SI{8}{\meter}}{\SI{3}{\meter}}.
\end{document}


Any idea how to remove this error, as it does not seem to impact the result ?

## marked as duplicate by Chris H, Phelype Oleinik, schtandard, Stefan Pinnow, dexteritasJun 12 at 10:27

• I faced exactly this issue myself finalising my thesis, so I knew it had come up before – Chris H Jun 12 at 9:30
• @ChrisH same situation here, thanks for the link. Sometimes it is quite difficult to find the duplicates... – BambOo Jun 12 at 12:28

changes uses internally the ulem package, and this can't handle complicated macros. You normally should hide them in a \mbox:

\documentclass[]{article}
\usepackage{changes}
\usepackage{siunitx}
\begin{document}
This is a new length of \SI{8}{\meter};
This is a new length of \deleted{\mbox{\SI{8}{\meter}}}.
This is a new length of \replaced{\mbox{\SI{8}{\meter}}}{\mbox{\SI{3}{\meter}}}.
\end{document}

• Thanks for your answer. Is there a way to apply such \mbox to all \deleted calls, with a \renewcommand maybe ? – BambOo Jun 11 at 15:02

You can provisionally redefine \SI to use \mbox around it.

\documentclass[]{article}
\usepackage{changes}
\usepackage{siunitx}

\ExplSyntaxOn
\RenewDocumentCommand \SI { o m o m } {
\mbox{
\bool_set_false:N \l__siunitx_font_set_bool
\IfNoValueTF {#1}
{ \__siunitx_combined:nnnn { } {#2} {#3} {#4} }
{
\keys_set:nn { siunitx } {#1}
\__siunitx_combined:nnnn {#1} {#2} {#3} {#4}
}
}
}
\ExplSyntaxOff

\begin{document}

This is a new length of \SI{8}{\meter};
This is a new length of \deleted{\SI{8}{\meter}}.
This is a new length of \replaced{\SI{8}{\meter}}{\SI{3}{\meter}}.

\end{document}


I'd prefer a changes method that avoids striking out (color would be sufficient).

\documentclass[]{article}
\usepackage{changes}
\usepackage{siunitx}

\setdeletedmarkup{\textcolor{red}{#1}}

\begin{document}

This is a new length of \SI{8}{\meter};
This is a new length of \deleted{\SI{8}{\meter}}.
This is a new length of \replaced{\SI{8}{\meter}}{\SI{3}{\meter}}.

\end{document}


• I am flying blind here, but would it not be better to patch changes instead ? The error popped up with siunitx but it may also happen with other commands right. – BambOo Jun 11 at 16:21
• BTW, I just opened an issue on the git repo of the package – BambOo Jun 11 at 16:33
• @BambOo The problem is that mbox can not be broken across lines... that's not a problem for \SI{}{}, but can be for long \deleted{...} phrases... – Rmano Jun 11 at 16:35
• @Rmano I did not see that, you're right ! – BambOo Jun 11 at 16:54