# \lstinputlisting with source file containing logic symbols [duplicate]

I have a source code file that I want to include in my LaTeX document with \lstinputlisting. However, this source file contains logic symbols like ∃ (it's encoded in UTF-8), which produce errors. I tried using listingsutf8, but it requires that the input file be encodable in an 8-bit fixed-width encoding, and as far as I know, no such encoding in existence supports logic symbols.

I've seen some similar questions on this site but they all seemed to deal exclusively with characters representable in Latin-1/ISO-8859-1.

LaTeX file:

\documentclass[12pt]{report}
\usepackage[latin1]{inputenc}
\usepackage{listings}
\begin{document}
\lstinputlisting{test.txt}
\end{document}


test.txt:

~∃x. S(x) = 0


Error message:

! Package inputenc Error: Keyboard character used is undefined
(inputenc)                in inputencoding latin1'.


Is there any way around this?

• Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}`. I guess you are using LaTeX or pdfLaTeX? Maybe XeLaTeX or LuaLaTeX would be easier? – cfr Mar 25 '15 at 0:11
• Sorry; I'm very new to LaTeX and hadn't been sure what to do. Added a minimal example. I'm using pdfLaTeX. – Taymon Mar 25 '15 at 2:12
• Ok, so it turns out the solution actually isn't different from the existing questions, so I went ahead and flagged it as a duplicate. – Taymon Mar 25 '15 at 3:26