3

This MWE

\documentclass[11pt]{article}
\usepackage{upquote}
\begin{document}

A `set` or 'set' 

\begin{verbatim}
A `set` or 'set'
\end{verbatim}

\end{document}

Compiled with lualatex foo.tex given the PDF file:

Mathematica graphics

I understand that is how Latex default font works. But I want ' and ` (straight quote and back quote) characters in the main text to also remain the same as in the input Latex file.

The package upquote fixes the verbatim text. How would one go about also fixing the ` and ' that show up in the main text as well?

Does one need a complete new font? Which one would that be? Or is there a package like upquote but for main text?

I googled but could not find something.

Using texlive 2017 on Linux.

5

You can use simply \textquotesingle and escaped grave accents followed by {}. To make both active characters an easy way is the niceverb package:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{textcomp}     % access \textquotesingle
\usepackage[utf8]{inputenc}
\usepackage{niceverb}
\begin{document}

A \textquotesingle set\textquotesingle\ or \`{}set\`{}

\MakeActiveLet\'\textquotesingle
\def\textquoteback{\`{}}
\MakeActiveLet\`\textquoteback

A 'set' or `set`

\end{document}

The result with pdflatex should be:

mwe

  • Thanks. Is it possible to put these commands "\MakeActiveLet\'\textquotesingle \def\textquoteback{`{}} \MakeActiveLet`\textquoteback" in the preamble instead of inside \begin{document} and have them work? I get an error when putting them in preamble now. On windows under Milktex, the package niceverb does not exist for some reason. I will try to install it manually for windows. – Nasser Jan 15 '18 at 16:29
  • @ According to CTAN, niceverb.sty is in the nice­text package of MikTeX. I'm afraid that in the preamble break something, and maybe also in the body of a complex document. For instance, is not compatible with the markdown package ... IMHO change active characters is a bad idea at least in projects of importance. – Fran Jan 15 '18 at 18:14

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.