create link on every page of latex file to a specific page - latex

I want to create a link on every page of a latex file, and this link should navigate to a specific page in the documents. Like, create a link for \listoftodos command on every page, so that one can easily navigate to it.
MWE
\documentclass[]{article}
%opening
\title{}
\author{}
\usepackage[draft, colorinlistoftodos]{todonotes}
\begin{document}
\section{one}
\todo[inline]{todo 1}
\newpage
\section{two}
\todo[inline]{todo 2}
\newpage
\listoftodos
\end{document}

One possibility: use the fancyhdr package and add a link to the head or footline:
\documentclass[]{article}
%opening
\title{}
\author{}
\usepackage[draft, colorinlistoftodos]{todonotes}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\fancypagestyle{plain}[fancy]{}
\renewcommand{\headrulewidth}{0pt}
\cfoot{\protect\hyperlink{todolist}{jump to todo list}}
\usepackage{hyperref}
\begin{document}
\section{one}
\todo[inline]{todo 1}
\newpage
\section{two}
\todo[inline]{todo 2}
\newpage
\phantomsection
\hypertarget{todolist}{}
\listoftodos
\end{document}

Related

Title page Errors

% Thesis master document
\documentclass[final,12pt,a4paper,oneside]{book}
\setcounter{secnumdepth}{3}
\textheight =24.2 cm
\textwidth =15 cm
\topmargin =-15mm
\usepackage[round]{natbib}
\usepackage{amssymb}
\usepackage{graphics}
\usepackage{graphicx}
\usepackage{epsfig}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{bm}
\usepackage{layout}
\usepackage {mathrsfs}
\usepackage{listings}
\usepackage{float}
\def\hang{\hangindent\parindent}
\def\rf{\par\noindent\hang}
\newtheorem{defin}{Definition}
\newtheorem{theorem}{Theorem}
\newtheorem{result}{Result}
\begin{document}
\baselineskip = 18pt
\pagestyle{plain}
\frontmatter
\include{Title}
\maketitle
\tableofcontents
\listoftables
%\listoffigures
\include{Introduction}
\mainmatter
\include{Chapter1}
\include{Chapter2}
\include{Chapter3}
\include{Chapter4}
\include{Conclusion}
%\include{Appendix}
\backmatter
\include{Bibliography}
\end{document}
I've got the above code in my masterfile as part of my thesis due today. it has been executing properly until now. I accidently deleted the \maketitle command but when I put it back, it won't just execute. I get the error attached. I'm not sure if I placed it in wrongly this time. Can someone please help?

Adding list of figure/list of table pushing away the mitoc of one chapter to another in 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.

Lyx modifying moderncv empty space

