Adding list of figure/list of table pushing away the mitoc of one chapter to another in latex - latex

I am using an existing template in Latex and trying to modify it according to my needs. This is how the code looks like and everything works fine, minitoc also works fine.
% Instead of "de" you can also use "en" if the work is written in English
% Either "darkstyle" or "lightstyle"
\documentclass[en, darkstyle]{unirostock}
% For the sources, more information https://de.overleaf.com/learn/latex/Bibliography_management_with_biblatex
\usepackage[backend=biber,style=ieee,maxbibnames=99,backref=true,citestyle=ieee]{biblatex}
\addbibresource{lit.bib}
% creative-commons: Creative Commons license, attribution - redistribution permitted under the same conditions
% private: publication and modification only after consultation with the author
\license{creative-commons}
\author{}
\enrolmentnumber{123456789} % Matrikelnummer
\title{}
\type{}
\course{}
\workperiod{}
\supervisor{}
\primaryreviewer{}
\secondaryreviewer{} % Falls es keinen gibt, einfach weglassen
\faculty{}
\institute{}
\workinggroup{}
\begin{document}
\maketitle
\makelicense
\pagenumbering{Roman}
\setstretch{1.263}
\pagenumbering{gobble}
\include{chapter/abstract}
\pagenumbering{arabic}
\clearpage
\tableofcontents
\clearpage
\include{chapter/introduction.tex}
\include{chapter/background.tex}
\include{chapter/analysis.tex}
\include{chapter/implmentation.tex}
\include{chapter/evaluation.tex}
\include{chapter/conclusion-future-work.tex}
% List of figures
\clearpage
\phantomsection
\addcontentsline{toc}{chapter}{List of Figures}
\listoffigures
% List of tables
\clearpage
\phantomsection
\addcontentsline{toc}{chapter}{List of Tables}
\listoftables
\cleardoublepage
\phantomsection
\addcontentsline{toc}{chapter}{Bibliography}
\printbibliography
\clearpage
\include{chapter/declaration}
\end{document}
But if I want to add the list of figures and list of tables before the chapter, like this
\clearpage
\tableofcontents
% List of figures
\clearpage
\phantomsection
\addcontentsline{toc}{chapter}{List of Figures}
\listoffigures
% List of tables
\clearpage
\phantomsection
\addcontentsline{toc}{chapter}{List of Tables}
\listoftables
\clearpage
\include{chapter/introduction.tex}
\include{chapter/background.tex}
\include{chapter/analysis.tex}
\include{chapter/implmentation.tex}
\include{chapter/evaluation.tex}
\include{chapter/conclusion-future-work.tex}
then the minitoc of first chapter is showing nothing.
and it is appearing on third chapter.
That means minitoc of one chapter is appearing after two chapter and it continues.
This is the code of minitoc.
\newcommand{\printmyminitoc}[1]{%
\vspace{-2cm}%
\noindent\hspace{-4.5cm}%
\colorlet{black}{white}%
\begin{tikzpicture}
\node[rounded corners,align=left,fill=uniblau, blur shadow={shadow blur steps=5}, inner sep=5mm]{%
\hspace{3.8cm}
\color{white}%
\begin{minipage}{8.5cm}%minipage trick
\hypersetup{linkcolor=white}
\minitoc
\hypersetup{linkcolor=uniblau}
\end{minipage}};
\end{tikzpicture}
\vspace{1cm}%
}
Could someone help about this issue. I am almost new in Latex.

Related

page numbering in tabel of contents

The table of contents has to be renumbered. I am using a template from overleaf. I have seen thorough old posts but none have helped. The roman numeral numbering starts right from the dedication and stops at publications. I need the roman numerals to start from the abstract and stop at publications and the remaining table of contents to remain intact.
I have tried changing the
\begin{romanpages}
command to different places but doesn't work.
MWE of my code from overleaf is given below
PhDthesis.cls has the following
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{PhDthesis}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{book}}
\ProcessOptions\relax
\LoadClass[12pt,a4paper]{book}
\documentclass{0_ClassFiles/PhDthesis}
\begin{document}
\onehalfspacing
\include{2_Title/title}
\makethesistitle
\begin{romanpages}
%%%% --------------- Uncomment in Final version ---------------
\phantomsection
\include{3_Dedication/Dedication}
\phantomsection
\include{6_Declaration/Declaration}
\phantomsection
\include{5_Certificate/Certificate}
\phantomsection
\include{7_Acknowledgement/Acknowledgement}
\phantomsection
\include{8_Abstract/Abstract}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{2}
\tableofcontents
\newcommand{\figname}{List of Figures}
\phantomsection
\addcontentsline{toc}{chapter}{\figname}
\listoffigures
\newcommand{\tabname}{List of Tables}
\fancyhead[RE]{\bfseries \tabname}
\fancyhead[LO]{\bfseries \tabname}
\phantomsection
\addcontentsline{toc}{chapter}{\tabname}
\listoftables
\phantomsection
\include{12_Publication/Publication}
\end{romanpages}
\include{10a_Introduction/Introduction}
\include{10b_Chapter2/Chapter2}% Related Work
\include{10c_Chapter3/Chapter3}
\include{10d_Chapter4/Chapter4}
\include{10e_Chapter5/Chapter5}
\include{10z_Conclusions/Conclusions}
\bibliographystyle{agsm}
%\bibliographystyle{IEEEtran}
\renewcommand\bibname{Bibliography}
\fancyhead[RE]{\bfseries Bibliography}
\fancyhead[LO]{\bfseries Bibliography}
\phantomsection
\addcontentsline{toc}{chapter}{\bibname}
\bibliography{scopus}
\fancyhead[RE]{\bfseries Appendices}
\fancyhead[LO]{\bfseries\rightmark}
\include{11_Appendices/Appendices}
\onehalfspacing
\end{document}

