Advertisement
Guest User

Red strikethrough line behind text

a guest
Feb 24th, 2021
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Latex 0.63 KB | None | 0 0
  1. \documentclass{article}
  2. \usepackage{xcolor}
  3. \makeatletter
  4. \newcommand{\linethrough}{\mathpalette\@thickbar}
  5. \newcommand{\@thickbar}[2]{%
  6.     \textcolor{red}{
  7.     {\mkern0mu\vbox{
  8.    \sbox\z@{$#1\textcolor{black}{#2}\mkern-1.5mu$}%
  9.     \dimen@=\dimexpr\ht\tw@-\ht\z@+2\p@\relax % The +2 represents the vertical shift of the line.
  10.     \hrule\@height0.5\p@ % The 0.5 represent the thickness on the line.
  11.     \vskip\dimen@
  12.     \box\z@}}#1}
  13. }
  14. \makeatother
  15. \newcommand{\mathstrike}[1]{\ensuremath{\linethrough{#1}}}
  16.  
  17. \begin{document}
  18.    \mathstrike{f(x) = x^2},\qquad \mathstrike{c_0}, \qquad \mathstrike{f(x) = x^2 + c_0}
  19. \end{document}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement