[Tex/LaTex] Strikethrough command in LaTeX

strikeoutulem

I am trying to have as strikethrough text using base LaTeX command and up till now there is no solution available except the use of some packages, i.e, ulem and cancel. Is there any other way to get a strikethrough without using any package? As this is for a learning management system and I don't know how to add packages there, also if I use a command which is not of base LaTeX it gives an error message of undefined sequence. Your help will be greatly appreciated

Best Answer

Here is a strikethrough macro using no packages. Basically you measure the length of the argument and \rlap a \rule of the same length.

enter image description here

You can adjust the height of the \rule by changing the [.5ex] and adjust its thickness by changing the {.4pt}. Here is the code:

\documentclass{article}

\newlength{\wdth}

\newcommand{\strike}[1]{\settowidth{\wdth}{#1}\rlap{\rule[.5ex]{\wdth}{.4pt}}#1}

\begin{document}

Hello \strike{their} there.

\end{document}
Related Question