Page LayoutAlter Margins on the first ToC Page only

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
Arya
Posts: 11
Joined: Wed Jan 30, 2013 7:12 pm

Alter Margins on the first ToC Page only

Post by Arya »

Hi :D

I am writing my thesis in LaTeX and have had to make some adjustments to fit my college's guidelines. I have to change the top margin for the first page of Table of Contents only. But I have no clue of how to do that only for the first page.

The geometry for the rest of the thesis is

Code: Select all

\usepackage[left=3cm,right=2.5cm,top=2.5cm,bottom=2.5cm]{geometry}
but for the first page of the ToC should be

Code: Select all

\geoemetry{left=3cm,right=2.5cm,top=2cm,bottom=2.5cm}
Thanks in advance to any help you can give me

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
localghost
Site Moderator
Posts: 9201
Joined: Fri Feb 02, 2007 12:06 pm

Alter Margins on the first ToC Page only

Post by localghost »

Arya wrote:[…] I have to change the top margin for the first page of Table of Contents only. […]
Is there a special reason for this?


Thorsten
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes[/size]

¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1
Arya
Posts: 11
Joined: Wed Jan 30, 2013 7:12 pm

Re: Alter Margins on the first ToC Page only

Post by Arya »

Hi
the thesis format requirements in my university require those ridiculously specific geometries. They think that everybody use Ms Word to write the thesis, and they have stablished that the top margin is for the first page of every chapter is 2.5 cm + 3 enters, thats "exactly" 5cm. I have fixed the margin for every chapter but I don't know how to do that for the first page of the TOC, were the margin is 5.5 cm on this moment

If I don't fix that they could reject the thesis, even if everything else is ok
User avatar
Juanjo
Posts: 657
Joined: Sat Jan 27, 2007 12:46 am

Re: Alter Margins on the first ToC Page only

Post by Juanjo »

You should post a complete minimal example showing, at least, the document class you are using and how you have fixed the issue for each chapter. This would allow to devise a solution. Without seeing your code, it is difficult to help.
The CTAN lion is an artwork by Duane Bibby. Courtesy of www.ctan.org.
Arya
Posts: 11
Joined: Wed Jan 30, 2013 7:12 pm

Alter Margins on the first ToC Page only

Post by Arya »

Hello Juanjo

I have one file for each chapter, and to fix the margin for the first page I'm doing the following on each one;

Code: Select all

\newgeometry{left=3cm,right=2.5cm,top=2cm,bottom=2.5cm}

\chapter{Geology}

and on page two of the same chapter:

\restoregeometry  

Below is part of the master tex file I'm using to compile all the chapters

Code: Select all

\documentclass[12pt,oneside,letterpaper,openany]{book}
\usepackage[left=3cm,right=2.5cm,top=2.5cm,bottom=2.5cm]{geometry}
\usepackage{sectsty}
\usepackage{pdflscape}
\renewcommand{\baselinestretch}{1.5}
\usepackage{fancyhdr} 
\renewcommand{\chaptermark}[1]{} 
\renewcommand{\sectionmark}[1]{}
\fancyhead{} 
\rhead{\thepage} 
\fancyfoot{} 
\usepackage{ textcomp }
\usepackage{SIunits} 
\setlength{\headheight}{15pt}
\usepackage{setspace}  

\begin{document}

\chapterfont{\centering\Large\mdseries\scshape}
\sectionfont{\large}
\subsectionfont{\large}

\newpage
\renewcommand\listtablename{Índice de Tablas}
\tableofcontents
\newpage
\listoffigures
\newpage
\listoftables

\mainmatter

\pagestyle{empty}
\pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}
\lhead{}
\chead{}
\rhead{\thepage}
\lfoot{}
\cfoot{}
\rfoot{}


\normalsize
\include{chapter1}
\include{chapter2}
\include{chapter3}

\backmatter

\renewcommand\bibname{REFERENCIAS}
\bibliographystyle{amsplain}
\begin{thebibliography}{}
\addcontentsline{toc}{chapter}{REFERENCIAS}

