I am using the listings
-Package to display code. As I am using The Consolas Font as the Monotype-Default I expected straight quotes which isn't the case (check my MWE)
\documentclass[a4paper]{article}
\usepackage{listings}
\usepackage{polyglossia}
\setdefaultlanguage[]{english}
\setmonofont[Ligatures=TeX]{Consolas}
\lstset{frame=single}
\begin{document}
\begin{lstlisting}
"some code to try"
\end{lstlisting}
\end{document}
Can Anyone help How to get straight quotes?
Best Answer
This is actually caused by
Ligatures=TeX
, which causesfontspec
to automatically convert a"
to curly quotes, it appears. Further, as I mentioned in a comment,listings
does not use the monotype font by default, so to actually use Consolas in the listings, addbasicstyle=\ttfamily
tolstset
.