0

Trying to learn LaTeX, I'm using a very simple document to see if I can import C# code using the listings package. I've installed MikTex, and made sure it's up to date, and I'm using pdfLateX.

The code is as follows:

\documentclass{article}

\usepackage[T1]{fontenc} \usepackage{color}

\definecolor{bluekeywords}{rgb}{0.13,0.13,1} \definecolor{greencomments}{rgb}{0,0.5,0} \definecolor{redstrings}{rgb}{0.9,0,0}

\usepackage{listings} \lstloadlanguages{[Sharp]C} \lstset{ language=[Sharp]C, showspaces=false, showtabs=false, breaklines=true, showstringspaces=false, breakatwhitespace=true, escapeinside={(@}{@)}, commentstyle=\color{greencomments}, keywordstyle=\color{bluekeywords}\bfseries, stringstyle=\color{redstrings}, basicstyle=\ttfamily }

\begin{document}

\lstinputlisting{DoDickey.cs}

\end{document}

My problem is that when I import the C# code, some junk characters are appended at the beginning.

Junk Characters

Tried a bunch of different code files, tried using \lstinputlisting[[Sharp]C]{DoDickey.cs}.

This just results in the error "Package Listings Error: File `C(.tex)' not found."

I'm assuming it's an encoding issue, but I honestly have no idea how to solve it.

NT93
  • 1

0 Answers0