0

\texttt{==} typesets the two equals signs with a tiny gap in between. However,

\documentclass[11pt]{article}

\usepackage{fancyvrb}
\usepackage{fontspec}
\setmonofont{JetBrainsMono-Regular.otf}


\begin{document}

\texttt{==}

    \begin{Verbatim}
        ==
    \end{Verbatim}

\end{document}
 

 

enter image description here

typesets the two equals signs without the gap.

Is it possible to preserve the gap between == in the Verbatim (fancyvrb) environment? If so, how?

5
  • 1
    Please provide a full but minimal example that others can copy and test as is.
    – daleif
    Commented Sep 20, 2022 at 11:39
  • I get this output with texlive 2022 pdflatex Commented Sep 20, 2022 at 11:41
  • Thanks for the edit. I gather then, that this has to do with typefaces chosen. I will investigate. Commented Sep 20, 2022 at 12:28
  • Thanks for updating the example but your description (and answer post) are a bit misleading as Verbatim and texttt use the same font, and both show the same problem with Jet Brains (from github.com/JetBrains/JetBrainsMono) (You could raise an issue with the font that = ought to not fill its full width) Commented Sep 20, 2022 at 13:46
  • 5
    This is by design == forms a ligature to a long equals, => forms a ligature to an arrow, etc you can use the NL version from the same source without ligaturesor github.com/JetBrains/JetBrainsMono/blob/master/fonts/ttf/… disable the font feature when loading the font Commented Sep 20, 2022 at 15:35

2 Answers 2

3

By default the JetBrains font has a lot of ligatures including == ligature to a long =, you can disable this at font loading

enter image description here

\documentclass[11pt]{article}

\usepackage{fancyvrb}
\usepackage{fontspec}
\setmonofont[Contextuals = AlternateOff]{JetBrainsMono-Regular.otf}


\begin{document}

\texttt{==}

    \begin{Verbatim}
        ==
    \end{Verbatim}

\end{document}
0

\texttt{} and Verbatim were using two different (but very similar) fonts. Verbatim font was inherited from Beamer theme, not specified in my preamble, but included in MWE (above).

Added

\usepackage{fontspec}
\newfontfamily\verbatimfont{Inconsolata-Regular.ttf}[NFSSFamily=myverbatimfont]

to preamble and specified font within document using

\begin{Verbatim}[fontfamily=myverbatimfont]
==
\end{Verbatim}

Resolved. (I could also modify the Beamer theme I've been using.)

2
  • 3
    As you can see, no one other than yourself could have answered your question as the issue is just related to code not shown. Please, even now, edit your question so that it has a complete small document that shows a problem so that this post makes sense to future readers. Commented Sep 20, 2022 at 13:07
  • 1
    I tracked the font specification down to the Beamer template being used. I'll try to extract that and construct and MWE. Commented Sep 20, 2022 at 13:28

You must log in to answer this question.

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