I need a D-stroke in Euler, but it doesn't provide one. I've made a decent one with

\DeclareTextCommand{\DJ}{T1}{\raisebox{0.25ex}{-}\kern-0.4em D}

(taking from Why can't I get a D with stroke?), but this way I'm loosing Concrete's proper \DJ.

I know I could just define a different command \DJm instead, but I was wondering if it's possible to let LaTeX make the distinction between text and math and I wanted to ask for some references about \ProvideTextCommand and \DeclareTextCommand.

@Skillmon I've tried

    \raisebox{0.25ex}{-}\kern-0.4em D%

but I get TeX capacity exceeded, sorry [input stack size=5000]. I guess somehow my definition is recursive, but I can't figure out why.

  • 3
    You might test for math mode with \relax\ifmmode<code for math mode>\else<code for text mode>\fi.
    – Skillmon
    Commented Aug 21, 2017 at 18:15
  • 1
    I'd define \mathDJ
    – egreg
    Commented Aug 21, 2017 at 19:20
  • Hi @egreg, that's the kind of definition I meant with \DJm. It solves my problem but I was actually looking for something that wouldn't need a different command for math mode and normal text. Or some references, since I havent found anything googling for \ProvideTextCommand. Commented Aug 21, 2017 at 19:29
  • They are two different things, like \i and \imath
    – egreg
    Commented Aug 21, 2017 at 19:31
  • I know. I don't actually need Concrete's D-stroke since I will only use \DJ in math mode, that is in Euler. My question comes out of mere curiosity. :-) I've searched through interface3 and I haven't found any instance of "\ProvideTextCommand" or "\DeclareTextCommand". So I resorted to asking here. Commented Aug 21, 2017 at 19:35

1 Answer 1


I would define a \mathDJ command, but if you insist…



\newcommand{\mathDJ}{\text{\raisebox{0.25ex}{-}\kern-0.4em$\m@th D$}}


\DJ{} and $\DJ_{\DJ}$


enter image description here

  • Thank you :-) I didn't think it had to be robust. Btw, if you or someone else can drop a link to some documentation for \ProvideTextCommand and \DeclareTextCommand, it'd be really helpful. Commented Aug 21, 2017 at 21:00
  • @ArchStanton You find something about them with texdoc source2e; the commands have been in LaTeX since the release of LaTeX2e
    – egreg
    Commented Aug 21, 2017 at 21:53
  • Just for completeness, the T1 encoding defines \DH and \DJ, plus the lowercase \dh and \dj. \DH and \DJ look identical in the OP's font, but \dh and \dj are different - \dh is like a "partial derivative with a slash" but \dh is an upright lowercase d with a slash.
    – alephzero
    Commented Aug 22, 2017 at 0:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .