# Why can't I get a D with stroke?

The Comprehensive Latex Symbol list tells me that I can't get Đ with OT1 using the command \DJ, and that I need T1 font encoding. When I use [T1]{fontenc} in the preamble, this doesn't work either.

So how do I get Đ?

-
It works on my machine. Please edit your question and add an example code that reproduces the problem. Without this it will be difficult for anyone to help you. – Ian Thompson Dec 4 '12 at 21:31
Works on my machine. Are you sure you called \usepackage[T1]{fontenc}  – A.Ellett Dec 4 '12 at 21:33
As well, try \usepackage{lmodern} and possibly, \usepackage[utf8]{inputenc} and then directly the symbol Đ as it appears in the question. – yo' Dec 4 '12 at 22:24

A minimal example producing your symbol (D stroke, unicode U+0110) is

\documentclass{article}

\usepackage[T1]{fontenc}
\begin{document}
\DJ
\end{document}


Should there be some reason you do not wish to load T1 fonts, you can provide a reasonable fake in OT1 encoding with

\documentclass{article}

\ProvideTextCommand{\DJ}{OT1}{\raisebox{0.25ex}{-}\kern-0.4em D}

\begin{document}
\DJ
\end{document}


which scales will in other point sizes thanks to @egreg pointing out than one can use ex and em units. Note that \newcommand will not work in this situation because \DJ is defined for the T1 encoding.

Edit: as Ari Brodsky points out, the AMS classes define a fake \DJ command (and thorns) for OT1 encoding. The definition is equivalent to:

\ProvideTextCommand{\DJ}{OT1}{\leavevmode\raisebox{-.5ex}{\makebox[0pt][l]{\hskip-.07em\accent"16\hss}}D}


producing

You might want to experiment with the value of the \hskip in this definition to adjus the horizontal position of the bar.

-
You could use ex and em based length, so the constructions would be independent of the font size. – egreg Dec 7 '12 at 15:09
it looks like the cross on the T1 D stroke is more like an en-dash. possibly changing the - in the OT1 compound to -- with perhaps a bit of adjustment in the shifting would look more like the pre-composed one. – barbara beeton Dec 7 '12 at 21:43
@barbarabeeton The length of the T1 version is somewhere between that of an ordinary dash and an en-dash. For real fine adjustment one can use an \hrule. – Andrew Swann Dec 8 '12 at 12:23
There is also a faked version defined by the AMS document classes; see page 78 of amsclass.pdf (version 2.20.1): \DeclareTextCommand{\DJ}{OT1}{% \leavevmode\raisebox{-.5ex}{\makebox[\z@][l]{\hskip-.07em\accent"16\hss}}D} – Ari Brodsky Feb 25 '14 at 17:18
@AriBrodsky Interesting. I have added this to my answer. – Andrew Swann Feb 26 '14 at 9:19