11

I've searched both online and in the TexBook, but can not find a command or package.

Note, I am pretty new to TeX / LaTeX, but am currently trying to figure out how to do things in Plain TeX.

Edit: Thanks for all the answers, but I realized that my question was ambiguous because I used the word "strikeout" which is commonly associated with the horizontal line. I am actually looking for the diagonal strikeout, like the one here, except for Plain TeX. How to strike through obliquely, e.g. to indicate cancellation?

Also, I am looking for a solution that works in Math mode.

10

Package ulem

Timebandit had written a solution with package ulem. The example was given as LaTeX, but the package also works with plain TeX:

\input ulem.sty

\sout{Hello World}

\bye

Result

Package soul

Another LaTeX package soul can be used with plain TeX:

\input soul.sty

\st{Hello World}

\bye

Result

  • Note: the ulem package redefines the \em macro. You may need to fix that if you use it elsewhere in your document. – Ethan Bolker Jan 14 '13 at 21:53
  • @EthanBolker For the old behaviour of \em the package provides \normalem. – Heiko Oberdiek Jan 14 '13 at 23:11
7

this technique has been used for years for maintenance of the tug bylaws. it's really only good for short phrases, and won't break at the end of a line; also, the spaces between words are "frozen". but if those restrictions fit your application, then it works reliably.

\newbox\TestBox
\def\Remove #1 {\setbox\TestBox=\hbox{#1}%
        \leavevmode\rlap{\vrule height 2.5pt depth-1.75pt width\wd\TestBox}%
        \box\TestBox\ }
\def\0{\Remove}
\def\Replaceby #1{{\bf #1}}
\def\1{\Replaceby}

\0{Remove this text.}

\1{Replace it by this text}.

\bye

enter image description here

5

If you are using one of the newer Unicode based TeX engines (xetex or luatex) an alternative method would be to use Unicode combining characters to get the strike. The effect then depends on the font you used, I have to say I was a bit disappointed with the result with Arial, but here it is:

enter image description here

\font \tenrm="[Arial]"
\tenrm


O̶h̶ ̶n̶o̶ ̶I̶ ̶d̶i̶d̶ ̶i̶t̶ ̶w̶r̶o̶n̶g̶!̶


\bye

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.