\bibitem{dd} x
\bibitem{r} y
\bibitem{ronda} z

\end{thebibliography}
\newpage

\end{document}
User avatar
Juanjo
Posts: 657
Joined: Sat Jan 27, 2007 12:46 am

Alter Margins on the first ToC Page only

Post by Juanjo »

I think that the technique you are using to change dimensions in the first page of chapters is error prone and not optimal. First, you do it manually, adding commands before and after each chapter heading. Second, it may be difficult to find a good point to place \restoregeometry, since this command inserts, in turn, a \clearpage command.

I've seen that you are using the sectsy package. Hence a simple approach is to directly redefine some commands, avoiding that package and solving your issue. Please copy the following code in a new file and name it as mysectsty.sty.

Code: Select all

% This is file mysectsty.sty
% Redefinition of several commands in book.cls related to chapter and 
% section headings, as requested by user Arya in the LaTeX Community 
% Forum. Code contributed by user Juanjo.
% See http://latex-community.org/forum/viewtopic.php?f=47&t=22734

\NeedsTeXFormat{LaTeX2e}[1998/06/01]
\ProvidesPackage{mysectsy}[2013/03/04, v 0.1]
\typeout{}
\typeout{Loading mysectsty...}
\typeout{}

\def\@makechapterhead#1{%
% \vspace*{50\p@}%      <--- Original
  \vspace*{\dimexpr 50\p@-0.5cm}% <--- New
  {\parindent \z@ \raggedright \normalfont
    \ifnum \c@secnumdepth >\m@ne
      \if@mainmatter
%       \huge\bfseries \@chapapp\space \thechapter %<--- Original
        \centering\Large\scshape     % <--- New
        \@chapapp\space \thechapter  % <--- New
        \par\nobreak
        \vskip 20\p@
      \fi
    \fi
    \interlinepenalty\@M
%   \Huge \bfseries  #1\par\nobreak %<--- Original
    \centering\Large\scshape #1\par\nobreak  % <--- New
    \vskip 40\p@
  }}
\def\@makeschapterhead#1{%
% \vspace*{50\p@}%      <--- Original
  \vspace*{\dimexpr 50\p@-0.5cm}% <--- New
  {\parindent \z@ \raggedright
    \normalfont
    \interlinepenalty\@M
%   \Huge \bfseries  #1\par\nobreak %<--- Original
    \centering\Large\scshape #1\par\nobreak  % <--- New
    \vskip 40\p@
  }}
% \newcommand\section{\@startsection {section}{1}{\z@}%<--- Original
\renewcommand\section{\@startsection {section}{1}{\z@}%<--- New
                                   {-3.5ex \@plus -1ex \@minus -.2ex}%
                                   {2.3ex \@plus.2ex}%
%                                  {\normalfont\Large\bfseries}}%<--- Original
                                   {\normalfont\large\bfseries}}% <--- New
\endinput
Put mysectsty.sty in the same folder as the main tex file. Now, in the preamble, replace
\usepackage{sectsty} by \usepackage{mysectsty} and comment the following lines:

Code: Select all

\chapterfont{\centering\Large\mdseries\scshape}
\sectionfont{\large}
\subsectionfont{\large}
[By the way, the last line is superfluous, since subsections are written with "large" size by default].
Comment also any \newgeometry and \restoregeometry commands before and after each chapter heading. Compile and see if everything goes fine.

It seems that you are writing in Spanish. I would advise you to load the babel package with the spanish option. This avoids the need of redefining \listtablename and similar commands.
The CTAN lion is an artwork by Duane Bibby. Courtesy of www.ctan.org.
Arya
Posts: 11
Joined: Wed Jan 30, 2013 7:12 pm

Re: Alter Margins on the first ToC Page only

Post by Arya »

Thanks Juanjo

It worked perfectly :D

Thanks again!! :D :D :D
Post Reply