I want to strike through text with a simple line. Unfortunately, in the solution(s) I found, the text always has a larger distance to the next line (see example).
How can I strike through text without increasing the distance to the next line?
\documentclass[12pt]{beamer}
\usepackage{amsmath,amssymb,amsthm}
\usepackage{lmodern}
\usepackage[english]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[normalem]{ulem}
\newcommand\tst{% thick strike through %% from http://tex.stackexchange.com/questions/134088/mis-alignment-of-columns-in-tabular-environment-when-using-ulem-and-beamer
\bgroup%
\markoverwith{\textcolor{red}{\rule[.8ex]{1pt}{0.8pt}}}%
\ULon%
}
\begin{document}
\begin{frame}
\begin{align*}
P = \{ & \tst{S\rightarrow X_{1,4,2}}\\
& X_{1,4,1}\rightarrow X_{1,1,1}X_{2,3,1},\\
& X_{1,4,1}\rightarrow X_{1,1,1}X_{2,3,1}\}
\end{align*}
\end{frame}
\end{document}
Best Answer
I used
soul
to do the strikethrough, but had to define adisplayst
command to do strikethrough in display math mode. (soul
commands only work with math as in\st{$abc$}
. . . ) I also used the solution from Why is it that coloring in soul in beamer is not visible to make the color work. Use\setul{⟨underline depth⟩}{⟨underline thickness⟩}
to change thickness of underline/strikethrough insoul
.–Result:
Edit
I guess making this work nicely with
soul
required fixing a few things. The original solution I posted strikes behind the text, instead of on top of it, but this was solved in Strikeout in different color appears behind letters, not on top of themResult: