2

This is my code:

\starttext
  \starttyping
    -- comment
  \stoptyping
\stoptext

It compiles fine:

However, if I change the font:

\usemodule[simplefonts][size=12pt]
\setmonofont[Source Code Pro]

\starttext
  \starttyping
    -- comment
  \stoptyping
\stoptext

One of the dashes disappears:

Why is that happening?

  • It might be a problem with ligatures. – Manuel Oct 11 '16 at 10:10
  • @Manuel thought about that, but I tested using the font in my editor and it did not replace the two -- with a ligature (my editor renders ligatures). – flyx Oct 11 '16 at 10:12
3

If you load a monospaced font without any further information it will automatically enable the TeX ligatures (tlig) which includes -- and ---. To prevent this, load the font with features=none.

Furthermore, the simplefonts module has been superseded by the \definefontfamily method which I show below. To match the sizes of all fonts we apply some scaling.

\definefontfamily [source] [rm] [Source Serif Pro]     [scale=0.9]
\definefontfamily [source] [ss] [Source Sans Pro]
\definefontfamily [source] [tt] [Source Code Pro]      [features=none]
\definefontfamily [source] [mm] [TeX Gyre DejaVu Math] [scale=0.9]

\setupbodyfont[source,12pt]

\starttext
\starttyping
  -- comment
\stoptyping
\stoptext

enter image description here

  • * Furthermore, the simplefonts module has been superseded by the \definefontfamily* sadly not in the distribution I use :/ – flyx Oct 11 '16 at 18:38
  • @flyx Which distribution do you use? I use TL 2016. – Henri Menke Oct 11 '16 at 18:49
  • Something on an old CentOS which is maintained by someone else, I cannot tell you exactly (this is the common infrastructure where everything has to compile). – flyx Oct 11 '16 at 19:10
2

Okay, I was not aware that there are TeX ligatures in addition to the ligatures the font may provide itself. This fixes it:

\setmonofont[Source Code Pro][features=none]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.