1

I am attempting to use soul and xcolor to highlight some of my text but as you can see in the image it does not seem to cover the whole text.

enter image description here

The line is Service agents must be able to \hl{\mbox{create}} an account

If I try to remove mbox so it becomes Service agents must be able to \hl{create} an account it will look like this: enter image description here

How can I fix this so it covers the entire text?

Document:

  
%Preamble
\usepackage{pdfpages}
\usepackage[T1]{fontenc}
\usepackage[utf8x]{inputenc}
\usepackage{color}
\usepackage{xcolor}
\usepackage{float}
\usepackage{soul}

% Main.tex \documentclass[a4paper,twoside,11pt]{report} \input{Setup/Statics.tex} \input{Setup/Preamble.tex} \input{Setup/Settings.tex}

\begin{document}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \pagenumbering{arabic} \input{Chapters/06_Design} \clearpage %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\printbibliography[title={Bibliography}] \clearpage \appendix \input{Backmatter/Appendix.tex} \cleartoleftpage

\end{document}

% Inside Design document \begin{longtable}{|p{1cm}|p{4cm}|p{10cm}|} \caption{Noun and verb analysis} \hline ID & Requirement & Description \ \hline \textbf{FR1} & Create account & Service agents must be able to \hl{create} an account \ \hline \end{longtable}

%Settings.tex % Colours! \newcommand{\targetcolourmodel}{cmyk} \selectcolormodel{\targetcolourmodel}

\definecolor{dtured} {rgb/cmyk}{0.6,0,0 / 0,0.91,0.72,0.23} \definecolor{blue} {rgb/cmyk}{0.1843,0.2431,0.9176 / 0.88,0.76,0,0} \definecolor{brightgreen}{rgb/cmyk}{0.1216,0.8157,0.5098 / 0.69,0,0.66,0} \definecolor{navyblue} {rgb/cmyk}{0.0118,0.0588,0.3098 / 1,0.9,0,0.6} \definecolor{yellow} {rgb/cmyk}{0.9647,0.8157,0.3019 / 0.05,0.17,0.82,0} \definecolor{orange} {rgb/cmyk}{0.9882,0.4627,0.2039 / 0,0.65,0.86,0} \definecolor{pink} {rgb/cmyk}{0.9686,0.7333,0.6941 / 0,0.35,0.26,0} \definecolor{grey} {rgb/cmyk}{0.8549,0.8549,0.8549 / 0,0,0,0.2} \definecolor{red} {rgb/cmyk}{0.9098,0.2471,0.2824 / 0,0.86,0.65,0} \definecolor{green} {rgb/cmyk}{0,0.5333,0.2078 / 0.89,0.05,1,0.17} \definecolor{purple} {rgb/cmyk}{0.4745,0.1373,0.5569 / 0.67,0.96,0,0}

\definecolor{verde} {rgb}{0.25,0.5,0.35} \definecolor{jpurple} {rgb}{0.5,0,0.35} \definecolor{darkgreen} {rgb}{0.0, 0.2, 0.13}

\colorlet{frontbackcolor}{blue}

1 Answers1

0

The problem occurs due to an incompatibility between older version of the soul and the xcolor package as described here. The problem can be solved by updating the relevant packages to the latest version.

Alternatively, you can add the following code right after having loaded the soul package:

\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

As for your code, note that you need to add \\ after \caption{} inside a longtable environment if you want to typeset the caption above the table. So, to provide a full and compilable MWE:

\documentclass{report}

%Preamble \usepackage{longtable} \usepackage{xcolor} \usepackage{soul}

%%%%% the following is not needed with an up-to-date version of the soul package \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 %%%%%

% Colours! \newcommand{\targetcolourmodel}{cmyk} \selectcolormodel{\targetcolourmodel}

\definecolor{yellow} {rgb/cmyk}{0.9647,0.8157,0.3019 / 0.05,0.17,0.82,0}

\begin{document}

% Inside document \begin{longtable}{|p{1cm}|p{4cm}|p{10cm}|} \caption{Noun and verb analysis}\ \hline ID & Requirement & Description \ \hline \textbf{FR1} & Create account & Service agents must be able to \hl{create} an account \ \hline \end{longtable}

\end{document}

enter image description here