3

I must admit that I don't really know my way around LaTeX, pretty much at all. Anyway, here's my problem:

I want to include the symbols \flat and \sharp in my text. Unfortunately I only receive errors when I put them in like that. So I declared this somewhere

\newcommand{\vb}{\ensuremath{\flat}}

and it works quite well. Unfortunately I need my text with this symbol always in italics. So when I write B\vb (in italics) the B and the flat sign will intersect.

Is there any way I can force the flat sign to be italicised?

5
  • Do you write \textit{B\vb}? In that case, a little kerning might help, for example \textit{B\kern0.04em\vb} or \newcommand{\itkern}{\kern0.04em} and \textit{B\itkern\vb}. Adjust the \kerning value according to your needs.
    – moewe
    Sep 30, 2013 at 15:22
  • See tex.stackexchange.com/questions/34830/…
    – jub0bs
    Sep 30, 2013 at 15:43
  • Thanks for both of your replies. I exchanged the math mode for $...$ now. And adjusting kerning for these two symbols works to prevent the intersection, so that's nice. But it does look a bit odd to have the first Letter in italics and then the straight symbol afterwards. So while my big problem is solved I still wonder: Is there any way I can force the \flat (or \sharp) sign to be italicised?
    – James
    Sep 30, 2013 at 15:55
  • 1
    You would need to have a font that contains an italic flat/sharp symbol (I don't know if there are any). You could also try and fake-slant the symbol (probably not the best idea).
    – moewe
    Sep 30, 2013 at 15:58
  • How could I try that?
    – James
    Sep 30, 2013 at 16:25

2 Answers 2

6

The italic flat isn't prepared in the fonts. But if you really need it and you are using pdfTeX with direct output to PDF then you can try this:

\def\flatit{\setbox0=\hbox{$\flat$}%
   \pdfliteral{q 1 0 .3 1 0 0 cm}\rlap{$\flat$}\pdfliteral{Q}\kern\wd0 }

{\it B\flatit C}

sharp

If you are not using pdfTeX with direct PDF output but you create PDF via (x)dvipdfm(x) (XeTeX chooses this way) then you can add the following definition:

\def\pdfliteral#1{\special{pdf:literal #1}}
1
  • For anyone wanting to use this for other symbols/fonts, then note that italic font usually have an angle of 10-12 degrees, which is a shearing factor of 0.18 to 0.21. A factor of 0.3 is 16.7 degrees which is will probably be too much for most symbols in most fonts (the shearing factor is just tan of the incline angle).
    – poizan42
    Mar 13, 2017 at 2:08
2

The symbols don't clash if you use the proper input:

\documentclass{article}
\begin{document}
{\itshape B$\flat$ B$\sharp$}

\textit{B}$\flat$ \textit{B}$\sharp$

$B\flat$ $B\sharp$
\end{document}

enter image description here

If you really need the flat in an italic context, precede it with \/:

{\itshape B\/$\flat$}

Of course you can define your personal command like you did.

1
  • 1
    And an italic flat would make no sense.
    – egreg
    Sep 7, 2014 at 0:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .