I want to color my text and followed this sample code. Now I have
\documentclass[a4paper,11pt]{article}
\usepackage[a4paper,includeheadfoot,margin=2.54cm]{geometry} % for margins on a A4paper
\usepackage{xcolor} % for highlighting AND background images-color!!!
\usepackage{soul} %for usage of style attributes - background color
\newcommand{\cText}[3][RGB]{%
\begingroup
\definecolor{hlcolor}{#1}{#2}\sethlcolor{hlcolor}%
\hl{#3}%
\endgroup
}
\definecolor{RGB2}{RGB}{35, 111, 161}
\definecolor{HTML3}{HTML}{bfedd2}
\soulregister\LARGE7
\begin{document}
Test z% translated tag: span
{\cText[HTML]{7e8c8d}
{wecks U
% {\LARGE{}msetzung von größeren } % [2] <== not working
% {\color{HTML3}{}
{\LARGE{}HTML}
% Text
% }-Entities \&<
}
}
\end{document}
As soon as I try to uncomment [2] I get the error Package soul Error: Reconstruction failed The same applies for uncommenting the other following lines.
What to do better? Or is there a better approach to color text - especially when the size and background might change?
\hl->\highLightand\sethlcolor->\LuaULSetHighLightColor(and remove\soulregister\LARGE7). Tada! https://gist.github.com/moewew/af743d98e157a45a7331a1ad926b3787 – moewe Jun 02 '20 at 15:56\LuaULSetHighLightColoryou can also use\highLight[{[#1]{#2}}]{#3}. – Marcel Krüger Jun 02 '20 at 15:58