[Tex/LaTex] Tex capacity exceeded, sorry input stack size=5000

errors

I am converting my latex file into a pdf and when I enter \end \end at the terminal, this error message pops up:

! Tex capacity exceeded, sorry [input stack size=5000].
\end #1->\csname end#1

My code for the file is:

\documentclass[11pt]{article}
\usepackage[demo]{graphicx}
\usepackage{amsmath}
\graphicspath{ {~/ITCourse/2018/CSC2408/Assignment2/} }
\title{Addison Sells, 22 December 2017}

\begin{document}

\maketitle

\tableofcontents

\section{Introduction}

Hi, my name is Addison Sells. The courses I have enrolled in are CSC2408 - Software Development Tools, CIS1000 - Information Systems Concepts, CMS1000 - Communication and Scholarship and CSC1401 - Foundation Programming 

\section{Verbatim Text}
\begin{verbatim*}
#!/bin/bash

# example of using arguments to a script
echo "My first name is $1"
echo "My surname is $2"
echo "Total number of arguments is $#"
\end{verbatim*}

\section{Formulae}

\begin{equation}
x= \frac {-b \pm \sqrt {b^2 - 4ac}}{2a} 
\end{equation} 

\begin{equation}
\triangle (x)=
\left \{
 \begin{tabular}{ccc}
 1 if x > 0
 -1 if x < 0
 0 otherwise 
 \end{tabular}
 \right.
\end{equation}

\section{Table} 

\begin{table}[h!] 
\begin{tabular}{ |l|c|r|} 
\hline
Category & \multicolumn{2} {|c|} {Tools} \\
 & Command & Description \\
\hline
Editor & emacs & Emacs extensible text editor \\
\hline
 & vi & Visual Editor \\
\hline
Scripting & bash & GNU Bourne-Again SHell \\
\hline
 & perl & Pratical Extraction and Report Language \\ 
\hline
Document & rcs & Revision Control System \\
\hline
Managment & LaTeX & Document Typesetting Package \\
\hline`
 & make & Managing Project Utility \\
\hline
\end{tabular}
\caption{Table of some Unix utilities}
\end{table} 

\section{Biography}
\begin{figure}
\includegraphics[width=8cm,height=8cm]{IMG0390.PNG}
\end{figure}

Addison Sells was born on the 6th of April 1998 to parents Emily Swann and Adam Sells. Addison lived in Brisbane until the age of 4, when he moved to Toowoomba, where he has lived since. Addison attended Toowoomb East State School and Toowoomba State High School where he graduated with an OP of 16. After finishing high school Addison attended the University of Southern Queensland Toowoomba campus where he has completed 1 semester of Bachelor of Commerce and 1 semester of Bachelor of Information Technology



\section{Bash Script 1}
\#!/bin/bash 
name=\${0\#\#*}
Usage="Usage: {script name} {target file}"
if [ \$\# -eq 0 ]; then 
    echo \$Usage
    exit 1
fi
until [ \$\# -eq 0 ]
do 
    case \$1 in
        -h) echo \$Usage
            exit 0;;
        *) FILE=\$1
            shift;;
    esac
done
if [ ! -f \$FILE ]; then
    echo "'\$FILE' does not exist"
else 
    sed -i '\verb|/^\s*\/\*.*\*\/\s*\$/g'| \$FILE
fi

\section{Bash Script 2}
\#!/bin/bash  
name=\${0\#\#*}
Usage="Usage: {script name} {target file}"
if [ \$\# -eq 0 ]; then 
    echo \$Usage
    exit 1
fi
until [ \$\# -eq 0 ]
do 
    case \$1 in
        -h) echo \$Usage
            exit 0;;
        *) FILE=\$1
            shift;;
    esac
done
if [ ! -f \$FILE ]; then
    echo '\$FILE' does not exist
else 
     egrep -v \verb|'\S\s+\S'| \$FILE
fi

I have removed parts of the code and tested it to try and isolate the problem, but I have had no luck with this

Best Answer

You have no

\end{document}

in the file so tex runs off the end of the file and starts taking input from the terminal with its interactive * prompt.

*
(Please type a command or say `\end')

If you type \end in latex you get the wrong thing as \end has been redefined to end environments, you could type \stop but if you type \end twice you get the equivalent of \end{\end} and the error you show.

(Please type a command or say `\end')
*\end

*\end
! TeX capacity exceeded, sorry [input stack size=5000].
\end #1->\csname end#1
                      \endcsname \@checkend {#1}\expandafter \endgroup \if@e...
<*> \end

!  ==> Fatal error occurred, no output PDF file produced!

The solution is to add \end{document} to the end of the file.

Related Question