I am new on latex and lyx. I have to realize a resume and used moderncv. Do you know how I can have the space behing my picture being reduced ? (The one hatched in red) . As everything is supposed to fit in one page with a cv, it is important for me.
Thanks for your help
%% LyX 2.3.3 created this file. For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[english]{moderncv}
\usepackage[T1]{fontenc}
\usepackage[utf8x]{inputenc}
\usepackage{geometry}
\geometry{verbose,tmargin=1cm,bmargin=1cm,lmargin=1cm,rmargin=1cm}
\usepackage{fancyhdr}
\pagestyle{fancy}
\setcounter{secnumdepth}{2}
\setcounter{tocdepth}{2}
\usepackage{float}
\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\usepackage{xmpmulti}
\usepackage{enumitem}
\moderncvtheme[grey]{classic}
\firstname{John}
\familyname{Do}
\title{Title}
\address{adress}{city}
\mobile{+33 6 §§ §§ §§ §§}
\email{john.do#ens.psl.eu}
\photo[100pt]{Mii_Artwork.png}
\makeatother
\usepackage{babel}
\begin{document}
\maketitle
\section{Formation}
\cventry{2021/2022}{Master de Science cognitive}{Ecole normale supérieure rue d'Ulm}{Paris}{France}{}
\end{document}
Quick hack: add \vspace{-1.5cm} after \maketitle :
`
%% LyX 2.3.3 created this file. For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[english]{moderncv}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{geometry}
\geometry{verbose,tmargin=1cm,bmargin=1cm,lmargin=1cm,rmargin=1cm}
\usepackage{fancyhdr}
\pagestyle{fancy}
\setcounter{secnumdepth}{2}
\setcounter{tocdepth}{2}
\usepackage{float}
\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\usepackage{xmpmulti}
\usepackage{enumitem}
\moderncvtheme[grey]{classic}
\firstname{John}
\familyname{Do}
\title{Title}
\address{adress}{city}
\mobile{+33 6 §§ §§ §§ §§}
\email{john.do#ens.psl.eu}
\photo[100pt]{example-image}
\makeatother
\usepackage{babel}
\begin{document}
\maketitle
\vspace{-1.5cm}
\section{Formation}
\cventry{2021/2022}{Master de Science cognitive}{Ecole normale supérieure rue d'Ulm}{Paris}{France}{}
\end{document}

Latex chapter refrencing giving the last chapter last section reference

I have a problem referencing a chapter. I used a label bellow each title however, it is not giving the right reference. I tried some fixes but it did not work (nameref, varioref, cleveref)
my latex code is as follows
\documentclass[12pt,a4paper]{book}
\usepackage[utf8]{inputenc}
\usepackage[french,arabic,english]{babel}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\graphicspath{{images/}}
\usepackage{float}
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\usepackage{arabtex}
\usepackage{multirow}
\usepackage{threeparttable}
\usepackage{utf8}
\usepackage{longtable}
\usepackage{url}
\usepackage[colorinlistoftodos]{todonotes}
\usepackage{breakcites}
\usepackage{hhline}
\usepackage{xcolor}
\usepackage{colortbl}
%\usepackage{asect}
\usepackage{tocbibind}
\usepackage{tocloft}
\usepackage{acro}
\input{annexes/abreviations}
\usepackage[colorlinks]{hyperref}
\hypersetup{
colorlinks=true,
linkcolor=blue,
filecolor=magenta,
urlcolor=cyan,
citecolor=violet
}
% ref packages
\usepackage{nameref}
% folowing must be in this order
\usepackage{varioref}
\usepackage{hyperref}
\usepackage{cleveref}
\begin{document}
\input{chapters/chap1.tex}
\input{chapters/chap2.tex}
\input{chapters/chap3.tex}
\input{chapters/chap4.tex}
\bibliographystyle{apalike}
\bibliography{bibliography}
\end{document}
in chapter 1
\chapter{title1}
\label{chap1}
here is defined the label{chap1}
\section{section1}
this is section1
\section{section1}
this is section1
\section{section1}
this is section1
in chapter 3
\chapter{title3}
\label{chap3}
text reference Chapter \ref{chap1}
However, the reference shows the last section of chapter 1
I am using texmaker quick build to compile the code. Here is the complete example on overleaf https://www.overleaf.com/read/rxkmhxcbcgqc
we can also notice that referencing the first chapter does not work.
A minimal non-working example would be
\documentclass{book}
\usepackage[arabic,english]{babel}
\begin{document}
\chapter{title}\label{key}
test \ref{key}
\end{document}
You can work around this problem using the approach from https://tex.stackexchange.com/a/238442/36296
\documentclass{book}
\usepackage[arabic,english]{babel}
\makeatletter
\def\#part[#1]#2{%
\addtocontents{toc}{\xstring\select#language{\main#Arabi#language}}%
\if#rl\SAV##part[\textRL{#1}]{\textRL{#2}}%
\else\SAV##part[\textLR{#1}]{\textLR{#2}}%
\fi}
\def\#spart#1{%
\addtocontents{toc}{\xstring\select#language{\main#Arabi#language}}%
\if#rl\SAV#spart{\textRL{#1}}%
\else\SAV#spart{\textLR{#1}}%
\fi}
\def\#chapter[#1]#2{%
\addtocontents{toc}{\xstring\select#language{\main#Arabi#language}}%
\if#rl\SAV##chapter[\textRL{#1}]{\textRL{#2}}%
\else\SAV##chapter[\textLR{#1}]{\textLR{#2}}%
\fi}
\def\#schapter#1{%
\addtocontents{toc}{\xstring\select#language{\main#Arabi#language}}%
\if#rl\SAV#schapter{\textRL{#1}}%
\else\SAV#schapter{\textLR{#1}}%
\fi}
\makeatother
\begin{document}
\chapter{title}\label{key}
test \ref{key}
\end{document}

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.

Resources