I want to make C#
look nice in my book, but with the following:
C\#
it looks like this:
When it should look more like this:
For the second one, I used verbatim, but I don't want that and I've also used a macro like the following everywhere so it should be easy to replace:
\def\Csharp{C\#}
Any suggestions on how I make this look correct?
Edit
I am writing a programming book, in the C# Language Specification, it looks like this:
Best Answer
Since Computer Modern Roman does not have a fitting hash symbol, we need to look somewhere else. I experimented with several popular fonts and found that the hash symbol from Liberation Serif does not stand out, has approximately the same brush width and isn't too wide.
Unfortunately, as Liberation Serif is a TrueType font, it can't be readily used with pdfTeX. Below is the code to use it with XeTeX/LuaTeX.
Workaround for pdfTeX
Process this file with XeTeX/LuaTeX and save the result as
hash-symbol.pdf
:Then use this code to include the symbol with pdfTeX:
The positioning of the symbol might be slightly off, use
\kern
and\raisebox
to fine-tune. Also note that this will only work for one font size; to remedy this,\scalebox
might be useful (manual).