[Tex/LaTex] How to get a better pound symbol (number sign, hash character) “#”

fontsizesymbols

The default pound sign is large and goes below the baseline.

I think it's rather ugly, and I'd like to shrink it. Other people have suggested using \texttt, but I use monospacing a lot in the document, and it would look like it's supposed to be highlighted as code if I monospaced the (#), which it's not. I also don't like the output of that either.

How can I shrink it to be as tall as a regular capital?

These are all the packages I'm using that affect font output:

\documentclass[oneside,11pt]{memoir}

\usepackage[T1]{fontenc}    
\usepackage{lmodern}        
\usepackage{inconsolata}    % preferred monospaced font 
\begin{document}
X \# \texttt{\#} X % "X" to denote size of capital letters
\end{document}

Best Answer

As Latin Modern seems to be your preferred font family, the definition of \mypound used in the example below may be what you're looking for.

enter image description here

\documentclass[oneside,11pt]{memoir}
\usepackage[T1]{fontenc}    
\usepackage{lmodern}        
\usepackage{graphicx} % for \scalebox and \raisebox macros
\newcommand\mypound{\scalebox{0.8}{\raisebox{0.4ex}{\#}}}
\begin{document}
X\#X, X\mypound X
\end{document}

Addendum to address the OP's follow-up comment. The macros \scalebox and \raisebox are "fragile" (in the LaTeX sense of the word), and this fact gives rise to the error message you've encountered. A "robust" (again, using LaTeX jargon) version of the \mypound macro would be

\newcommand\mypound{\protect\scalebox{0.8}{\protect\raisebox{0.4ex}{\#}}}

Finally, if you want to be able to keep using \# as the directive that generates the (now resized) # symbol, you might use the following definition:

\renewcommand\#{\protect\scalebox{0.8}{\protect\raisebox{0.4ex}{\char"0023}}}

If you take this approach and find you also need to typeset the "original" pound/hash symbol, you would need to input it as \char"0023.