0

I am working on my thesis and it is due in 5 days. I have a problem with my Table of Contents, List of Figures and List of Tables. At the moment, all of my entries go over the margin and expend out of the page. Somehow, the some of the entries (long section title and long captions of figures or tables) are not being wrapped or breaking into multiple lines.

I have searched everywhere for a solution but couldn't found one. Below is my code with all of the packages I have included. Not sure if it is because some packages causing the problem.

\documentclass[a4paper, 12pt, fleqn]{report}
\usepackage{amsfonts, amsmath, amsgen, amsopn, amssymb, amstext, enumitem, accents, amsthm, bm} %  bezier, amsxtra, amsbsy, amsgen, amsopn, amscd, latexsym, enumitem,
\usepackage{array} % mdwtab, mdwmath, url
%\usepackage[{graphicx,color}
\usepackage{epstopdf}
\usepackage{graphicx} % Required for including pictures
\graphicspath{{../pdf/}{../tif/}{../jpeg/}{./image/}{../eps/}}
\DeclareGraphicsExtensions{.pdf,.jpeg,.png,.jpg,.tif,.eps}
\usepackage{float}
% \usepackage{ntheorem}
\usepackage{multirow}
\usepackage{tabularx}
\usepackage{stfloats}
\usepackage[space,sort]{cite} %nobreak option removed
\usepackage{setspace}
\usepackage{nomencl}
\usepackage[mathscr]{eucal}
\usepackage{mathtools}
\usepackage{appendix}
\usepackage{textcomp}
\usepackage{notoccite}
\usepackage[top=3.81cm, bottom=3.81cm, left=3.81cm, right=3.81cm]{geometry}
\usepackage{cite}
\usepackage{subfigure}
\usepackage{graphicx}
\usepackage{nomencl}
\usepackage{glossaries}
\usepackage{eurosym}

\usepackage{hyperref}

\usepackage{calc}       % For indent of label in description
\usepackage{enumitem}   % For indent of label in description
\usepackage[table]{xcolor}     % For cell colours
\usepackage{commath}    % For "absolute" symbol "||"
\usepackage{ulem}       % For creating underline
\usepackage[toctitles]{titlesec}

%% Below is for creating overline
\newcommand*\oline[1]{%
   \vbox{%
     \hrule height 0.5pt%                  % Line above with certain width
     \kern0.25ex%                          % Distance between line and content
     \hbox{%
       \kern-0.1em%                        % Distance between content and left side of box, negative values for lines shorter than content
       \ifmmode#1\else\ensuremath{#1}\fi%  % The content, typeset in dependence of mode
       \kern-0.1em%                        % Distance between content and left side of box, negative values for lines shorter than content
     }% end of hbox
   }% end of vbox
}


\hypersetup{
colorlinks = true,
citecolor = black,
linkcolor = black
}

%setcounter{tocdepth}{3}% Include \subsubsection in ToC
\setcounter{secnumdepth}{4}% Number \subsubsection

\tolerance=10000
\hyphenpenalty =1000

\newtheorem{theorem}{Theorem}[chapter]
\newtheorem{lemma}{Lemma}[chapter]
\newtheorem{assum}{Assumption}[chapter]
\newtheorem{assumption}{Assumption}[chapter]
\newtheorem{proposition}{Proposition}[chapter]
\newtheorem{definition}{Definition}[chapter]
\newtheorem{corollary}{Corollary}[chapter]
\newtheorem{notation}{Notation}[chapter]
\newtheorem{remark}{Remark}[chapter]
\newtheorem{rem}{Remark}[chapter]
\newtheorem{example}{Example}[chapter]
\newtheorem{problem}{Problem}[chapter]
\newtheorem{algorithm}{Algorithm}[chapter]
\newtheorem{property}{Property}[chapter]
\newtheorem{design_strategy}{Design Strategy}[chapter]

\makenomenclature
\begin{document}

\cleardoublepage \addcontentsline{toc}{chapter}{Table of Contents} \tableofcontents
\cleardoublepage\addcontentsline{toc}{chapter}{List of Tables} \listoftables
\cleardoublepage\addcontentsline{toc}{chapter}{List of Figures} \listoffigures

\end{document}

Please advise me what to do.

Thank you so much!

Tommy

  • 1
    Welcome to TeX.SX! Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – user36296 Jan 14 '18 at 13:11
  • If I add some long entries to your example code, they nicely wrap. Can you please add an example which does not warp lines? – user36296 Jan 14 '18 at 13:13
  • Hi Thank you so much for the quick response. I have tried adding two lines (chapter and section to it) and see if it wraps – user1127763 Jan 14 '18 at 14:54
  • 1
    Can you modify the code in your question to show us the missing wrapping? – user36296 Jan 14 '18 at 14:59
  • i.stack.imgur.com/XGmoz.png is what I get if I compile the code from your non-answer below (after removing the lines with \input because I do have your files) – user36296 Jan 14 '18 at 15:05
0

As already indicated by John Kormylo this is most likely due to an interaction of hyperref with the compiler you use. To fix this you have several options:

  1. Explicitly use pdflatex
  2. Use the hyperref option linktocpage=true to turn the page numbers in the toc into hyperlinks instead of the chapter titles.
  3. If you want to / have to use the latex compiler instead and want to keep the titles hyperlinked, you can include the hypdvips package after loading hyperref to enable linebreaks inside hyperlinks.

Note: In all cases keep in mind the correct loading order of packages: hyperref should generally (with a few exceptions) be loaded last.

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.