1

I am using Soul to mark the change to my manuscript in Overleaf, but it won't work for equations, like

\documentclass[12pt]{article}
\usepackage{soul}
\setstcolor{red} 

\begin{document}
\begin{equation}
\st{E = mc^3} E=mc^2  
\end{equation}
\end{document}

what I want to see is an overstrike on E = mc^3, followed by E = mc^2

Thanks

9
  • Let me guess: they are looking for something to mark revisions on a document.
    – Rmano
    Jul 18, 2023 at 15:58
  • @Rmano yes, you are right Jul 18, 2023 at 16:07
  • 3
    @majordoctor: Please update your post with a more direct description of what you want; not just a "I've tried this and it doesn't work" without much context. It'll remove the guesswork from the audience. Can you do that?
    – Werner
    Jul 18, 2023 at 16:26
  • 2
    Welcome. // Can you please post code, which compiles, once we copied? It‘s not much, that‘s missing, but it‘s annoying to guess where you can easily EDIT … Thank you.
    – MS-SPO
    Jul 18, 2023 at 17:48
  • 1
    @MS-SPO, I added. I tried, but the error is missing $$ even in equation mode Jul 18, 2023 at 18:40

1 Answer 1

2

Use the ulem and xcolor packages and define a new command as described here.

MWE:

\documentclass{article}
\usepackage{ulem}
\usepackage{xcolor}

\makeatletter
\newcommand\rst{\bgroup\markoverwith{\textcolor{red}{\rule\[0.6ex\]{10pt}{1pt}}}\ULon}
\makeatother

\begin{document}

\rst{Red line through this} but not through this.

\rst{$E=mc^3$} $E=mc^2$

\end{document}

Don't forget to wrap your equations in math mode.

enter image description here

2
  • Sorry, what are wrap equations? I am encountering the error: Missing } inserted. LaTeX Error: Bad math environment delimiter. Missing number, treated as zero. Missing $ inserted. Extra }, or forgotten $. Illegal unit of measure (pt inserted). Missing $ inserted. Jul 18, 2023 at 21:48
  • @majordoctor Your equations should have the math delimiters on either side. So "$E=mc^3$" not "E=mc^3" Jul 19, 2023 at 17:07

Not the answer you're looking for? Browse other questions tagged .