General ⇒ how to set the top margin?
how to set the top margin?
Hi,
How can i make the top margin of the page that contain "chapter, table of content, list of figure, appendix" be the same at other pages in all document?
thanks in advance.
How can i make the top margin of the page that contain "chapter, table of content, list of figure, appendix" be the same at other pages in all document?
thanks in advance.
NEW: TikZ book now 40% off at Amazon.com for a short time.

- Stefan Kottwitz
- Site Admin
- Posts: 10345
- Joined: Mon Mar 10, 2008 9:44 pm
Re: how to set the top margin?
Hi sherlock,
the top margin should already be the same. But perhaps you mean that the chapter (and like) headings should be set higher? Usually there's a vertical space before the chapter heading.
It depends on the documentclass you are using. For instance if it is report, one could redefine the command \@makechapterhead, this command calls \vspace*{50\p@} before printing the chapter name and number etc.
If this is what you want to change, tell me your documentclass, I could show you some appropiate code lines. Or you want something different then explain a bit more concretely.
Stefan
the top margin should already be the same. But perhaps you mean that the chapter (and like) headings should be set higher? Usually there's a vertical space before the chapter heading.
It depends on the documentclass you are using. For instance if it is report, one could redefine the command \@makechapterhead, this command calls \vspace*{50\p@} before printing the chapter name and number etc.
If this is what you want to change, tell me your documentclass, I could show you some appropiate code lines. Or you want something different then explain a bit more concretely.
Stefan
LaTeX.org admin
Re: how to set the top margin?
Hi Stefan_K
\documentclass[a4paper,12pt]{report}
\usepackage[lmargin=3.0cm, rmargin=1.0cm,tmargin2.50cm,bmargin=2.50cm]{geometry}
i want to set tmargin=2.50cm for all pages. But in the page that contain "table of content, chapter" there are a big vertical space like 5.0cm before the titles "Sumary, chapter,..".
Ps. Sorry about my english, i'm learnig speak english.
\documentclass[a4paper,12pt]{report}
\usepackage[lmargin=3.0cm, rmargin=1.0cm,tmargin2.50cm,bmargin=2.50cm]{geometry}
i want to set tmargin=2.50cm for all pages. But in the page that contain "table of content, chapter" there are a big vertical space like 5.0cm before the titles "Sumary, chapter,..".
Ps. Sorry about my english, i'm learnig speak english.
how to set the top margin?
As Stefan_K suggested, all you have to do is to redefine the \@makechapterhead command. In the following code I simply removed the additional vertical space:
Code: Select all
\documentclass[a4paper,12pt]{report}
\usepackage[lmargin=3.0cm, rmargin=1.0cm,tmargin=2.50cm,bmargin=2.50cm]{geometry}
\usepackage{lipsum}
\makeatletter
\def\@makechapterhead#1{%
{\parindent \z@ \raggedright \normalfont
\ifnum \c@secnumdepth >\m@ne
\huge\bfseries \@chapapp\space \thechapter
\par\nobreak
\vskip 20\p@
\fi
\interlinepenalty\@M
\Huge \bfseries #1\par\nobreak
\vskip 40\p@
}}
\makeatother
\begin{document}
\chapter{First chapter}
\lipsum[1-20]
\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
- Stefan Kottwitz
- Site Admin
- Posts: 10345
- Joined: Mon Mar 10, 2008 9:44 pm
how to set the top margin?
Hi sherlock,
here I show one example, where I redefined \@makechapterhead (writes \chapter headings) and \@makeschapterhead (writes \chapter* headings, like \tableofcontents, \listoffigures etc.) I just made the redefinitition and disabled the lines with \vspace*{50\p@}. That removes the additional space. Instead of removing you could even use another value. Same for \vskip 40\p@ below if you want. The code:
At this moment I can see that gmedina already posted a solution. Perhaps it's not bad to see the difference: I used \renewcommand* instead of \def. I like plain TeX too but tend to use LaTeX macros when possible. Furthermore it is necessary to redefine \@makeschapterhead too for the starred chapter headings.
Stefan
here I show one example, where I redefined \@makechapterhead (writes \chapter headings) and \@makeschapterhead (writes \chapter* headings, like \tableofcontents, \listoffigures etc.) I just made the redefinitition and disabled the lines with \vspace*{50\p@}. That removes the additional space. Instead of removing you could even use another value. Same for \vskip 40\p@ below if you want. The code:
Code: Select all
\documentclass[a4paper,12pt]{report}
\usepackage[lmargin=3.0cm, rmargin=1.0cm,tmargin=2.50cm,bmargin=2.50cm]{geometry}
\makeatletter
\renewcommand*\@makechapterhead[1]{%
%\vspace*{50\p@}%
{\parindent \z@ \raggedright \normalfont
\ifnum \c@secnumdepth >\m@ne
\huge\bfseries \@chapapp\space \thechapter
\par\nobreak
\vskip 20\p@
\fi
\interlinepenalty\@M
\Huge \bfseries #1\par\nobreak
\vskip 40\p@
}}
\renewcommand*\@makeschapterhead[1]{%
%\vspace*{50\p@}%
{\parindent \z@ \raggedright
\normalfont
\interlinepenalty\@M
\Huge \bfseries #1\par\nobreak
\vskip 40\p@
}}
\makeatother
\begin{document}
\tableofcontents
\chapter{One}
Text
\newpage text
\end{document}
Stefan
LaTeX.org admin
how to set the top margin?
Yes, I forgot about the table of contents and other sectional units that use \chapter*. In this case, you will also have to redefine \@makeschapterhead:Stefan_K wrote:...At this moment I can see that gmedina already posted a solution. Perhaps it's not bad to see the difference: I used \renewcommand* instead of \def. I like plain TeX too but tend to use LaTeX macros when possible. Furthermore it is necessary to redefine \@makeschapterhead too for the starred chapter headings.
Stefan
Code: Select all
\documentclass[a4paper,12pt]{report}
\usepackage[lmargin=3.0cm, rmargin=1.0cm,tmargin=2.50cm,bmargin=2.50cm]{geometry}
\usepackage{lipsum}
\makeatletter
\def\@makechapterhead#1{%
{\parindent \z@ \raggedright \normalfont
\ifnum \c@secnumdepth >\m@ne
\huge\bfseries \@chapapp\space \thechapter
\par\nobreak
\vskip 20\p@
\fi
\interlinepenalty\@M
\Huge \bfseries #1\par\nobreak
\vskip 40\p@
}}
\def\@makeschapterhead#1{%
{\parindent \z@ \raggedright
\normalfont
\interlinepenalty\@M
\Huge \bfseries #1\par\nobreak
\vskip 40\p@
}}
\makeatother
\begin{document}
\tableofcontents
\chapter{First chapter}
\lipsum[1-20]
\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...