3

Having a lot of problems with LaTeX at the moment. I need my article to have a top margin of 33mm, but for some reason my title page has a much larger margin. Is there a simple fix I have overlooked?

MWE:

\documentclass[a4paper,oneside,12pt]{article}
\usepackage[english]{babel} % formatting rules for the English language
\usepackage[T1]{fontenc} % proper formatting for accented characters and non-standard characters such as pipelines
\usepackage[top=33mm, bottom=38mm, left=26mm, right=20mm]{geometry} % page layout
\usepackage{lmodern} % font formatting
\usepackage{float} % allow floating environments such as figures
\usepackage{amsmath} % math eqn formatting
\usepackage{amssymb} % math fonts
\title{\bf{\fontsize{14pt}{2pt} Title}}
\author{\fontsize{14pt}{2pt} Author names}
\date{}
\begin{document}
\maketitle
\end{document}
Keir Simmons
  • 313
  • 2
  • 4
  • 12
  • The title need this space to be a decent title. But you can uglify it with some like \title{\vspace{-3cm} ...} – Fran Mar 11 '14 at 11:53
  • Why have you used -3cm? – Keir Simmons Mar 11 '14 at 11:56
  • Is only an example. Change -3cm for the negative length that you want. You can use also like -20pt or -1.5em or -3ex ... – Fran Mar 11 '14 at 12:00
  • The problem is I don't know how much extra space it is using. I can't see why it is using a different setting if I explicitly set the top margin to 33cm. – Keir Simmons Mar 11 '14 at 12:01
  • 2
    Add the showframe to geometry package to check how far is still from the top margin. The \maketitle definition in article.cls add 2em because this is the usual in the finest journals. Adding a vertical space -2em should be enough to change this default. – Fran Mar 11 '14 at 12:28

2 Answers2

5

Just to correct some errors in your code:

  1. Don't use \bf which is deprecated in LaTeX, but \bfseries or \textbf (see for example Will two-letter font style commands (\bf , \it , …) ever be resurrected in LaTeX?)

  2. With 12pt as an option for the document class, use \large instead of \fontsize{14pt}{2pt} (BTW, it should be something like \fontsize{14pt}{17pt}\selectfont). The result is the same.

To have the title at the top of the page, you can patch the macro \@maketitle with the help of the command \patchcmd from the etoolbox package, that is, add the following lines in your preamble:

\usepackage{etoolbox}
\makeatletter
\patchcmd{\@maketitle}
  {\null\vskip 2em\begin{center}}
  {\centering}
  {}
  {}
\patchcmd{\@maketitle}
  {\end{center}}
  {}
  {}
  {}
\makeatother

MWE (remove the option showframe from geometry, it is just to show that it works)

\documentclass[a4paper,oneside,12pt]{article}
\usepackage[english]{babel} % formatting rules for the English language
\usepackage[T1]{fontenc} % proper formatting for accented characters and non-standard characters such as pipelines
\usepackage[top=33mm, bottom=38mm, left=26mm, right=20mm, showframe]{geometry} % page layout
\usepackage{lmodern} % font formatting
\usepackage{float} % allow floating environments such as figures
\usepackage{amsmath} % math eqn formatting
\usepackage{amssymb} % math fonts

\usepackage{etoolbox}
\makeatletter
\patchcmd{\@maketitle}
  {\null\vskip 2em\begin{center}}
  {\centering}
  {}
  {}
\patchcmd{\@maketitle}
  {\end{center}}
  {}
  {}
  {}
\makeatother

\title{\large\bfseries Title}
\author{\large Author names}
\date{}
\begin{document}
\maketitle
\end{document} 

Output:

enter image description here

karlkoeller
  • 124,410
3

You can use the \droptitle length that is defined in the titlingpackage. On another hand, there are several errors in your preamble: Firstly, the second argument to \fontsize is the value of the vertical space between two consecutive lines, so it should not be smaller than the design size of the font itself. Usually, it is about 20 % larger. Secondly, if you do not add \selectfont, it's ineffective, as you can see with the following code: I've written a two-lines title, in the first of which I've "forgotten" to write \selectfont; it results in a first line that has the default size (\LARGE, about 20pt), not 14 pt.

    \documentclass[a4paper,oneside,12pt]{article}
    \usepackage[utf8]{inputenc}
    \usepackage[english]{babel} % formatting rules for the English language
    \usepackage[T1]{fontenc} % proper formatting for accented characters and non-standard characters such as pipelines
    \usepackage{lmodern} % font formatting
    \usepackage[english]{babel} % formatting rules for the English language
    \usepackage[top=33mm, bottom=38mm, left=26mm, right=20mm, showframe]{geometry} % page layout
    \usepackage{float} % allow floating environments such as figures
    \usepackage{amsmath} % math eqn formatting
    \usepackage{amssymb} % math fonts
    \usepackage{titling}
    \droptitle = -20mm
    \title{\bfseries\fontsize{14}{17} Title\\\fontsize{14}{17}\selectfont A subtitle}%
    \author{\fontsize{14}{17}\selectfont Author names}
    \date{}
    \begin{document}

    \maketitle

    Blahblahblah…
    \end{document} 

enter image description here

Bernard
  • 271,350