In OT1 encoding only a limited set of quotes are available. Try T1 encoding:
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{listings}
\begin{document}
\begin{lstlisting}[language=XML,basicstyle=\fontencoding{OT1}\selectfont]
<root attr1="OT1" attr2='foobar'/>
\end{lstlisting}
\begin{lstlisting}[language=XML]
<root attr1="T1" attr2='foobar'/>
\end{lstlisting}
\end{document}
Or use a typewriter font:
\documentclass{article}
\usepackage{listings}
\begin{document}
\begin{lstlisting}[language=XML,basicstyle=\ttfamily]
<root attr1="foo" attr2='bar'/>
\end{lstlisting}
\end{document}
And I prefer something like
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[variablett]{lmodern}
\usepackage{listings}
\lstset{
basicstyle=\ttfamily,
columns=flexible,
}
\begin{document}
\begin{lstlisting}[language=XML]
<root attr1="foo" attr2='bar'/>
\end{lstlisting}
\end{document}
A straight single quote is available in encoding TS1
(package textcomp
).
In package listings
this is enabled by option upquote
(Thanks alexis and Paul Gaborit):
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\usepackage[variablett]{lmodern}
\usepackage{listings}
\lstset{
basicstyle=\ttfamily,
columns=flexible,
upquote,
}
\begin{document}
\begin{lstlisting}[language=XML]
<root attr1="foo" attr2='bar'/>
\end{lstlisting}
\end{document}
The \lstinputlisting
instruction replaces a lstlisting
environment. With your input, you are asking not to interpret \lstinputlisting
.
\documentclass{report}
\usepackage{listings}
\lstset{basicstyle=\footnotesize\ttfamily,breaklines=true}
\lstset{framextopmargin=50pt,frame=bottomline}
\begin{document}
\lstinputlisting{C:/Temp/test.txt}
\end{document}
Best Answer
A good solution that also works for listings was provided here: How to iterate through the name of files in a folder. You just have to modify the code like this:
Note that, if you are running under windows, you will have to replace
\app@exe
commands by something like (not tested, but based on the answer given in the previous thread):The code I gave will include all the files of the directory. If you want to only include files with a given extension you can specify it directly in
\app@exe
command.Don't forget to compile using
pdflatex -shell-escape yourfile.tex
.