Paragraph page number misalignment in table of contents

I am using the Ph.D. dissertation .cls file. When I create a paragraph there is a misalignment in the paragraph page number in TOC.
Below is the minimal code:
\documentclass[final]{USC-Thesis_Minimal}
\usepackage[lofdepth,lotdepth,caption=false]{subfig}
\begin{document}
\title{Some title}
\author{Some Name}
\major{Some Engineering}
\month{May}
\year{2019}
\setcounter{secnumdepth}{5}
\setcounter{tocdepth}{5}
\maketitle
% Table Of Contents
\cleardoublepage\phantomsection
\renewcommand{\contentsname}{Table of Contents}
\tableofcontents
% List of tables
\listoftables
% List of figures
\listoffigures
% Begin Body
\mainmatter
\chapter{Chapter 1}
\section{A very long section, very long text section}
\subsection{A very long subsection, very long text subsection}
\subsubsection{A very long subsubsection Very long text subsubsection}
\paragraph{A long paragraph}
\end{document}
Below is the relevant part of the cls file.
%Margins of Table of Contents - so that the page listings for toc do
%not align with page number
\cftsetrmarg{0.7in}
\newlength{\numtomarg}
\setlength{\numtomarg}{0.2in}
\renewcommand{\cftchapafterpnum}{\hspace{\numtomarg}\mbox{}}
\renewcommand{\cftsecafterpnum}{\hspace{\numtomarg}\mbox{}}
\renewcommand{\cftsubsecafterpnum}{\hspace{\numtomarg}\mbox{}}
\renewcommand{\cftsubsubsecafterpnum}{\hspace{\numtomarg}\mbox{}}
\renewcommand{\cftfigafterpnum}{\hspace{\numtomarg}\mbox{}}
\renewcommand{\cftsubfigafterpnum}{\hspace{\numtomarg}\mbox{}}
\renewcommand{\cfttabafterpnum}{\hspace{\numtomarg}\mbox{}}
\renewcommand{\cftsubtabafterpnum}{\hspace{\numtomarg}\mbox{}}
I couldn't find an alternative for the paragraph. Similar to:
\renewcommand{\cftparagraphafterpnum}{\hspace{\numtomarg}\mbox{}}
Here is the link to the class file. Can somebody please help me to fix this issue?
Using the below LaTeX command did the trick:
\renewcommand{\cftparaafterpnum}{\hspace{\numtomarg}\mbox{}}

LaTeX hyperref link goes to wrong page when i clicked at the content there

i would like to ask how to use the \hyperref because i've googled loads of loads of answers but i can't find. i've created my own TOC. then i included \hyperref package. Then the contents are automatically hyperlinks which is good. but then it went to the wrong pages. i've googled a lot but i couldn't find answer. The contents that i clicked goes to the wrong page.
\documentclass[10pt,a4paper]{report}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{enumerate}
\usepackage{hyperref}
% %\usepackage[colorlinks]{hyperref}
% %\renewcommand*{\contentsname}{\hyperlink{contents}{Contents}}
% %\renewcommand*{\contentsname}{\hyperref[contents]{\arabic{page}}}
\begin{document}
\input{coverPage}
\maketitle
\tableofcontents
\addcontentsline{toc}{chapter}{Table of Contents}
\pagebreak
\addcontentsline{toc}{chapter}{List of Figures}
\listoffigures
\pagebreak
% % (1) ==============================================
\setcounter{chapter}{1}
\addcontentsline{toc}{chapter}{1. Introduction}
\input{introduction}
\pagebreak
\addcontentsline{toc}{chapter}{2. References}
\input{references}
\pagebreak
\addcontentsline{toc}{chapter}{3. Glossary}
\input{glossary}
\pagebreak
\end{document}
The issue here is that \chapter sets itself on a new page, so issuing \addcontentsline{toc}{chapter}{<chapter title>} before \chapter may point to an incorrect page.
Also, your \tableofcontents might be more than a single page. So, issuing \addcontentsline{toc}{chapter}{Table of Contents} after \tableofcontents - a \chapter* - might again point to an incorrect page.
The best solution is to use the following setup:
\cleardoublepage
\addcontentsline{toc}{chapter}{<chapter title>}
% <your \chapter or \chapter*>
This will ensure that \addcontentsline is issued on the same page as \chapter or \chapter*.

