Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

up vote 5 down vote accepted

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}
share|improve this answer
    
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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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