Here is a palette that does the slashing when you select a character and press the button:
CreatePalette[{Button["Slash it!",
NotebookWrite[InputNotebook[],
Replace[FromCharacterCode[
Join[ToCharacterCode[
ToString[NotebookRead[InputNotebook[]]]], {824}]],
FromCharacterCode[{8706, 824}] :>
OverlayBox[{"\<\[PartialD]\>", "\</\>"}]]]]}];
It uses the unicode character for a combining solidus (824
). This adds the slash to whatever character is printed in front of it.
Edit
Because operators such as $\partial$ don't allow combining marks in Mathematica, I had to add special treatment for $\partial$ in the form of an OverlayBox
. All I do is look for the result of the unicode combination to contain the sequence of characters corresponding to $\partial$ and the combining solidus, then replace that particular combination by an overlay. Using an Overlay
in all cases may also be workable, but I thought it's better to rely on the alignment provided by the built-in Unicode functionality.
Edit 2
While the above palette yields (I think) a cleverer representation of most slashed characters based on the Unicode standard, it doesn't seem to work on all platforms (it does work on Mac). Therefore, here is a simpler version that uses only OverlayBox
es:
CreatePalette[{Button["Slash it!",
NotebookWrite[InputNotebook[],
OverlayBox[{"\<" <> ToString[NotebookRead[InputNotebook[]]] <>
"\>", "\</\>"}]]]}];
To use either of these palettes, select the desired character in the notebook, hit the button, and you're done.