On 2017-09-25, Bruce Momjian wrote:
> I am using LyX 2.1.2 on Ubuntu 14.04.
> If I enter this:
> ab'c de`f
> in "Standard" mode I get PDF output with proper left/right single
> quotes.
This is a feature of LaTeX fonts: the ASCII quote and backtick are mapped
to "typographical" quotes u2019 and u2018: ab’c de‘f
> However, if I switch to LyX-Code mode for that text, I get as
> PDF output:
> ab'c de'f
Here, I get the "typographical" quotes u2019 and u2018 in a teletype
font: ab’c de‘f
With Document>Settings>Fonts>non-TeX fonts, the PDF output is as expected:
ab'c de`f
> This is a problem for text of shell scripts. I the want backticks
> because backtick means 'execute' in the shell.
> What I have done instead to get literal backticks output is to use a
> TeX Code URT (Ugly Red Text) block inside the "LyX-Code mode" block and
> used \char18, which properly outputs the backtick.
In case using Unicode fonts is not an option, you may also try the
"listings" package (Insert>Program listing) with the options
upquote=true
basicstyle=\ttfamily
in Document>Settings>Program listings. In a minimal document, you may
need to add \usepackage{textcomp} to the LaTeX preamble.
A a last ressort, you can use the macro \textasciigrave (instead of
\char18) in raw LaTeX (ERT).
Günter