# pdfx causes soul to stop working

I noticed that adding pdfx package to my document stopped the soul package from highlighting the text in yellow.

\documentclass[a4paper,12pt]{article}

\usepackage[a-1b]{pdfx}  % comment this out

\usepackage{color}
\usepackage{soulutf8}

\begin{document}

\hl{TODO}

\end{document}


The example above does not report any errors, but results in non-highlighted text, as shown below. Removing the pdfx package reverts everything to normal behavior.

The order of the packages does not seem to have an immediate effect.

• I didn't encounter any problem when compiling with pdflatex (TeXLive 2018). To help you, we need to know the exact error message or the log file. – Marian G. Dec 13 '19 at 10:57
• What is your TeX-engine? Compiling with XeLaTeX or LuaLaTeX is creating a problem. It needs -shell-escape option in the command. – Niranjan Dec 13 '19 at 11:00
• PDF Engine: pdflatex -synctex=1 -shell-escape -interaction=nonstopmode %.tex TeXLive version: texlive-bin 2019.51075-4 – jureslak Dec 13 '19 at 11:03
• I uploaded the log file here: pastebin.com/2FYtFWtm, and there are not error messages. – jureslak Dec 13 '19 at 11:05

This is due to a long-standing incompability of soul with xcolor (which is loaded by pdfx). See https://tex.stackexchange.com/a/48502/2388

\documentclass[a4paper,12pt]{article}

\usepackage[a-1b]{pdfx}  % comment this out

%\usepackage{color}
\usepackage{soulutf8}
\usepackage{etoolbox}
\makeatletter
\patchcmd{\SOUL@ulunderline}{\dimen@}{\SOUL@dimen}{}{}
\patchcmd{\SOUL@ulunderline}{\dimen@}{\SOUL@dimen}{}{}
\patchcmd{\SOUL@ulunderline}{\dimen@}{\SOUL@dimen}{}{}
\newdimen\SOUL@dimen
\makeatother

\begin{document}

\hl{TODO}

\end{document}