Page LayoutVertical Space before Title

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
Willie
Posts: 42
Joined: Sat Aug 27, 2011 3:43 am

Vertical Space before Title

Post by Willie »

Hello,

I am using the article document class. When I use \maketitle an extra vertical space is added before the title. I would like to remove it (have the same vertical space as in other pages). Is there a good way to do this, in the preamble? (not \vspace{-3ex} before the title in the document body)

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Vertical Space before Title

Post by localghost »

The easiest method I can think of is to use the titling package.

Code: Select all

\documentclass[11pt,english]{article}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{geometry}
\usepackage{titling}
\usepackage{blindtext}

\setlength{\droptitle}{-4em}     % Eliminate the default vertical space
\addtolength{\droptitle}{-4pt}   % Only a guess. Use this for adjustment

\title{The Title}
\author{The Author}

\begin{document}
  \maketitle

  \blinddocument
\end{document}

Thorsten
Willie
Posts: 42
Joined: Sat Aug 27, 2011 3:43 am

Re: Vertical Space before Title

Post by Willie »

It's working. Thanks!

btw. How do you know that -4em is the default length? do you have a link to some source?
I looked at the package manual but didn't see that definition.
Isn't there a 'defaultskip' parameter or something?
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Vertical Space before Title

Post by localghost »

Actually the default vertical space before the title is 2em. But it is not enough to eliminate only this amount of space. So I doubled it. The added length value of -4pt is to compensate the (rubber) length \partopsep of the center environment that is used to type set the title. Internally this environment is a list and \partopsep is inserted before and after.

The definition of the \maketitle command can be found by looking into the class file itself, that is to say »article.cls« in this case. If you want to find out its location in the TeX installation tree, check out on the command line.

Code: Select all

kpsewhich article.cls
But feeding a search engine with the complete class file name (including suffix) will also do. But the more important thing is the helper macro \@maketitle. It directly determines the appearance of the title.
Post Reply