3

I'm preparing for a presentation in which I would like to show some source code with bits struck out. Does anyone know a package that can do that? I've googled but can't find anything.

Here's my MWE, based on the listings package (for listings) and ulem (for the strikeout) albeit in the beamer environment

\documentclass{beamer}
\usepackage{listings}
\usepackage[latin1]{inputenc}
\usepackage{ulem}
\usetheme{CambridgeUS}
\usecolortheme{seahorse}

\title[Test]{Test}
\author{Me}
\institute{Stuff}
\date{\today}
\begin{document}

\lstset{moredelim=[is][\sout]{|}{|}}

\begin{frame}[fragile]{Test}
    \begin{lstlisting}[]

text
    |text|
    \end{lstlisting}
\end{frame}

\end{document}

Unfortunately the strikeout begins from the start of the line as shown below

enter image description here

Update

Putting a single character before the strikeout stops it from being so greedy

\begin{frame}[fragile]{Test}
    \begin{lstlisting}[]

text
    .|You will not pass|
    \end{lstlisting}
\end{frame}

Result

enter image description here

Now if only I could replace the dot with a non printable character.

  • Related?: tex.stackexchange.com/questions/153819/… – Ignasi Jan 22 '16 at 9:06
  • Thanks. I've made some progress with the listings package. – Olumide Jan 22 '16 at 11:17
  • 1
    You're welcome. If you finally manage to get a solution for your question, remember that you can post your own answer. It can be useful for someone else. – Ignasi Jan 22 '16 at 11:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.