4

After compiling my "-" symbol in every single listing environment dissapears. I found out that "listings" package must somehow conflict with "breqn" package. Below is a minimal working example. Try to coment/uncomment \usepackage{breqn} and then compile.

\documentclass[12pt,a4paper,openany]{report}
\usepackage{listings}
\usepackage{color}
\usepackage{breqn}

\begin{document}

\begin{lstlisting}
arm-none-eabi-as -mcpu=arm926ej-s -c -Wall -ostartup.o startup.s
\end{lstlisting}

\end{document}

I would really love to use both, but only if anyone can tell me, why i get this bug and how can it be fixed.

5

You could locally reset - in listings like so, if no better way is suggested:

\documentclass[12pt,a4paper,openany]{report}
\usepackage{listings}
\usepackage{color}

%fix for \begin{lstlisting}
\edef\savedmiuscode{\mathcode`\noexpand\-\the\mathcode`\-\relax}
\let\oldlstlisting\lstlisting
%\show\savedmiuscode
\def\lstlisting{\savedmiuscode\oldlstlisting}

%fix for \lstinputlisting{}    
\edef\savedmiuscode{\mathcode`\noexpand\-\the\mathcode`\-\relax}
\let\oldlstinputlisting\lstinputlisting
%\show\savedmiuscode
\def\lstinputlisting{\savedmiuscode\oldlstinputlisting}

\usepackage{breqn}



\begin{document}



\begin{lstlisting}
arm-none-eabi-as -mcpu=arm926ej-s -c -Wall -ostartup.o startup.s
\end{lstlisting}

\end{document}
  • For the final solution, you might want to remove \show\savedmiuscode. :-) – diabonas Mar 28 '12 at 13:05
  • @diabonas ah edited answer, thanks:-) – David Carlisle Mar 28 '12 at 13:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.