8

I'm having trouble with the soul package and its \hl command. The soul package's manual says I should not nest soul commands, which I didn't. \textsc works inside \hl. However, the following throws an Argument of \name has an extra } error:

\documentclass[a4paper,12pt,]{scrreprt}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{soulutf8}
\usepackage{color}

\newcommand{\name}[1]{\textsc{#1}}

\begin{document}
% this one works
Hello \hl{\textsc{Calvin}}!

% this one will throw an error, with both soul and soulutf8
Hello \hl{\name{Calvin}}!
\end{document}

Am I missing something in the way that \newcommand works? Is this a known problem with the soul package? Any other suggestions for highlighting text - which may be longer and thus needs to be wrapped?

Thanks for your reply.

Gonzalo Medina
  • 505,128

1 Answers1

8

See the documentation of soul "Adding font commands" (page 15).

\soulregister{\name}{1}
Ulrike Fischer
  • 327,261