I am trying to display my XQuery code in a latex document as follows:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{listings}
\title{code}
\date{January 2016}
\begin{document}
\maketitle
\begin{lstlisting}
for $country in db:open('factbook')//country
where $country/@population > 100000000
for $city in $country//city[population > 1000000]
group by $name := $country/name[1]
count $id
return <country id='{ $id }' name='{ $name }'>{ $city/name }</country>
\end{lstlisting}
\section{Introduction}
\end{document}
The result I get in the pdf is as follows:
f o r $c oun t ry i n db : open ( ’ f ac tb o o k ’ ) / / c oun t ry
where $c oun t ry / @population > 100000000
f o r $ c i t y i n $c oun t ry // c i t y [ p o p ul a ti o n > 1 0 0 0 0 0 0]
group by $name := $c oun t ry /name [ 1 ]
count $i d
r e t u r n <c oun t ry i d =’{ $i d } ’ name=’{ $name }’>{ $ c i t y /name }</country>
But I would like to extract the code as it is from the PDF (including the apostrophes) How do I do this?