d with a little line through the top of it

You can create a specific command \dbar for this purpose.

\newcommand{\dbar}{d\hspace*{-0.08em}\bar{}\hspace*{0.1em}}

Full Code

\documentclass{article}
\newcommand{\dbar}{d\hspace*{-0.08em}\bar{}\hspace*{0.1em}}
\begin{document}
$\hbar$, $\dbar$.
\end{document}

produces

enter image description here


There is code in the Comprehensive List of Symbols, but it's wrong: what's suggested is

\newcommand{\dbar}{{\mathchar'26\mkern-12mu d}}

but one needs to compensate the amount of backup, which is larger than the width of the bar by 3mu:

\documentclass{article}

\newcommand{\dbar}{{\mkern3mu\mathchar'26\mkern-12mu d}}

\begin{document}

$32\lambda^2 \dbar_w$

$32\lambda^2 d_w$

$32\lambda^2 \hat{d}_w$

\end{document}

enter image description here

The fact that the width is 9mu is confirmed by the definition of \hbar in Plain TeX:

\hbar:
macro:->{\mathchar '26\mkern -9muh}

Of course, different math fonts may need different amounts of spacing.

A possibly better definition is

\newcommand{\dbar}{{d\mkern-7mu\mathchar'26\mkern-2mu}}

so that the bar doesn't protrude as much on the right:

\documentclass{article}

\newcommand{\dbar}{{d\mkern-7mu\mathchar'26\mkern-2mu}}

\begin{document}

$d\dbar d$

$h\hbar h$

\end{document}

enter image description here


For PDFLaTeX:

As recommended by Sigur. You should load the package lmodern as well as the output will be pixeled with out it.

% arara: pdflatex

\documentclass{article}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\begin{document}
in text \dj{} and math $\textit{\dj}$   
\end{document}

enter image description here


For Lua- or XeLaTeX:

The output is the same as above. You can use the unicode U+0111 or copy paste that symbol directly into your code.

% arara: lualatex

\documentclass{article}
\usepackage{fontspec}

\begin{document}
in text \symbol{"0111}  and math $\textit{\symbol{"0111}}$
\end{document}

The package unicode-math does not contain this symbol yet. It just contains the unicode U+00F0 with the command $\matheth$ which could be an alternative.

You can find fonts that support that symbol on your system by clicking here. Here are some font examples. Choose one and write your macro like \newcommand*{\dbar}{{\fontspec{font_of_your_choice}\symbol{"0111}}}.

% arara: lualatex

\documentclass{article}
\usepackage{fontspec}
\usepackage{booktabs}

\begin{document}
    \begin{tabular}{ll}\toprule
        Font & Example\\\midrule
        Latin Modern & \symbol{"0111}\\
        Code2000 & \setmainfont{Code2000.ttf}\symbol{"0111}\\
        Comic Sans MS & \setmainfont{comic.ttf}\symbol{"0111}\\
        Consolas & \setmainfont{consola.ttf}\symbol{"0111}\\
        DejaVu Sans & \setmainfont{DejaVuSans.ttf}\symbol{"0111}\\
        EB Garamond & \setmainfont{EB Garamond}\symbol{"0111}\\
        Linux Libertine &\setmainfont{Linux Libertine O}\symbol{"0111}\\
        Quivira &\setmainfont{quivira.otf}\symbol{"0111}\\
        XITS &\setmainfont{xits-regular.otf}\symbol{"0111}\\
        \bottomrule
    \end{tabular}
\end{document}

enter image description here