14

I am using \sout from the ulem package together with beamer to strike through some text:

\documentclass[mathserif]{beamer}
\usepackage{ulem}
\begin{document}
\begin{frame}
  Next meetings: 
  \begin{itemize}
    \item \sout{22.01.2016} (cancelled) 
    \item 28.01.2016
  \end{itemize}
\end{frame}
\end{document}

However, I would like to have the line a bit thicker because it's so thin that people might miss it. How is that possible?

2 Answers 2

17

The ulem source states that:

To draw a line through text instead of under it (strike out) do under-line with negative depth.

So, the thickness of the strike is the same as that of the underline. From the ulem package documentation:

The thickness of the underline rule is given by the command macro \ULthickness; use \renewcommand (not the usual \setlength) to change it.

So, writing:

\documentclass[mathserif]{beamer}
\usepackage{ulem}
\newcommand{\soutthick}[1]{%
    \renewcommand{\ULthickness}{2.4pt}%
       \sout{#1}%
    \renewcommand{\ULthickness}{.4pt}% Resetting to ulem default
}
\begin{document}
\begin{frame}
  Next meetings: 
  \begin{itemize}
    \item \soutthick{22.01.2016} (cancelled)
    \item \sout{22.01.2016}
    \item 28.01.2016
  \end{itemize}
\end{frame}
\end{document}

you will get:

enter image description here

2
  • 1
    Hm, so there's no easy way to adjust the width for \sout without changing the thickness for underlines? Jan 14, 2016 at 15:15
  • @fuenfundachtzig Sorry for the late response. Apparently no! I updated my answer to make a new command with different line thickness.
    – jak123
    Jan 17, 2016 at 9:29
7

You can exploit the fact that \sout opens a group, so any assignment to \ULthickness will be local.

\documentclass[mathserif]{beamer}
\usepackage{ulem,xpatch}

\xpatchcmd{\sout}
  {\bgroup}
  {\bgroup\def\ULthickness{2pt}}
  {}{}

\begin{document}
\begin{frame}
  Next meetings:
  \begin{itemize}
    \item \sout{22.01.2016} (cancelled)
    \item \uline{28.01.2016}
  \end{itemize}
\end{frame}
\end{document}

enter image description here

4
  • i don't know why, but this doesn't work for me. the other answer does work.
    – abcd
    Mar 7, 2018 at 22:27
  • @dbliss I tried it again on a fresh file and it works.
    – egreg
    Mar 7, 2018 at 22:29
  • @dbliss It's silly to downvote a working solution; are you using exactly the same example? If you're integrating it in another document there are several other factors that can influence the result. No information, no clue for helping you.
    – egreg
    Mar 7, 2018 at 22:54
  • To overwrite \sout's \bgroup but without using the xpatch package or \xpatchcmd, use \def to redefine the meaning of \sout like this: \def\sout{\leavevmode \bgroup\def\ULthickness{2pt}\ULdepth=-.55ex \ULset}. This modifies line 257 of ulem.sty, dated 2019-11-18.
    – possum
    Jul 21, 2023 at 3:32

You must log in to answer this question.

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