[tex-eplain] Strike out in TeX
Guy Worthington
guyw@multiline.com.au
21 Mar 2001 11:13:12 +0800
> if you want to strike out each letter individually
The algorithm comes from a pretty-printing macro package called
c_pascal. A quick search of CTAN has it at macros/generic/c_pascal.
%-test.tex-----------------------------------------------------------
\newcount\CharCode
\newif\ifDigit
\newif\ifPunctuation
\def\isDigit#1{%
\Digitfalse
\ifnum `\/ < #1\relax
\ifnum `\: > #1\relax \Digittrue \fi \fi
\ifDigit}
\def\isPunctuation#1{%
\fi% matches \ifDigit...\else...\fi
\Punctuationfalse
\ifnum `\, = #1\relax \Punctuationtrue \fi
\ifnum `\. = #1\relax \Punctuationtrue \fi
\ifPunctuation}
\def\Strike#1{%
\expandafter\ReadChar#1}
% the argument is a single number
\def\ReadChar#1{%
\let\WhatNext = \ReadChar%
\global\CharCode = `#1\relax%
\isDigit{\CharCode}/\llap#1%
\else \isPunctuation{\CharCode}#1%
\else #1\relax \let\WhatNext = \relax \fi%
\WhatNext}
Here is a number in text mode: \Strike{123,456,789.01}\ (don't forget
the space after the macro).
Here is a number in math mode: $\Strike{123456}$.
\bye
%------------------------------------------------------------