Latex - \addsec and headsepline

When I write \addsec{Acronymes}, LaTeX puts it in the Table of Contents and DOES the headsepline section. When I write \addsec*{Acronymes}, LaTeX doesnt put it in the Table of Contents and doesnt write it in the headsepline section. But I want that it doesnt appears in the Table of Contents and does appear in the headsepline.
So how do it?
Thats what I've done for this:
\documentclass[a4paper, 12pt, german, headsepline, footsepline, listtotoc, bibtotoc] {scrartcl}
\bibliographystyle{annotate}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[ansinew]{inputenc}
\usepackage[ngerman]{babel}
\usepackage[babel, german=quotes]{csquotes}
\usepackage[printonlyused]{acronym}
%head and footsepline
\usepackage[headsepline,plainheadsepline]{scrpage2}
\clearscrheadfoot
\pagestyle{scrheadings}
\automark[subsection]{section}
\ihead{my title}
\ohead{\headmark}
\ifoot{my name}
\ofoot{\pagemark}
\usepackage{hyperref}
\hypersetup{
colorlinks,
citecolor=blue,
filecolor=blue,
linkcolor=blue,
urlcolor=blue
}
\begin{document}
\input{include/Abstract}
\newpage
\tableofcontents
\newpage
\listoffigures
\newpage
\listoftables
\newpage
\addsec*{Acronymes}
%\addsec{Acronymes}
\begin{acronym}
\acro{HTTP}{Hypertext Transfer Protocol}
\end{acronym}
\end{document}
You can momentarily remove the functionality of \addcontentsline - the macro in charge of adding elements to the ToC - using
{% \begingroup
\renewcommand{\addcontentsline}[3]{}% Remove functionality of \addcontentsline
\addsec{Acronymes}%
}% \endgroup
Grouping via { and } ensure that the command redefinitions are restored after the group ends.

No page number for divider pages in LaTeX

I have a report in LaTeX, and i have used the following commands to create my Appendix, however, my lecturer states that any divider pages should be unnumbered.
\documentclass{report}
\usepackage{appendix}
\begin{document}
\include{chap1}
\include{appendix}
\end{document}
Then in appendix.tex
\appendix
\pagestyle{empty}
\appendixpage
\noappendicestocpagenum
\addappheadtotoc
This creates the Appendices divider page, but still puts a page number on it in the footer. There is no page number in the TOC, as expected.
How can I remove it from the footer?
I looked at the appendix.sty source, and I see the problem: line 74, in the definition of \#chap#pppage, issues a \thispagestyle{plain} command, thus overriding your \pagestyle{empty} for this page. The inelegant but direct way to fix this is to redefine the command without this line - issue the following code after importing the package.
Revised, tested version
\documentclass{report}
\usepackage{appendix}
%==== The action ================
\makeatletter
\def\#chap#pppage{%
\clear#ppage
\if#twocolumn\onecolumn\#tempswatrue\else\#tempswafalse\fi
\null\vfil
\markboth{}{}%
{ \centering \interlinepenalty \#M
\normalfont \Huge \bfseries \appendixpagename\par}%
\if#dotoc#pp\addappheadtotoc\fi
\vfil\newpage
\if#twoside
\if#openright \null \thispagestyle{empty}\newpage\fi
\fi
\if#tempswa \twocolumn\fi
}
\makeatother
%==== Back to the document ========
\begin{document}
\tableofcontents
\chapter{Blah}
Rhubarb, rhubarb, rhubarb.
\appendix
\pagestyle{empty}
\appendixpage
\noappendicestocpagenum
\addappheadtotoc
\chapter{Boff}
Cabbages, cabbages, cabbages.
\end{document}
The TeX FAQ might come in handy here:
I asked for “empty”, but the page is numbered
If you use \pagestyle{empty} and you
find some pages are numbered anyway,
you are probably encountering one of
the style decisions built into the
standard LaTeX classes: that certain
special pages should always appear
with \pagestyle{plain}, with a page
number at the centre of the page foot.
The special pages in question are
those (in article class) containing a
\maketitle, or (in book and report
classes) \chapter or \part commands.
The simple solution is to reissue the
page style after the command, with
effect for a single page, as, for
example (in article):
\maketitle
\thispagestyle{empty}
So give adding \thispagestyle{empty} after your \appendix a try.
try changing \pagestyle{empty} to \thispagestyle{empty} and put it after \addappheadtotoc.
Try instead:
\pagenumbering{gobble}
\begin{appendices} \newpage
\clearpage
\pagenumbering{arabic}
\addtocounter{page}{100}
\tableofcontents
\newpage
*Special thanks to https://tex.stackexchange.com/questions/6639/removing-page-numbers-but-not-headers!

Resources