# Manually specify margins in the TOC and Title Page [closed]

I have just began my journey into latex. I'm writing my thesis with a given template. The template is big and I do not manage to extrapolating from it a minimum working examples, too many things, I'm not able to understand which is important which is not for this question.

The fact is that the title margin and the toc are out of bounds in the computed pdf. See the attached images

I think that the painless way to fix it is to manually specify the margin in those 2 pages.

I have tried a lot with some \linespread{} but it does not fix it.

Here is a piece of the template (again, sorry IT IS NOT a minimum working example, I don't understand what is relevant or not)

%\documentclass[12pt,a4paper,oneside, titlepage,fleqn,italian]{book} %stampa
\documentclass[12pt,a4paper,twoside,openright,titlepage,fleqn,italian]{book}

\usepackage[colorlinks=false]{hyperref}%<--inserisce segnalibri e riferimenti indice

\setlength{\parindent}{0pt}
\frenchspacing

%inverto i margini per la rilegatura

\makeatletter
\renewcommand{\thesection}{\if@mainmatter\thechapter.\arabic{section}\else\arabic{section}\fi}
\makeatother

\usepackage{titlesec}

\titleformat {\chapter}
[display]
{\normalfont\bfseries}
{\large\thechapter}
{0ex}
{\LARGE \titlerule[1pt] }

\titleformat{\section}
{\normalfont\large\bfseries}
{\thesection}
{1ex}
{}

\titleformat{\subsection}
{\normalfont\bfseries}
{\thesubsection}
{1ex}
{}

\usepackage{fancyhdr}

\pagestyle{fancy}

\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}}
\renewcommand{\subsectionmark}[1]{\markright{\thesubsection\ #1}}

\fancyhf{}
\renewcommand{\footrulewidth}{0pt}
\newcommand{\tab}{\hspace*{2em}}
\DeclareMathOperator*{\argmax}{arg\,max}
\fancyhead[RO]{\textbf{\thepage}}  %Displays the page number in bold in the header,
%to the left on even pages and to the right on odd pages.
%\fancyhead[RE]{\nouppercase{\leftmark}} % Displays the upper-level (section) information -
% as determined above - in non-upper case in the
% header, to the left on odd pages.
\fancyhead[LO]{\nouppercase{\rightmark}} % Displays the lower-level (chapter) information - as
%determined above - in the header,
% to the left on odd pages.


See the images: the red box in the second page should be in the title page, and the toc is out of margin.

Anyone have some hints?!

## closed as unclear what you're asking by Johannes_B, Mensch, Mico, Werner, user13907 Oct 5 '15 at 19:25

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• You could adapt the margins (on all sides of the paper format) with the geometry package and the corresponding \geometry command, such as, say, \geometry{lmargin=2cm,rmargin=2cm,tmargin=1.5cm,bmargin=1.5cm}. This will shift the content of the red box to the first page and solves other issues, perhaps, after you adapted some of the margin values in my example. – user31729 Mar 10 '14 at 18:22
• sorry but.. where to put it? – nkint Mar 10 '14 at 19:22
• Before the \begin{document} command. – user31729 Mar 10 '14 at 19:26
• ok so.. there is something very strange. if I put left and right margin to 3.4.. ok,everything is ok. 3.5 and up.. same problem. what can it be? – nkint Mar 10 '14 at 20:33