Here is a semi-manual way of doing the kind of decoration you're asking for, based on Overlay
:
strikeThrough[obj_, {width_, height_}] :=
Overlay[{obj,
Graphics[Line[{{0, 0}, {width, height}}],
PlotRange -> {{0, width}, {0, height}},
ImageSize -> {width, height}]}]
strikeThrough[123456, {45, 12}]
The first argument of strikeThrough
is entered as an Inline Cell
(i.e., with Ctrl-9
). The second argument is the width and height of the box that is supposed to be crossed by the diagonal line. This has to be entered manually. The output of this function is an Overlay
that you can now copy. I then started a new display formula and pasted the overlay into it. As you can see, it can be placed anywhere, e.g., in a fraction.
You may also want to add PlotRangePadding -> 1
to the Graphics
above, to avoid having the line appear cut off.
Update: palette version
This creates a palette which can be clicked after highlighting the expression to be struck. It inserts the dimensions of the expression by estimating it from a rasterized copy.
CreatePalette[{Button["Strike it!",
NotebookWrite[InputNotebook[],
OverlayBox[{#, Module[{width, height},
{width, height} =
ImageDimensions[Rasterize[DisplayForm[#]]];
ToBoxes@Graphics[Line[{{0, 0}, {width, height}}],
PlotRangePadding -> 1,
PlotRange -> {{0, width}, {0, height}},
ImageSize -> {width, height}]]}] &[
NotebookRead[InputNotebook[]]]]]}];
With this, you don't have to manually enter the size of the strike-out box, and the replacement is made in-place without the need to copy and paste.
Graphics
in one way or another for that. Mathematica isn't as flexible for typesetting as $\LaTeX$ is... but it does allow combining graphics and other objects. However, it seems you're looking for aGraphics
-free solution, and I don't think there is one. $\endgroup$