如何写出狄拉克斜线导数的这个变体?

如何写出狄拉克斜线导数的这个变体?

我想写:在此处输入图片描述

有人可以帮我吗?

答案1

在此处输入图片描述

\documentclass{article}

\newcommand{\varDirac}{\mathord{\mathchoice
    {\ooalign{\hfil\raisebox{.4ex}{/}\hfil\cr$\bar\mathcal{D}$\cr}}
    {\ooalign{\hfil\raisebox{.4ex}{/}\hfil\cr$\bar\mathcal{D}$\cr}}
    {\ooalign{\hfil\raisebox{.25ex}{$\scriptstyle/$}\hfil\cr$\scriptstyle\bar\mathcal{D}$\cr}}
    {\ooalign{\hfil\raisebox{.2ex}{$\scriptscriptstyle/$}\hfil\cr$\scriptscriptstyle\bar\mathcal{D}$\cr}}
}}

\begin{document}

$\varDirac$

\end{document}

答案2

这适用于 Computer Modern 字体。其他字体可能需要根据\mathcal{D}斜线的相对大小进行调整。

\documentclass{article}

\makeatletter
\NewDocumentCommand{\vardirac}{}{{\mathpalette\vardirac@\relax}}
\newcommand{\vardirac@}[2]{%
  \begingroup
  \sbox\z@{$\m@th#1\bar{\mathcal{D}}$}%
  \sbox\tw@{\raisebox{\dimeval{(\depth-\height+\ht\z@)/2}}{$\m@th#1/$}}%
  \vphantom{\usebox\tw@}%
  \ooalign{%
    \hidewidth\box\tw@\hidewidth\cr
    \box\z@\cr
  }%
  \endgroup
}
\makeatother

\begin{document}

$\vardirac$ $\scriptstyle\vardirac$

%to show the bounding box
\fboxsep=0pt\fboxrule=0.1pt
\fbox{$\vardirac$}

\end{document}

在此处输入图片描述

答案3

\usepackage{slashed}

$\slashed{\bar D}$
$\slashed{\overline D}$
$\slashed{\mathcal D}$

因为同时拥有 bar 和 mathcal,诡计是需要的。

\usepackage{slashed}% provides \slashed
\usepackage{mathtools}% provides \mathllap
\newcommand\slashedbar[1]{\slashed{#1}\mathllap{\bar{#1}}}
\newcommand\slashedoverline[1]{\slashed{#1}\mathllap{\overline{#1}}}

$\slashedbar{\mathcal D}$
$\slashedoverline{\mathcal D}$

在此处输入图片描述

\documentclass{article}
% See also https://tex.stackexchange.com/q/226181
\usepackage{slashed}% provides \slashed
\usepackage{mathtools}% provides \mathllap
\newcommand\slashedbar[1]{\slashed{#1}\mathllap{\bar{#1}}}
\newcommand\slashedoverline[1]{\slashed{#1}\mathllap{\overline{#1}}}
\begin{document}
$\slashed{\bar D}$
$\slashed{\overline D}$
$\slashed{\mathcal D}$

\verb"\slashed" doesn't work well with \verb"\bar"/\verb"\overline" in conjunction with \verb"\mathcal", so we need the trick with \verb"\mathllap".

$\slashedbar{\mathcal D}$
$\slashedoverline{\mathcal D}$
\end{document}

答案4

\documentclass{article}
\usepackage{stackengine,scalerel}
\newcommand\varDirac{\mathord{\ThisStyle{\ensurestackMath{
  \stackinset{c}{}{c}{}{\SavedStyle/}{\SavedStyle\bar\mathcal{D}}}}}}
\begin{document}
$\varDirac\scriptstyle\varDirac\scriptscriptstyle\varDirac$
\end{document}

在此处输入图片描述

相关内容