0

After several hours of trying to find the error that was making the compilation fail:

Undefined control sequence. \listoffigures

Resulted that this error has nothing to relate to figures, neither tables.

It seems that I have reached a section max number limit (yes, it seems incredible also for me): if add another \section{title} to any of the .tex files that are called in the project, the error of Undefined control sequence. will arise.

And, curiously, this max number of sections seems to be the number of sections that fit in a single page of the Table of Contents:

enter image description here

So, I have no idea how to deal with this.

I am stuck and I simply cannot add any more sections \section{title} to my .tex project.

Code in the main document (which calls other .tex files that are very simple and contain only commands for sectioning, tables, figures, and tikz pictures with captions):

\documentclass[11pt, twoside, draft]{report}

\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage[a4paper,width=150mm,top=25mm,bottom=25mm,bindingoffset=6mm]{geometry}
\usepackage{fancyhdr}
\usepackage{subcaption}
\usepackage[numbers,sort&compress]{natbib}
\usepackage{color,soul}
\usepackage{xcolor}
\usepackage{pgfplots}
\usepackage{tikz}
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{longtable}
\usepackage{tabu}
\usepackage{array}
\usepackage{colortbl}
\usepackage{hyperref}
\usepackage{xr}
\usepackage{textcomp}
\usepackage{courier}
\usepackage{graphicx}
\usepackage{caption}

\captionsetup{font=footnotesize, labelfont=sc}
\graphicspath{ {images/} }
\pagestyle{fancy}

\definecolor{bblue}{HTML}{A9D0F5}
\definecolor{lightbblue}{HTML}{CEF6EC}
\definecolor{darkbblue}{HTML}{4189F5}
\definecolor{ggreen}{HTML}{D8F6CE}
\definecolor{darkggreen}{HTML}{41F583}
\definecolor{verydarkggreen}{HTML}{31B404}
\definecolor{rred}{HTML}{F5A9A9}
\definecolor{verydarkrred}{HTML}{DF0101}
\definecolor{oorange}{HTML}{F5ECCE}
\definecolor{verydarkoorange}{HTML}{DF7401}
% \def\tabularxcolumn#1{m{#1}} This is for vertical centering in tabularx.

\pgfplotsset{every tick label/.append style={font={{\scriptsize}}}}
\pgfplotsset{/pgf/number format/use comma}
\pgfplotsset{compat=1.5}

\input{Chapters/01_Title}

\input{Chapters/02_Abstract}

\pagestyle{fancy}
\let\Chaptermark\chaptermark
\def\chaptermark#1{\def\Chaptername{#1}\Chaptermark{#1}}
\fancyhead{}
\fancyhead[L]{\small \emph{Title}}
\fancyhead[R]{\small Author name}
\fancyfoot{}
\fancyfoot[R]{\small \thepage}
\fancyfoot[L]{\small \emph{Chapter \thechapter. \Chaptername.}}

\tableofcontents

\listoffigures

\listoftables


\chapter{Presentation}
\externaldocument{Chapters/03_Presentation}
\input{Chapters/03_Presentation}

\chapter{Introduction}
\externaldocument{Chapters/04_Introduction}
\input{Chapters/04_Introduction}

\bibliographystyle{IEEEtran}
\bibliography{References/Bibliography_report}

\appendix

\chapter{Appendix}
\externaldocument{Chapters/99_Appendix}
\input{Chapters/99_Appendix}

\end{document}

Thank you in advance for your help.

