[Tex/LaTex] Parameter Stack Size Error with graphicx

graphicsparameters

I'm trying to include a graphic in a document, and no matter how I try to manipulate the graphicx package, I have never been able to make an image appear. I have tried making the image PNG, PDF, and EPS, and nothing works. Always get the same error:

TeX capacity exceeded, sorry [parameter stack size=10000]. \gb@ifnextchar #1#2#3->
                   \let \reserved@d =#1\def \reserved@a {#2}\def \reserv...l.20 \includegraphics{Erg_Dat_Agree}

This is a simplified version of the document I'm trying to code: it's the exact same preamble, then what I'm typing to insert the image.

\documentclass[12pt,letterpaper]{article}
\usepackage{graphicx}
\usepackage[left=.9in, right=.9in, top=1in, bottom=1in]{geometry}
\usepackage{fancyhdr}
\usepackage{microtype}
\usepackage{setspace}
\usepackage[utf8]{inputenc}
\usepackage{sectsty}
\usepackage{ amssymb }
\usepackage{tipa}
\usepackage{qtree}
\usepackage{gb4e}

\pagestyle{plain}

\begin{document}

Text

\includegraphics{Erg_Dat_Agree}

\end{document}

Best Answer

Package gb4e makes the characters _ and ^ active. Their definitions disturb \includegraphics, where _ should be expandable and expand to itself.

Either use \noautomath that resets the catcodes:

\noautomath
\includegraphics{Erg_Dat_Agree}

Or \string that converts the next token _ to a character token with catcode "other" (12):

\includegraphics{Erg\string_Dat\string_Agree}
Related Question