3

I have not been able to find a solution to the following problem in the ulem documentation. Could somebody help, please?

When I use a ulem macro to strike through some text in the tabular environment I would like the text to be aligned still. I think the following MWE demonstrates the problem.

Many thanks,

\documentclass{beamer}

\usepackage[normalem]{ulem}
\newcommand\tst{ % thick strike through
  \bgroup
  \markoverwith{\textcolor{red}{\rule[.8ex]{1pt}{0.8pt}}}
  \ULon
}

\begin{document}

\begin{frame}  \frametitle{Meeting Times}
\begin{tabular}{llll}
Lecture Hours: & &\tst{{Tue. 17h00}} & \tst{\emph{S117}}\\
               & & Tue. 14h00  & \emph{KB118}\\
               & & Thu. 16h00  & \emph{S117}\\[.5ex]
Tutorials      & \textbf{3B} & Tue. 10h00 & \emph{SR2027} \\
               & \tst{\textbf{3A}} & \tst{Tue. 14h00} & \tst{\emph{KB118}}\\[.5ex]
\end{tabular}
\end{frame}

\end{document}
3

The way you have written command \tst introduces an unwanted space which breaks column alignment. If you look at ulem manual, will see

\newcommand\cmd{\bgroup \markoverwith{hsomethingi}\ULon}

without any separation before \ULon command. So just change your code to

\newcommand\tst{ % thick strike through
  \bgroup
  \markoverwith{\textcolor{red}{\rule[.8ex]{1pt}{0.8pt}}}% <- add %
  \ULon
}

and your tabular will look well aligned.

enter image description here

If you want to read something else about unwanted spaces, look at (for example):

  • Great. That worked perfectly. Many thanks. – healyp Sep 19 '13 at 14:45

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.