EDIT Nº1 This is the error log near to the ! indicator. [...]

] (./Report.toc
LaTeX Font Info:    External font `cmex10' loaded for size
(Font)              <10.95> on input line 2.
LaTeX Font Info:    External font `cmex10' loaded for size
(Font)              <8> on input line 2.
LaTeX Font Info:    External font `cmex10' loaded for size
(Font)              <6> on input line 2.
 [4

])
\tf@toc=\write4
\openout4 = `Report.toc'.


! Undefined control sequence.
<argument> Chapter \thechapter . \Chaptername 
                                              .
l.95 \listoffigures

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

[5] (./Report.lof)
\tf@lof=\write5
\openout5 = `Report.lof'.

 [6

] (./Report.lot
Overfull \hbox (1.74966pt too wide) in paragraph at lines 4--4
 [][] []\OT1/cmr/m/n/10.95 Summary of power-trains used and/or de-vel-op-ment i
n pas-sen-ger light-weight |
 []

)
\tf@lot=\write6
\openout6 = `Report.lot'.

 [7

]
Chapter 1.

[...]

By the way, this error has something to relate with the auxiliary files result of the compilation, because if get the error, and then I delete the sections that "exceed", I keep obtaining the same error. I need to erase all the auxiliary files, and then if I compile (respecting this apparent max number of sections in the .tex project), it works; but obviously I will need soon or later to add more sections.

  • the error you show is not the format tex uses so you have not shown which command is undefined. Copy the exact error message from the log all the lines from ! to ? put in a code block in your question so linebreaks are preserved – David Carlisle Aug 9 '16 at 18:59
  • The error is becouse of the lines regarding chaptermark and Chaptername. What are you trying to do there? Removing those lines solves your problem. – Runar Aug 9 '16 at 19:12
  • the error message which was not in your original question shows that the undefined command is \Chaptername which you are (rather strangely) defining in a local scope that does not include the list of figures. – David Carlisle Aug 9 '16 at 19:14
  • you need to fix (or delete) the chaptermark definition, then delete the corrupted Report.lof file and regenerate. – David Carlisle Aug 9 '16 at 19:16
0

You seem to be trying to create a function to get the current chaptername and put that in the footer. The function caused some problems. Also, the function already exists. It is called \leftmark, which would in a report print the current chapter, and you also have \rightmark which prints the current section. In an article these would respectively be the section and the subsection.

Output

enter image description here

Code

\documentclass[11pt, twoside, draft]{report}

\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage[a4paper,width=150mm,top=25mm,bottom=25mm,bindingoffset=6mm]{geometry}
\usepackage{fancyhdr}
\usepackage{subcaption}
\usepackage[numbers,sort&compress]{natbib}
\usepackage{color,soul}
\usepackage{xcolor}
\usepackage{pgfplots}
\usepackage{tikz}
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{longtable}
\usepackage{tabu}
\usepackage{array}
\usepackage{colortbl}
\usepackage{hyperref}
\usepackage{xr}
\usepackage{textcomp}
\usepackage{courier}
\usepackage{graphicx}
\usepackage{caption}

\captionsetup{font=footnotesize, labelfont=sc}
\graphicspath{ {images/} }
%\pagestyle{fancy}

\definecolor{bblue}{HTML}{A9D0F5}
\definecolor{lightbblue}{HTML}{CEF6EC}
\definecolor{darkbblue}{HTML}{4189F5}
\definecolor{ggreen}{HTML}{D8F6CE}
\definecolor{darkggreen}{HTML}{41F583}
\definecolor{verydarkggreen}{HTML}{31B404}
\definecolor{rred}{HTML}{F5A9A9}
\definecolor{verydarkrred}{HTML}{DF0101}
\definecolor{oorange}{HTML}{F5ECCE}
\definecolor{verydarkoorange}{HTML}{DF7401}
\usepackage{pgffor,lipsum}
% \def\tabularxcolumn#1{m{#1}} This is for vertical centering in tabularx.



%\input{Chapters/01_Title}

%\input{Chapters/02_Abstract}

\pagestyle{fancy}
%\let\Chaptermark\chaptermark
%\def\chaptermark#1{\def\Chaptername{#1}\Chaptermark{#1}}
\fancyhead{}
\fancyhead[L]{\small \emph{Title}}
\fancyhead[R]{\small Author name}
\fancyfoot{}
\fancyfoot[R]{\small \thepage}
\fancyfoot[L]{\small \itshape \leftmark.}

\begin{document}
\tableofcontents

\listoffigures

\listoftables


\chapter{Presentation}
\foreach \x in {1,...,50}{
\section{Sectiontitle}
\lipsum
}
%\externaldocument{Chapters/03_Presentation}
%\input{Chapters/03_Presentation}

\chapter{Introduction}
%\externaldocument{Chapters/04_Introduction}
%\input{Chapters/04_Introduction}

%\bibliographystyle{IEEEtran}
%\bibliography{References/Bibliography_report}

%\appendix

\chapter{Appendix}
%\externaldocument{Chapters/99_Appendix}
%\input{Chapters/99_Appendix}

\end{document}
0

SOLVED!

The

\pagestyle{fancy}
\let\Chaptermark\chaptermark
\def\chaptermark#1{\def\Chaptername{#1}\Chaptermark{#1}}
\fancyhead{}
\fancyhead[L]{\small \emph{Migration of road transport towards hybrid power-train solutions}}
\fancyhead[R]{\small Gerard Illana Meler}
\fancyfoot{}
\fancyfoot[R]{\small \thepage}
\fancyfoot[L]{\small \emph{Chapter \thechapter. \Chaptername}}

was before the

\tableofcontents

\listoffigures

\listoftables

which obviously had no chapter defined, and the error was result of the fact that latex did not know which number or name should put in the footer of the table of contents' pages.

I just moved the first code AFTER the calling of table of contents and now I obtain no error.

In any case, thank you all for your help too!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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