LaTeX forum ⇒ Graphics, Figures & TablesErrors with LOF and LOT in report class Topic is solved

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

Errors with LOF and LOT in report class

Postby didierc » Sun Aug 03, 2014 3:33 pm

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

User avatar
Stefan Kottwitz
Site Admin
Posts: 9281
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Sun Aug 03, 2014 6:31 pm

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
Site admin

didierc
Posts: 5
Joined: Sun Aug 03, 2014 3:21 pm

Postby didierc » Sun Aug 03, 2014 8:44 pm

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.

  1. \documentclass[a4paper,12pt,twoside]{report}
  2. %\inputonly{chap1, chap3}
  3.  
  4. \usepackage[latin1]{inputenc}
  5.  
  6. \usepackage[round,authoryear]{natbib}
  7.  
  8. \usepackage{myenv}
  9. \geometry{top=30mm,bottom=25mm,left=25mm,right=25mm}
  10.  
  11. \usepackage{textcomp}
  12. \usepackage{multicol}
  13. \usepackage{setspace}
  14. \usepackage{chapterbib}
  15. \usepackage{pdflscape}
  16. \usepackage{envmath}
  17. \usepackage{amsmath}
  18. \usepackage[T1]{fontenc}
  19. \usepackage[inline]{enumitem}
  20. \usepackage{cases}
  21. \usepackage{subcaption}
  22. \usepackage{stfloats}
  23. \usepackage{diagbox}
  24. \usepackage[none]{hyphenat}
  25. \usepackage[pdftex,hidelinks,bookmarksdepth=4]{hyperref}
  26.  
  27. \newcommand{\nc}{\vspace{0.5cm}}
  28. \newcommand{\np}{\newpage}
  29. \newcommand\eq[1]{(\ref{eq#1})}
  30.  
  31. %\usepackage{url}
  32.  
  33. \graphicspath{{../illustrations/}}
  34. \definecolor{Gray}{gray}{0.9}
  35.  
  36. \frenchbsetup{ReduceListSpacing=false, StandardItemizeEnv=true,
  37. StandardEnumerateEnv=true, StandardItemLabels=true}
  38.  
  39. \pdfminorversion=6
  40. \pdfcompresslevel=9
  41. \pdfobjcompresslevel=9
  42.  
  43.  
  44. \setcounter{secnumdepth}{5}
  45. \renewcommand\thesubparagraph{\textbf{(\roman{subparagraph})}}
  46.  
  47. \setlength{\headheight}{20pt}
  48.  
  49. \begin{document}
  50.  
  51. \input{Titre}
  52.  
  53. \dominitoc
  54.  
  55. \cleartooddpage
  56. \input{chapitres/Remerciements}
  57.  
  58. \cleartooddpage
  59. \input{chapitres/Resume}
  60.  
  61. \cleartooddpage
  62. \input{chapitres/Abstract}
  63.  
  64. \cleartooddpage
  65. \pdfbookmark[0]{Table des matières}{tableofcontents}\tableofcontents
  66.  
  67. \cleartooddpage
  68. \pagenumbering{arabic}
  69. \setcounter{page}{1}
  70.  
  71. %\input{chapitres/chapitre1}
  72. \input{chapitres/chapitre2}
  73. %\input{chapitres/chapitre3}
  74. %\input{chapitres/chapitre4}
  75. %\input{chapitres/chapitre5}
  76.  
  77. \newpage
  78. \addcontentsline{toc}{chapter}{\bibname}
  79. \bibliographystyle{abbrvnat}
  80. \bibliography{ ../bib/bibtex}
  81.  
  82.  
  83. \cleartooddpage
  84. \listoffigures
  85.  
  86. \cleartooddpage
  87. \listoftables
  88.  
  89.  
  90. \end{document}


The myenv package is one package I created with my settings for all my documents. It contains :

  1. \NeedsTeXFormat{LaTeX2e}
  2.  
  3. \ProvidesPackage{myenv}[2013/07/22 Personal extension with common settings, V1.0]
  4.  
  5.  
  6. %%PACKAGES%%
  7.  
  8. \RequirePackage{standalone}
  9. \RequirePackage[top=25mm,bottom=25mm,right=25mm,left=25mm,a4paper]{geometry}
  10. \RequirePackage[french]{babel}
  11. \RequirePackage[T1]{fontenc}
  12. \RequirePackage{graphicx,epstopdf}
  13. \RequirePackage{setspace}
  14. \RequirePackage{lipsum}
  15. \RequirePackage{fancyhdr,fancybox}
  16. \RequirePackage{amsmath,amssymb}
  17. %\RequirePackage[scaled]{helvet}
  18. %\RequirePackage{arevmath}
  19. \RequirePackage[subfigure]{tocloft}
  20.  
  21. \RequirePackage{color, colortbl}
  22. \RequirePackage[dvipsnames,svgnames]{xcolor}
  23.  
  24. \RequirePackage{eqnarray}
  25. \RequirePackage{tabularx}
  26. \RequirePackage{multirow}
  27. \RequirePackage[nohints]{minitoc}
  28. \RequirePackage{floatrow}
  29. %\RequirePackage{lastbib}
  30.  
  31. \RequirePackage{fmtcount}
  32.  
  33. % \RequirePackage{slashbox}
  34. % \RequirePackage{booktabs}
  35. %
  36. % \RequirePackage{makecell}
  37. %
  38. % %\RequirePackage{titlesec}
  39. %
  40. % \RequirePackage{rotating}
  41. \RequirePackage{nextpage}
  42. %
  43. % \RequirePackage{datetime}
  44.  
  45. \pretolerance=150
  46. \tolerance=10000
  47. \hbadness=10000
  48. \hfuzz=30pt
  49. \emergencystretch=0em
  50.  
  51.  
  52. \setlength{\headheight}{15pt}
  53. \setlength{\parskip}{1mm plus2mm}
  54.  
  55. %%%% HEADER/FOOTER %%%%%
  56.  
  57. \pagestyle{fancyplain}
  58.  
  59. \fancyhf{}
  60. \fancyhead[EL,OR]{\nouppercase{\color{chaptercolor}\small\bfseries\sc\leftmark}}
  61. \fancyfoot[EL,OR]{\thepage}
  62. \fancyfoot[ER,OL]{\tiny\sc XXX}
  63. \renewcommand{\headrulewidth}{0pt}
  64. \renewcommand{\footrulewidth}{0pt}
  65.  
  66.  
  67. %%NEW ENVIRONMENTS AND COMMANDS%%%
  68.  
  69. \newlength{\arrayrulewidthOriginal}
  70. \newcommand{\Cline}[2]{%
  71. \noalign{\global\setlength{\arrayrulewidthOriginal}{\arrayrulewidth}}%
  72. \noalign{\global\setlength{\arrayrulewidth}{#1}}\cline{#2}%
  73. \noalign{\global\setlength{\arrayrulewidth}{\arrayrulewidthOriginal}}}
  74.  
  75. %%%Editing chapter and section styles%%%
  76. \addtolength\cftchapnumwidth{2mm}
  77. \addtolength\cftsecnumwidth{2mm}
  78. \renewcommand{\cftchapfont}{\bfseries\sc\bfseries}
  79. \renewcommand{\cftchappagefont}{\bfseries\sc\bfseries}
  80. \renewcommand{\cftsecfont}{\bfseries}
  81. \renewcommand{\cftsecpagefont}{\bfseries}
  82.  
  83. %%%Editing paragraph styles%%%
  84. %\titleformat{\paragraph}{\normalfont\normalsize\bfseries}{\theparagraph}{1em}{}
  85. %\titleformat{\subparagraph}{\normalfont\normalsize\bfseries}{\thesubparagraph}{1em}{}
  86. %\titlespacing*{\paragraph}{0pt}{3.25ex plus 1ex minus .2ex}{0em}
  87. %\titlespacing*{\subparagraph} {\parindent}{3.25ex plus 1ex minus .2ex}{0em}
  88.  
  89.  
  90. %%%Mini-toc settings%%%
  91. \setlength{\mtcindent}{24pt}
  92. \renewcommand{\mtcfont}{\small\rm}
  93. \renewcommand{\mtcSfont}{\small\bf}
  94. \renewcommand{\mtctitle}{}
  95.  
  96. %%%Chapter styles%%%
  97. \newcommand\MyColor{black}
  98. \xdefinecolor{chaptercolor}{named}{Bittersweet}
  99. \xdefinecolor{numchapcolor}{named}{Violet}
  100.  
  101. \renewcommand{\cfttoctitlefont}{\hfill\huge\sc\bfseries\color{chaptercolor}}
  102. \renewcommand{\cftaftertoctitle}{\hfill}
  103. \renewcommand{\cftloftitlefont}{\hfill\huge\sc\bfseries\color{chaptercolor}}
  104. \renewcommand{\cftafterloftitle}{\hfill}
  105. \renewcommand{\cftlottitlefont}{\hfill\huge\sc\bfseries\color{chaptercolor}}
  106. \renewcommand{\cftafterlottitle}{\hfill}
  107.  
  108. \makeatletter
  109.  
  110. \def\@makechapterhead#1{%
  111. \vspace*{50\p@}%
  112. {\parindent \z@ \centering\normalfont
  113. \ifnum \c@secnumdepth >\m@ne
  114. \if@mainmatter
  115. \huge\sc\bfseries \color{numchapcolor}Chapitre\space\thechapter\space
  116. | {\color{chaptercolor}#1}\par\nobreak \par\nobreak
  117. \vskip 20\p@
  118. \fi
  119. \fi
  120. \interlinepenalty\@M
  121. \vskip 40\p@
  122. }
  123. \minitoc
  124. \vspace{5ex}
  125.  
  126. \markboth{\footnotesize\color{numchapcolor}Chapitre\space\thechapter\space
  127. | {\color{chaptercolor}#1}}{\color{red}Chapitre\space\thechapter\space
  128. | {\color{chaptercolor}#1}}
  129. }
  130.  
  131. \def\@makeschapterhead#1{%
  132. \vspace*{50\p@}%
  133. {\color{chaptercolor}\parindent \z@ \centering
  134. \normalfont
  135. \interlinepenalty\@M
  136. \Huge \sc\bfseries #1\par\nobreak
  137. \vskip 40\p@
  138. }
  139. \markboth{\footnotesize #1}{\footnotesize #1}}
  140.  
  141. \def\ps@headings{%
  142. \let\@oddfoot\@empty\let\@evenfoot\@empty
  143. \def\@evenhead{\thepage\hfil\slshape\leftmark}%
  144. \def\@oddhead{{\slshape\rightmark}\hfil\thepage}%
  145. \let\@mkboth\markboth
  146. \def\chaptermark##1{%
  147. \markboth {\footnotesize\color{numchapcolor}Chapitre\space
  148. \thechapter\space | {\color{chaptercolor} ##1}}{}}%
  149. \def\sectionmark##1{%
  150. \markright {\MakeUppercase{%
  151. \ifnum \c@secnumdepth >\z@
  152. \thesection \ %
  153. \fi
  154. ##1}}}}
  155.  
  156. \renewcommand \thefigure{\ifnum \c@chapter>\z@ \thechapter-\fi\@arabic\c@figure}
  157.  
  158. \makeatother
  159.  
  160. \renewcommand\thechapter{\Roman{chapter}}
  161.  
  162. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  163.  
  164. \newcommand{\titlestyleA}[1]{{\normalfont\Large\textbf{\uppercase{#1}}}}
  165. \newcommand{\titlestyleB}[1]{{\normalfont\large\textsc{#1}}}
  166. \newcommand{\titlestyleC}[1]{{\normalfont\textit{#1}}}
  167.  
  168. \newcommand{\titlespaceA}{\vspace{5mm}}
  169. \newcommand{\titlenewline}{\vspace{\baselineskip}}
  170.  
  171. \renewcommand{\chaptermark}[1]{
  172. \markboth{\small
  173. \color{numchapcolor}\thechapter\space |
  174. \color{chaptercolor}#1}{}
  175. }
  176.  
  177. \setcounter{secnumdepth}{4}
  178. \setcounter{tocdepth}{2}
  179. \setcounter{minitocdepth}{2}
  180.  
  181.  
  182. \renewcommand\theparagraph{(\alph{paragraph})}
  183.  
  184. %% New colors %%
  185. \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: 3952
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Tue Aug 05, 2014 10:49 am

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.
  1. \documentclass{report}
  2. \usepackage{hyperref}
  3. %\hypersetup{pageanchor=false}
  4. \begin{document}
  5. test
  6. \pdfbookmark{\contentsname}{toc}\tableofcontents
  7. \pagenumbering{arabic}
  8. \section{Hi}
  9. \begin{figure}
  10. \caption{Hallo hallo}
  11. \end{figure}
  12. \listoffigures
  13. \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

Postby didierc » Tue Aug 05, 2014 7:14 pm

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 ?

  1. \usepackage[latin1]{inputenc}
  2. \usepackage[T1]{fontenc}
  3. \usepackage[french]{babel}
  4. \usepackage[top=30mm,bottom=25mm,right=25mm,left=25mm,a4paper]{geometry}
  5. \usepackage{textcomp}
  6. \usepackage{multicol}
  7. \usepackage{setspace}
  8. \usepackage{chapterbib}
  9. \usepackage{pdflscape}
  10. \usepackage{envmath}
  11. \usepackage{amsmath}
  12. \usepackage{amssymb}
  13. \usepackage[inline]{enumitem}
  14. \usepackage{cases}
  15. \usepackage{subcaption}
  16. \usepackage{stfloats}
  17. \usepackage{diagbox}
  18. \usepackage[none]{hyphenat}
  19. \usepackage[pdftex,hidelinks,bookmarksdepth=4]{hyperref}
  20. \usepackage[subfigure]{tocloft}
  21. \usepackage{color, colortbl}
  22. \usepackage[dvipsnames,svgnames]{xcolor}
  23. \usepackage{eqnarray}
  24. \usepackage{tabularx}
  25. \usepackage{multirow}
  26. \usepackage[nohints]{minitoc}
  27. \usepackage{floatrow}
  28. \usepackage{fmtcount}
  29. \usepackage[round,authoryear]{natbib}
  30. \usepackage{nextpage}


Cheers, DC

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

Postby Johannes_B » Tue Aug 05, 2014 7:26 pm

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

Postby didierc » Tue Aug 05, 2014 7:59 pm

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.

  1. % \renewcommand{\cfttoctitlefont}{\hfill\huge\sc\bfseries\color{chaptercolor}}
  2. % \renewcommand{\cftaftertoctitle}{\hfill}
  3. % \renewcommand{\cftloftitlefont}{\hfill\huge\sc\bfseries\color{chaptercolor}}
  4. % \renewcommand{\cftafterloftitle}{\hfill}
  5. % \renewcommand{\cftlottitlefont}{\hfill\huge\sc\bfseries\color{chaptercolor}}
  6. % \renewcommand{\cftafterlottitle}{\hfill}
  7.  
  8. % \addtolength\cftchapnumwidth{2mm}
  9. % \addtolength\cftsecnumwidth{2mm}
  10. % \renewcommand{\cftchapfont}{\bfseries\sc\bfseries}
  11. % \renewcommand{\cftchappagefont}{\bfseries\sc\bfseries}
  12. % \renewcommand{\cftsecfont}{\bfseries}
  13. % \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: 3952
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Tue Aug 05, 2014 10:14 pm

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.


  1. \documentclass{report}
  2. \usepackage[tocindentauto]{tocstyle}%JB <- this is what you need
  3. \usepackage{capt-of}
  4. \input{multido}
  5. \usepackage{etoolbox}
  6. \patchcmd{\thefigure}{\thechapter.}{\Roman{chapter}-}{}{}
  7. \begin{document}
  8. \listoffigures
  9. \chapter{test}
  10. \chapter{test}
  11. \chapter{test}
  12. \multido{\i=1+1}{120}{
  13. \captionof{figure}{Caption \i}
  14. }
  15. \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

Postby didierc » Tue Aug 05, 2014 11:06 pm

OK thanks.

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

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


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


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: No registered users and 7 guests