In \documentclass{article}
, the \maketitle
command results in a lot of wasted vertical space. Is there any way for me to remove it? In other words, I'd like the author to appear directly below the title, and the date directly below the author.
3 Answers
You could alter the relevant documentclass definition wherein the \maketitle
command is defined. But, don't do that. Your document will then compile differently for you than for others.
Try something like this:
\documentclass{article}
\author{Some random fellow\vspace{-2ex}% Toggle commenting out the command
}
\date{A long time ago}
\title{A comprehensive treatise on everything\vspace{-2ex}% to see the effect
}
\begin{document}
\maketitle
\end{document}
-
3In particular, it is the
\vspace{-length}
command that will add negative vertical space (i.e. take space away). Jul 29, 2010 at 17:51 -
4It's ugly, but it worked. For some reason, I had to put the author/date
\vspace
at the beginning of the date instead of the end of the author. Oh well. Jul 30, 2010 at 2:53 -
3@Jeremy: "Not pretty" at least, yes. When I find myself doing something that's a bit ugly to modify something from a LaTeX document class, I imagine Leslie Lamport saying "well, then, maybe don't do it?" The problem for me is that sometimes his stylistic judgments strike me as too severe. The case at hand is one; I often tightened up a title block on class handouts without a separate title page where the tightening saved the handout from flowing onto another page.– vandenJul 30, 2010 at 13:07
-
4Generally added formatting information in this way is considered bad style; finding a way to change the underlying formatting is a better idea so the source is kept "clean". Jul 30, 2010 at 14:17
-
1@Will: I certainly agree in general. But, the title page is a one off if ever anything is. @Andrew's approach of redefining and your suggested package both seem perfectly reasonable to me, too. Here, I feel its horses for courses. The voting, though, seems to suggest I'm in the minority ;-)– vandenJul 30, 2010 at 14:38
The titling
package gives you customisable hooks for re-styling the look of \maketitle
.
For example \posttitle
is a command to define the ‘closing material’ to the title block. Its default with this package is
\posttitle{\par\end{center}\vskip 0.5em}
So to tighten up the space a bit you might write instead:
\posttitle{\par\end{center}}
Furthermore,
\setlength{\droptitle}{-10pt}
will raise the whole title up by 10pt (say), to give more space for content beneath the title.
-
1
-
10It should be noted for newbies that this requires adding a
\usepackage{titling}
and goes outside of your\begin{document}
. Is there a way to remove the additional space above the title? What about making the title horizontal?– BretMay 25, 2014 at 19:14 -
Thanks to @LoopSpace 's pointer in his answer, I was able to find that the
article
document class specifies60 pts
of vertical space above the title, so to remove it completely, use\setlength{\droptitle}{-60pt}
. Feb 9, 2016 at 23:58 -
the answer is unclear. it assumes there is already "\posttitle{\par\end{center}\vskip 0.5em}"– RichardMay 16, 2020 at 22:35
-
vanden says:
You could alter the relevant documentclass definition wherein the \maketitle command is defined. But, don't do that.
I completely agree with the second sentence. However, there's an alternative that gives you a little more control whilst ensuring that your document compiles the same wherever it is sent: copy the relevant section from the article.cls
file into the preamble of your article and make the relevant changes there. Three things to note:
- There are some
@
s in the definition, so you will need to enclose the definition with\makeatletter
before and\makeatother
afterwards. - The definition starts
\newcommand\maketitle
. As\maketitle
will already be a command, you need to change the\newcommand
to\renewcommand
. - Make sure you get the right one. There are two definitions of
\maketitle
inarticle.cls
, depending on whether you send the optiontitlepage
to the class or not.
I don't recommend this to a beginner, but to someone wanting to learn a little more about how things work, it's a reasonable way to peek under the bonnet [translation: hood].
-
2