Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backticks are not displayed when using pdfLaTeX. #4

Open
Wandmalfarbe opened this issue Nov 16, 2017 · 5 comments
Open

Backticks are not displayed when using pdfLaTeX. #4

Wandmalfarbe opened this issue Nov 16, 2017 · 5 comments
Assignees

Comments

@Wandmalfarbe
Copy link

When I render some code with the listings environment, the backtick is not displayed:

\begin{lstlisting}
expecting backtick here ->`<-
\end{lstlisting}

The resulting PDF has no backtick in it.
screenshot 2017-11-16 16 24 04

The LaTeX error message I get is:

[WARNING] Missing character: There is no ` in font SourceCodePro-Regular-tlf-ts1!

I included the package without any options:

\usepackage{sourcecodepro}

and modified the listing environment:

\lstdefinestyle{eisvogel_listing_style}{
  basicstyle = \color{listing-text-color}\small\ttfamily{}\linespread{1.15},
  ...
}
\lstset{style=eisvogel_listing_style}

See the original issue here.

@silkeh
Copy link
Owner

silkeh commented Nov 19, 2017

Hmm, the backtick doesn't seem to have made it to the Type1 fonts. I will try to take a look at this some time next week. As a work around you could try using XelaTeX (if possible), the package will use the original OpenType font in that case.

Minimal example to reproduce (with pdflatex):

\documentclass{standalone}
\usepackage[default]{sourcecodepro}
\usepackage{textcomp}
\begin{document}
backtick: >\textasciigrave<
\end{document}

Thanks for reporting!

@Wandmalfarbe Wandmalfarbe changed the title Backticks are not displayed when using listings. Backticks are not displayed when using pdfLaTeX. Nov 19, 2017
@silkeh silkeh self-assigned this Jan 13, 2018
@Wandmalfarbe
Copy link
Author

Any news on this?

@wamserma
Copy link

Seems to be still unresolved.
As a workaround (for pdfLaTeX) the backtick can be set explcitly as \char0 when Type 1 fonts are used.

\documentclass{standalone}
\usepackage{listings}
\usepackage{sourcecodepro}

\lstset{ 
  basicstyle=\ttfamily,        % SourceCode Pro
  literate={`}{{\char0}}1      % backtick is \char0 in T1, \char18 otherwise
}

\begin{document}
\texttt{backtick in text: \char0{}a\char0{}} |\,\,
\begin{lstlisting}
backtick in listing: `a`
\end{lstlisting}
\end{document}

@silkeh
Copy link
Owner

silkeh commented Dec 13, 2018

Yes, the issue is still unresolved. I will take another look at it if/when I have time (may take a while), until then PRs are welcome!

breandan added a commit to breandan/kotlingrad that referenced this issue Jun 30, 2019
@c-harding
Copy link

c-harding commented May 10, 2020

As an alternative workaround, the snippet should work for getting backticks to work in verbatim or lstlisting environments, and for \textasciitilde to work in any other environment.

This seems to work in any order such that \usepackage{upquote} does not come after both of the other two lines (which frustratingly means it can’t just be added to the definition of sourcecodepro, as importing upquote after it will break it). However, if this definition is wrapped in \AtBeginDocument (\AtBeginDocument{\def\textasciigrave{\char0}}), they can be used in any order. This might be a good way to go forward?

\usepackage{sourcecodepro}
\usepackage{upquote}
\def\textasciigrave{\char0}

breandan added a commit to breandan/kotlingrad that referenced this issue Nov 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants