Text FormattingColored Strikeout

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
auvajs
Posts: 22
Joined: Wed Dec 21, 2011 11:21 pm

Colored Strikeout

Post by auvajs »

My LyX uses this command for striking-out text:

Code: Select all

\sout{text}
What to do if I want the striking line be red (or any other color?) For colors I am using this package:

Code: Select all

\usepackage[usenames,dvipsnames]{xcolor}
Last edited by auvajs on Tue Jan 24, 2012 5:23 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Colored Strikeout

Post by cgnieder »

You could use the soul package:

Code: Select all

\documentclass{article}
\usepackage{soul,xcolor}
\begin{document}
\setstcolor{red}
\st{Text}
\end{document}
Or you could use the ulem package and define your own command:

Code: Select all

\documentclass{article}
\usepackage[normalem]{ulem}
\newcommand\redout{\bgroup\markoverwith
{\textcolor{red}{\rule[.5ex]{2pt}{0.4pt}}}\ULon}
\usepackage{xcolor}
\begin{document}
\redout{text}
\end{document}
site moderator & package author
auvajs
Posts: 22
Joined: Wed Dec 21, 2011 11:21 pm

Re: Colored Strikeout

Post by auvajs »

Thank you!
Post Reply