Graphics, Figures & TablesErrors with LOF and LOT in report class

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
didierc
Posts: 5
Joined: Sun Aug 03, 2014 3:21 pm

Errors with LOF and LOT in report class

Post by didierc »

Hi,

I'm currently writing a report where I need to add lists of tables and figures.
I'm using the report document class and \listoffigures and \listoftables commands.

But, when I'm compiling the tex sources (I'm using TexLive distribution on Mac OSX with the MacTex package and Texlipse as IDE), I get 3 errors for every figures and tables:
Multiple markers at this line
- Illegal unit of measure (pt inserted). ...xxx}}{5}{figure.caption.5} (followed by: )
- Missing = inserted for \ifnum. ...xxx}}{5}{figure.caption.5} (followed by: )
- Missing number, treated as zero. ...xxx}}{5}{figure.caption.5} (followed by: )
And, in the PDF file, each table entry from the lot (idem for figures and lof) are preceded by ">" character and a lineskip :
>
I.3 XXX . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Could you pls help me solving this problem?

Thanks in advance. Cheers, DC

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Re: Errors with LOF and LOT in report class

Post by Stefan Kottwitz »

Hi DC,

welcome to the forum!

Could you please post some sample code? The best would be a small example which brings that error. Or at least your document preamble with used packages and settings.

It looks like a problem with the hyperref, because hyperref changes the way in which list of figures and tables entries are written. Like if you added or removed hyperref, and from that point on the previously written list of figures and table files (.lof and .lot) won't work anymore. So, another try could be to remove .lot and .lof file and to recompile, which would regenerate the files with current settings.

Stefan
LaTeX.org admin
didierc
Posts: 5
Joined: Sun Aug 03, 2014 3:21 pm

Errors with LOF and LOT in report class

Post by didierc »

Hi,
Many thanks for your reply.
I indeed use the hyperref package but disabling this package does not have any effect (even after deleting the .lof and .lot files).

As requested, here is my tex main file.

Code: Select all

\documentclass[a4paper,12pt,twoside]{report}
%\inputonly{chap1, chap3}

\usepackage[latin1]{inputenc}

\usepackage[round,authoryear]{natbib}

\usepackage{myenv}
\geometry{top=30mm,bottom=25mm,left=25mm,right=25mm}

\usepackage{textcomp}
\usepackage{multicol}
\usepackage{setspace}
\usepackage{chapterbib}
\usepackage{pdflscape}
\usepackage{envmath}
\usepackage{amsmath}
\usepackage[T1]{fontenc}
\usepackage[inline]{enumitem}
\usepackage{cases}
\usepackage{subcaption}
\usepackage{stfloats}
\usepackage{diagbox}
\usepackage[none]{hyphenat}
\usepackage[pdftex,hidelinks,bookmarksdepth=4]{hyperref}

