[Tex/LaTex] ! Use of doesn’t match its definition. l.10 Error

errors

I was working on this thesis template which was compiling fine until I used a \verb command in my code. From then code is showing countless errors like the one given below:-

! Use of doesn't match its definition.
l.10 ...sageBreak This may be a bug in a package f
ile you are using\par } {\...
If you say, e.g., `\def\a1{...}', then you must always
put `1' after `\a', since control sequence names are
made up of letters only. The macro here has not been
followed by the required stuff, so I'm ignoring it.

I commented all the code that I wrote on that day before error popped up, but still same errors.

I don't even know which part of the code is the problem so don't know what to paste here.

This is the code that I wrote after which errors appeared:

\begin{figure}[h]

\centering
\includegraphics[scale=0.75]{TAMUthesis_AddChapter.png}
\caption{Add More Chapters Into TAMUthesis\_Template.tex.
[For example, a new chapter named "myNewChapterName.tex" is created under the
folder of data. To put this new file for the compilation by adding the line \verb+\eqref{}+ char as shown in 281 (uncomment the  in front.)]}

Below is the link to access the files

https://www.mediafire.com/?7l9ieny56v8sp0e

Best Answer

As already I wrote answering to the crosspost on LaTeX-Community.org:

You cannot use \verb within \caption, as egreg and Ulrike said in the comments her before. \verb is very specific, as it doesn't interpret LaTeX commands in its argument. So you cannot use it within macros.

It's even more unusable in a moving argument, that means it's written into a file. Captions are written into a file, to be loaded and interpreted in the next LaTeX compiler run.

It can already be fixed by simply using typewriter font with a backslash in front. The output will be as desired.

Note, you should delete the external file where it was written to. In this case, it can be the .lof file which contains the captions for the list of figures, so also the illegal \verb command, so remove it. It will be re-generated in the next run, re-read to be interpreted one run later.

Related Question