0

In math, # usually denotes the number of elements in a set (cardinality).

For example, in this equation

enter image description here

the #D{x} operator denotes the number of elements in the set D that satisfies property x.

I am trying to render this character in TeX, and this code

$\#D$

gives this symbol:

enter image description here

What am I missing?

siracusa
  • 13,411
JJJohn
  • 556

1 Answers1

1

It seems the font used in the image is Adobe Times/URW Nimbus as provided by the txfonts package (or some very similar variant of it):

\documentclass{article}
\usepackage{txfonts}

\begin{document}
\[ \hat\thetaup_{ijk} = \hat P(X_i=x_{ij}\mid Y=y_k)
    = \frac{\#D\{X_i=x_{ij} \wedge Y=y_k\}}{\#D\{Y=y_k\}} \]
\end{document}

enter image description here


Original answer

The font used in your image is not the default Computer Modern font. You could use \text{\ttfamily\#}, which is closer to the symbol in the image, but still not the same:

\documentclass{article}
\usepackage{amsmath}

\newcommand\tthash{\text{\ttfamily\#}}

\begin{document}
$\#D$ vs. $\tthash D$
\end{document}

enter image description here

Wikipedia also just lists the standard \# as a symbol for cardinality.

For the exact same output, you need to find the font that provides this special hash character glyph.

siracusa
  • 13,411