# Tag Info

5

Using \ttfamily outside of the soul macro works: \documentclass[oneside,article]{memoir} \usepackage{soul} \usepackage{pgfplots} \usepackage{ragged2e} \newcommand\code[1]{{\ttfamily \hl{#1}}} \definecolor{mygrey}{cmyk}{0,0,0,0.05} \sethlcolor{mygrey} \begin{document} \noindent I want to have my code examples show up with not only \code{\textbackslash ...

5

As all the solutions so far do not allow a highlight to span several lines, I'd like to present a version that will also work with listing's breaklines option. The idea is based on the one I've used in this answer, which in turn is based on Ben's improvement of Ulrike's version that uses TikZ' remember picture facilities. In short, the whole highlight is ...

4

\documentclass{standalone} \usepackage{soul} \usepackage{xcolor} \setstcolor{red} \begin{document} \st{I want to strike out this sentence} using a red line and I want to replace it with this. \end{document}

4

It's very unfortunate that the author of soul misunderstood the usage of \x, which should be \begingroup\edef\x{\endgroup<material>}\x instead of \edef\x{<material>}\x The former only redefines \x in a group and a possible definition of \x is irrelevant; when the redefined \x is executed, the group ends and the redefinition vanishes. You can ...

3

You can just define a new command using \newcommand\macroname[<arg count>]{<replacement>} (arguments are used by #<num>, up to 9 arguments are supported), to get an a bit more powerful interface you can load the xparse package and use \NewDocumentCommand. The following defines a macro that takes a mandatory argument, followed by an optional ...

3

You can let soul expand by removing the braces: \documentclass[10pt]{article} \usepackage{soul} \def\qwerty{happy new year} \begin{document} \ul{happy new year} \ul\qwerty \end{document}

3

\documentclass[10pt]{article} \usepackage{soul} \def\qwerty{happy new year} \begin{document} \ul{happy new year} \expandafter\ul\expandafter{\qwerty} \end{document}

3

Just set the wished color with command \setstcolor{red}. So with the following code \documentclass{standalone} \usepackage{soul} \setstcolor{red} % <==================================================== \usepackage{xcolor} \begin{document} \st{I want to strike out this sentence} using a red line and I want to replace it with this. \end{document} ...

3

You can try a command like this: \documentclass{report} \usepackage{ulem} \usepackage{xcolor,tikz} \textwidth 2cm \begin{document} \newcommand\reduline{% \bgroup\markoverwith {\textcolor{red}{\pgfsetfillopacity{0.2}\rule[-0.5ex]{2pt}{10pt}\pgfsetfillopacity{1}}% \textcolor{red}{\llap{\rule[0.4ex]{2pt}{0.4pt}}\llap{\rule[0.7ex]{2pt}{0.4pt}}}% }% \...

3

The command \ul is defined as \SOUL@ulsetup\SOUL@. The first command sets up some commands that will be later delivered after a group has started and is of no concern here. The macro \SOUL@ is defined as % soul.sty, line 99: \def\SOUL@{% \futurelet\SOUL@@\SOUL@expand } which means that the following token is looked up and stored in \SOUL@@; then \SOUL@...

2


2

soul uses the name \x internally as a scratch command to temporarily store stuff all over the place. (Just search for \x or \edef\x in http://mirrors.ctan.org/macros/latex/contrib/soul/soul.dtx.) The way the package is written there is little to no chance to get it to stop doing that easily (short of replacing every occurence of \x in the source with \soul@...

2

Since the question clearly references the answer at this question: Line break in texttt, I'll take a stab. For whatever reason, the use of \hl inside of the revised \texttt causes truncation by the amount of special/active characters (/, [, .) inside the string. The only solution is to pad the input string by that number of extra tokens, so that \hl eats ...

1

As a variant of §22 of the soul documentation, you can put the content in a savebox before highlighting/underlining it. This means that linebreaks will not work but otherwise it works fine. MWE, showing a manual savebox and a new command \hlu that performs the box operations: \documentclass{amsart} \usepackage{accents} \usepackage{soul} \newsavebox{\...

1

I think you can use setspace package, see here: increase vertical space between lines. But I'm not sure to understand what you're asking. \documentclass{article} \usepackage{soul} \usepackage{setspace} \begin{document} I don't understand if you intend something like this: \begin{spacing}{8} \setul{10ex}{} BIRD BIRD \ul{...

Only top voted, non community-wiki answers of a minimum length are eligible