2

The last time I asked about blackboard bold greek letters and the answers given opened up to me a new world of possibilities. So I'm just having fun with \mathb command (that is exactly the \mathbb defined in the main answer, just renamed that way to still be able to use the original \mathbb), using it with every sign that should represent a matrix; for example I'm using $\slashed{\mathb{p}}$ instead of the usual $\slashed{p}$ in the Dirac slashed notation (here a question about the way to write the slash)

But I have a problem: now I want to write $\slashed{\mathb{\partial}}$ but this error message appears

! Missing \endcsname inserted.
<to be read again> \partial 
l.20142 $\slashed{\mathb{\partial}}$

What can I do? Thanks!

1 Answer 1

2

Here is a manual way to do it...save the intermediate result in a box and apply \slashed to the box. The trick now is to redefine \mathb to have this way, perhaps, as the default.

\documentclass{article}
\usepackage{xcolor,slashed}
\input pdf-trans
\newbox\qbox
\def\usecolor#1{\csname\string\color@#1\endcsname\space}
\newcommand\bordercolor[1]{\colsplit{1}{#1}}
\newcommand\fillcolor[1]{\colsplit{0}{#1}}
\newcommand\outline[1]{\leavevmode%
  \def\maltext{#1}%
  \setbox\qbox=\hbox{\maltext}%
  \boxgs{Q q 2 Tr \bbthickness\space w \fillcol\space \bordercol\space}{}%
  \copy\qbox%
}
\newcommand\mathb[1]{\outline{$#1$}}
\newcommand\textbb[1]{\outline{#1}}
\newcommand\colsplit[2]{\colorlet{tmpcolor}{#2}\edef\tmp{\usecolor{tmpcolor}}%
  \def\tmpB{}\expandafter\colsplithelp\tmp\relax%
  \ifnum0=#1\relax\edef\fillcol{\tmpB}\else\edef\bordercol{\tmpC}\fi}
\def\colsplithelp#1#2 #3\relax{%
  \edef\tmpB{\tmpB#1#2 }%
  \ifnum `#1>`9\relax\def\tmpC{#3}\else\colsplithelp#3\relax\fi
}
\bordercolor{black}
\fillcolor{white}
\newcommand\bbthickness{.15}
\begin{document}
$\sbox0{$\mathb{\partial}$} \slashed{\copy0}$
\end{document}

enter image description here

5
  • 1
    Wow! Now I would have stayed one million years to do it ahah Thanks a lot
    – Rob Tan
    Sep 28, 2020 at 18:56
  • @Rob I am agree with your comment :-)
    – Sebastiano
    Sep 28, 2020 at 19:31
  • Just a very basic question. With commands like '\tensor' (ctan.org/pkg/tensor) I can do '\tensor{A}{^a_b}', but I theoretically cannot do '\tensor{A_1}{^a_b}' due to the subscript '_1' following 'A'; but I cheat on this and I write '\tensor{{A_1}}{^a_b}' and so the added curly brakets create like a "box" inside which there is 'A_1' and now the command works! Why I cannot do the same with '\slashed'? So in this case something like '\slashed{{\mathb{\partial}}}' wouldn't work.
    – Rob Tan
    Sep 29, 2020 at 6:17
  • 1
    @Rob Every macro has it's own way of performing it's magic. Sometimes, a group is sufficient to overcome a problem, sometimes not. However, a group {} is not the same thing as a box. Sep 29, 2020 at 9:35
  • Ok thank you I didn't know the difference
    – Rob Tan
    Sep 29, 2020 at 10:49

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.