6

I was trying to strike through text inside a beamer frame, using package soul and changing color to red. It is inside a tabular, but I've tried outside and couldn't make it work either. I also tried moving the \setstcolor{red} command around, with no success.

I was using the package soul, but any other solutions is fine, as long as it works.

MWE:

\documentclass{beamer}
\mode<presentation>
\usepackage{soul}               % to striketrhourhg text

\begin{document}
\setstcolor{red}
\begin{frame}[c,fragile]

\begin{tabular}{ c c }
     three & four \\
    \st{one} \& \st {two} \\
\end{tabular}

\end{frame}

\end{document}

table

2 Answers2

6

With ulem package.

\documentclass{beamer}
\mode<presentation>
\usepackage[normalem]{ulem}               % to striketrhourhg text
\newcommand\redout{\bgroup\markoverwith
{\textcolor{red}{\rule[0.5ex]{2pt}{0.8pt}}}\ULon}
\begin{document}

\begin{frame}[fragile]
\begin{tabular}{ c c }
     three & four \\
    \redout{one} \& \redout {two} & \\
\end{tabular}

\end{frame}

\end{document}

enter image description here

2

Here's a possible solution if you want to keep using the soul package; the new command \St is overlay aware:

\documentclass{beamer}
\mode<presentation>
\usepackage{soul}               % to striketrhourhg text

\makeatletter
\newcommand\SoulColor{%
  \let\set@color\beamerorig@set@color
  \let\reset@color\beamerorig@reset@color}
\makeatother
\newcommand<>{\St}[1]{\only#2{\SoulColor\st{#1}}}

\setstcolor{red}

\begin{document}

\begin{frame}[c,fragile]
\begin{tabular}{ c c }
     three & four \\
    \St{one} & \St{two} \\
\end{tabular}
\end{frame}

\end{document}

enter image description here

the patch used was the one in Herbert's answer to Why is it that coloring in soul in beamer is not visible.

Gonzalo Medina
  • 505,128