\newcommand{\nc}{\vspace{0.5cm}}
\newcommand{\np}{\newpage}
\newcommand\eq[1]{(\ref{eq#1})}

%\usepackage{url}

\graphicspath{{../illustrations/}}
\definecolor{Gray}{gray}{0.9}

\frenchbsetup{ReduceListSpacing=false, StandardItemizeEnv=true,
StandardEnumerateEnv=true, StandardItemLabels=true}

\pdfminorversion=6
\pdfcompresslevel=9
\pdfobjcompresslevel=9


\setcounter{secnumdepth}{5}
\renewcommand\thesubparagraph{\textbf{(\roman{subparagraph})}}

\setlength{\headheight}{20pt}

\begin{document}

\input{Titre}

\dominitoc

\cleartooddpage
\input{chapitres/Remerciements}

\cleartooddpage
\input{chapitres/Resume}

\cleartooddpage
\input{chapitres/Abstract}

\cleartooddpage
\pdfbookmark[0]{Table des matières}{tableofcontents}\tableofcontents

\cleartooddpage
\pagenumbering{arabic}
\setcounter{page}{1}

%\input{chapitres/chapitre1}
\input{chapitres/chapitre2}
%\input{chapitres/chapitre3}
%\input{chapitres/chapitre4}
%\input{chapitres/chapitre5}

\newpage
\addcontentsline{toc}{chapter}{\bibname}
\bibliographystyle{abbrvnat}
\bibliography{	../bib/bibtex}


\cleartooddpage
\listoffigures

\cleartooddpage
\listoftables


\end{document}
The myenv package is one package I created with my settings for all my documents. It contains :

Code: Select all

\NeedsTeXFormat{LaTeX2e}

\ProvidesPackage{myenv}[2013/07/22 Personal extension with common settings, V1.0]


%%PACKAGES%%

\RequirePackage{standalone}
\RequirePackage[top=25mm,bottom=25mm,right=25mm,left=25mm,a4paper]{geometry}
\RequirePackage[french]{babel}
\RequirePackage[T1]{fontenc}
\RequirePackage{graphicx,epstopdf}
\RequirePackage{setspace}
\RequirePackage{lipsum}
\RequirePackage{fancyhdr,fancybox}
\RequirePackage{amsmath,amssymb}
%\RequirePackage[scaled]{helvet}
%\RequirePackage{arevmath}
\RequirePackage[subfigure]{tocloft}

\RequirePackage{color, colortbl}
\RequirePackage[dvipsnames,svgnames]{xcolor}

\RequirePackage{eqnarray}
\RequirePackage{tabularx}
\RequirePackage{multirow}
\RequirePackage[nohints]{minitoc}
\RequirePackage{floatrow}
%\RequirePackage{lastbib}

\RequirePackage{fmtcount}

% \RequirePackage{slashbox}
% \RequirePackage{booktabs}
% 
% \RequirePackage{makecell}
% 
% %\RequirePackage{titlesec}
% 
% \RequirePackage{rotating}
\RequirePackage{nextpage}
% 
% \RequirePackage{datetime}

\pretolerance=150
\tolerance=10000
\hbadness=10000
\hfuzz=30pt
\emergencystretch=0em


\setlength{\headheight}{15pt}
\setlength{\parskip}{1mm plus2mm}

%%%% HEADER/FOOTER %%%%%

\pagestyle{fancyplain}

\fancyhf{}
\fancyhead[EL,OR]{\nouppercase{\color{chaptercolor}\small\bfseries\sc\leftmark}}
\fancyfoot[EL,OR]{\thepage}
\fancyfoot[ER,OL]{\tiny\sc XXX}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt} 


%%NEW ENVIRONMENTS AND COMMANDS%%%

\newlength{\arrayrulewidthOriginal}
\newcommand{\Cline}[2]{%
  \noalign{\global\setlength{\arrayrulewidthOriginal}{\arrayrulewidth}}%
  \noalign{\global\setlength{\arrayrulewidth}{#1}}\cline{#2}%
  \noalign{\global\setlength{\arrayrulewidth}{\arrayrulewidthOriginal}}}

%%%Editing chapter and section styles%%%
\addtolength\cftchapnumwidth{2mm}
\addtolength\cftsecnumwidth{2mm}
\renewcommand{\cftchapfont}{\bfseries\sc\bfseries}
\renewcommand{\cftchappagefont}{\bfseries\sc\bfseries}
\renewcommand{\cftsecfont}{\bfseries}
\renewcommand{\cftsecpagefont}{\bfseries}

%%%Editing paragraph styles%%%
%\titleformat{\paragraph}{\normalfont\normalsize\bfseries}{\theparagraph}{1em}{}
%\titleformat{\subparagraph}{\normalfont\normalsize\bfseries}{\thesubparagraph}{1em}{}
%\titlespacing*{\paragraph}{0pt}{3.25ex plus 1ex minus .2ex}{0em}
%\titlespacing*{\subparagraph} {\parindent}{3.25ex plus 1ex minus .2ex}{0em}


%%%Mini-toc settings%%%
\setlength{\mtcindent}{24pt}
\renewcommand{\mtcfont}{\small\rm}
\renewcommand{\mtcSfont}{\small\bf}
\renewcommand{\mtctitle}{}

%%%Chapter styles%%%
\newcommand\MyColor{black}
\xdefinecolor{chaptercolor}{named}{Bittersweet}
\xdefinecolor{numchapcolor}{named}{Violet}

\renewcommand{\cfttoctitlefont}{\hfill\huge\sc\bfseries\color{chaptercolor}}
\renewcommand{\cftaftertoctitle}{\hfill}
\renewcommand{\cftloftitlefont}{\hfill\huge\sc\bfseries\color{chaptercolor}}
\renewcommand{\cftafterloftitle}{\hfill}
\renewcommand{\cftlottitlefont}{\hfill\huge\sc\bfseries\color{chaptercolor}}
\renewcommand{\cftafterlottitle}{\hfill}

\makeatletter

\def\@makechapterhead#1{%
  \vspace*{50\p@}%
  {\parindent \z@ \centering\normalfont
    \ifnum \c@secnumdepth >\m@ne
      \if@mainmatter
         \huge\sc\bfseries \color{numchapcolor}Chapitre\space\thechapter\space
         | {\color{chaptercolor}#1}\par\nobreak \par\nobreak
        \vskip 20\p@
      \fi
    \fi
    \interlinepenalty\@M
    \vskip 40\p@
  }
  \minitoc
  \vspace{5ex}

  \markboth{\footnotesize\color{numchapcolor}Chapitre\space\thechapter\space
         | {\color{chaptercolor}#1}}{\color{red}Chapitre\space\thechapter\space
         | {\color{chaptercolor}#1}}
  }

\def\@makeschapterhead#1{%
  \vspace*{50\p@}%
  {\color{chaptercolor}\parindent \z@ \centering
    \normalfont
    \interlinepenalty\@M
    \Huge \sc\bfseries  #1\par\nobreak
    \vskip 40\p@
  }
  \markboth{\footnotesize #1}{\footnotesize #1}}

  \def\ps@headings{%
      \let\@oddfoot\@empty\let\@evenfoot\@empty
      \def\@evenhead{\thepage\hfil\slshape\leftmark}%
      \def\@oddhead{{\slshape\rightmark}\hfil\thepage}%
      \let\@mkboth\markboth
    \def\chaptermark##1{%
      \markboth {\footnotesize\color{numchapcolor}Chapitre\space
      \thechapter\space | {\color{chaptercolor} ##1}}{}}%
    \def\sectionmark##1{%
      \markright {\MakeUppercase{%
        \ifnum \c@secnumdepth >\z@
          \thesection \ %
        \fi
        ##1}}}}

\renewcommand \thefigure{\ifnum \c@chapter>\z@ \thechapter-\fi\@arabic\c@figure}

\makeatother

\renewcommand\thechapter{\Roman{chapter}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcommand{\titlestyleA}[1]{{\normalfont\Large\textbf{\uppercase{#1}}}}
\newcommand{\titlestyleB}[1]{{\normalfont\large\textsc{#1}}}
\newcommand{\titlestyleC}[1]{{\normalfont\textit{#1}}}

\newcommand{\titlespaceA}{\vspace{5mm}}
\newcommand{\titlenewline}{\vspace{\baselineskip}}

\renewcommand{\chaptermark}[1]{
	\markboth{\small
		\color{numchapcolor}\thechapter\space |
    	\color{chaptercolor}#1}{}
    }

\setcounter{secnumdepth}{4}
\setcounter{tocdepth}{2}
\setcounter{minitocdepth}{2}


\renewcommand\theparagraph{(\alph{paragraph})}

%% New colors %%
\definecolor{LightCyan}{rgb}{0.88,1,1}
Do I have some incompatible packages that implies that issue ?

Many thanks in advance.

Cheers, DC
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Errors with LOF and LOT in report class

Post by Johannes_B »

I couldn't quite reproduce you problem. A more minimal example would have been nice.

Please test the following and check if it works for you.

Code: Select all

\documentclass{report}
\usepackage{hyperref}
%\hypersetup{pageanchor=false}
\begin{document}
test
\pdfbookmark{\contentsname}{toc}\tableofcontents
\pagenumbering{arabic}
\section{Hi}
\begin{figure}
	\caption{Hallo hallo}
\end{figure}
\listoffigures
\end{document}
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
didierc
Posts: 5
Joined: Sun Aug 03, 2014 3:21 pm

Errors with LOF and LOT in report class

Post by didierc »

Hello,
The example provided by you works perfectly.

Here's a list of all packages used in my document...
May the tocloft have some effects on the list of figures ?

Code: Select all

\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[french]{babel}
\usepackage[top=30mm,bottom=25mm,right=25mm,left=25mm,a4paper]{geometry}
\usepackage{textcomp}
\usepackage{multicol}
\usepackage{setspace}
\usepackage{chapterbib}
\usepackage{pdflscape}
\usepackage{envmath}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage[inline]{enumitem}
\usepackage{cases}
\usepackage{subcaption}
\usepackage{stfloats}
\usepackage{diagbox}
\usepackage[none]{hyphenat}
\usepackage[pdftex,hidelinks,bookmarksdepth=4]{hyperref}
\usepackage[subfigure]{tocloft}
\usepackage{color, colortbl}
\usepackage[dvipsnames,svgnames]{xcolor}
\usepackage{eqnarray}
\usepackage{tabularx}
\usepackage{multirow}
\usepackage[nohints]{minitoc}
\usepackage{floatrow}
\usepackage{fmtcount}
\usepackage[round,authoryear]{natbib}
\usepackage{nextpage}
Cheers, DC
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Re: Errors with LOF and LOT in report class

Post by Johannes_B »

Just inserting your code does make the caption in the LOF dissappear. It all boils down to package floatrow. Do you need it?

Still, i didn't see what you describe.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
didierc
Posts: 5
Joined: Sun Aug 03, 2014 3:21 pm

Errors with LOF and LOT in report class

Post by didierc »

Hello,

Thanks for your suggestion.
I removed the floatrow package as I don't need it anymore. But it didn't have any effect.

I also disabled the tocloft package and all customizations for both sections and chapters and it seems to solve the problem.

Code: Select all

% \renewcommand{\cfttoctitlefont}{\hfill\huge\sc\bfseries\color{chaptercolor}}
% \renewcommand{\cftaftertoctitle}{\hfill}
% \renewcommand{\cftloftitlefont}{\hfill\huge\sc\bfseries\color{chaptercolor}}
% \renewcommand{\cftafterloftitle}{\hfill}
% \renewcommand{\cftlottitlefont}{\hfill\huge\sc\bfseries\color{chaptercolor}}
% \renewcommand{\cftafterlottitle}{\hfill}

% \addtolength\cftchapnumwidth{2mm}
% \addtolength\cftsecnumwidth{2mm}
% \renewcommand{\cftchapfont}{\bfseries\sc\bfseries}
% \renewcommand{\cftchappagefont}{\bfseries\sc\bfseries}
% \renewcommand{\cftsecfont}{\bfseries}
% \renewcommand{\cftsecpagefont}{\bfseries}
I still have just one tiny problem : as I have a huge amount of figures (figures are numbered using the III-10 format where III is the chapter number and 10 the figure number), the number sometimes overlaps the figure caption in the list of figures.

How can I increase the space allowed for the figure number in the LOF ?
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Errors with LOF and LOT in report class

Post by Johannes_B »

You can achieve that using package tocstyle from the KOMA-bundle. All the other stuff in the minimal example is just to simulate what you described. I did need to patch the report class in order to get the result, because i don't know how you did it. Please note, that this needs multiple LaTeX runs to completely adjust.

You will get a huge warning in your log-file cause package tocstyle is in an alpha state. I didn't hear anything wrong with it by now, so it should be safe to use.

have you ever considered to use a KOMA-class like scrreprt? In case you aren't 95 % finished it might be worth a look.

Code: Select all

\documentclass{report}
\usepackage[tocindentauto]{tocstyle}%JB <- this is what you need
\usepackage{capt-of}
\input{multido}
\usepackage{etoolbox}
\patchcmd{\thefigure}{\thechapter.}{\Roman{chapter}-}{}{}
\begin{document}
\listoffigures
\chapter{test}
\chapter{test}
\chapter{test}
\multido{\i=1+1}{120}{
	\captionof{figure}{Caption \i}
}
\end{document}
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
didierc
Posts: 5
Joined: Sun Aug 03, 2014 3:21 pm

Errors with LOF and LOT in report class

Post by didierc »

OK thanks.

After googling my request I did the trick using the following commands in the preamble.

Code: Select all

\makeatletter
\renewcommand*{\l@figure}{\@dottedtocline{1}{1.5em}{2.9em}}
\renewcommand*{\l@table}{\@dottedtocline{1}{1.5em}{2.9em}}
\makeatother


Thank you anyway for your answers which helped me solving my problem.
Best, DC
Post Reply