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.

this code doesn't compile for me. Could it be a bug or is something wrong with my LaTex installation?

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{gb4e}
\usepackage{listings}
\begin{document}
\begin{exe}
\ex
\gll Isso é um exemplo.\\
This is an example\\
\trans `This is an example.'
\end{exe}
\begin{lstlisting}
source code
\end{lstlisting}
\end{document}

My goal: have glossed examples AND indented source code (the verbatim environment did not indent the code).

share|improve this question
    
Because gb4e messes with catcodes, it's best to load it last or almost last in your list of packages. –  Alan Munn Jan 1 '13 at 22:14

1 Answer 1

up vote 3 down vote accepted

load it the other way round:

\usepackage{listings}
\usepackage{gb4e}

but remember that listings cannot handle UTF-8 characters when using pdflatex

share|improve this answer
    
Thank you both (@Herbert and @AllanMunn), it works now :) @Herbert, by UTF-8 characters, you mean the non-English characters (é, ã, ...)? But these do come out for me within listings and I am indeed using pdflatex. Probably because I have other packages loaded such as [brazilian,english]{babel}, [latin1]{inputenc}, [T1]{fontenc}? –  Rodrigo Jan 2 '13 at 8:30

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.