3

I want to move the title of my document up in order to save space. I can't figure out how to do this.

This is what I have in LyX

enter image description here

And this is how it shows up in PDF. I'd like to move it up.

enter image description here

birdy
  • 143
  • 3
    Are you trying to adhere to any style guide? Do you want content on the same page as the title? Table of contents? You should try to be more specific :) (By the way, welcome to TeX.SX!) – Sean Allred Jan 09 '15 at 22:04
  • Welcome to TeX.SX! Although this is a LyX - based question: Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. –  Jan 09 '15 at 22:06
  • I don't have any table of contents and I'm not following any style guides. I do have a restriction to get everything in 12 pages and I am over 12 pages at the moment. So I thought I can move the title up and just begin my document on top of the first page rather than in the middle so that I can save overall space. – birdy Jan 09 '15 at 22:32
  • @birdy: So you're using the default Article class? – Werner Jan 09 '15 at 22:38
  • Yes, I am very new to LyX. I just started typing after installing it. So, I assume I'm just using the default. – birdy Jan 09 '15 at 22:43
  • @birdy: Most documents have a title page with title content only without additional text etc. content which belongs to later pages of the document. It's quite natural to have the title centered vertically. In addition, there are more information at the title, e.g. date/institution etc. –  Jan 09 '15 at 22:52

2 Answers2

6

Within the default Article (Standard Class) (see you Document > Settings... > Document Class tab), the Title (Author and Date) is set using a macro called \@maketitle (inside article.cls. This is what that macro looks like:

\def\@maketitle{%
  \newpage
  \null
  \vskip 2em%
  \begin{center}%
  \let \footnote \thanks
    {\LARGE \@title \par}%
    \vskip 1.5em%
    {\large
      \lineskip .5em%
      \begin{tabular}[t]{c}%
        \@author
      \end{tabular}\par}%
    \vskip 1em%
    {\large \@date}%
  \end{center}%
  \par
  \vskip 1.5em}

You'll note that it inserts a \newpage, then sets \null (consider it just something to "start the page") and inserts a vertical skip of 2em, before starting to set the actual title (inside a centered environment).

You can get rid of this vertical skip by adding the following to your Document > Settings... > LaTeX Preamble:

\usepackage{etoolbox}
\makeatletter
\patchcmd{\@maketitle}% <cmd>
  {\newpage\null\vskip 2em}{}% <search><replace>
  {}{}% <success><failure>
\makeatother

The above patch uses etoolbox to remove the \newpage \null \vskip 2em construction from \@maketitle, thereby making the title start immediately where it's called. A similar thing can be added to remove the vertical skip at the end of the environment (given by \vskip 1.5em), if needed:

\makeatletter
\patchcmd{\@maketitle}% <cmd>
  {\par\vskip 1.5em}{\par}% <search><replace>
  {}{}% <success><failure>
\makeatother

With only the first patch, your document should now resemble:

enter image description here

In the above output I've also added the showframe package to highlight the position of the text box just as an indication that there's no white space set before the actual title.

With both patches active there's a little less space (not much) below the title:

enter image description here

Of course, instead of removing it, one can insert a negative space.

Werner
  • 603,163
1

The above solution has to be modified if using KOMA article class instead of the standard article class, because in the .cls, the command is not \newpage\null\vskip 2em, but \null\vskip 2em. Therefore

\usepackage{etoolbox}
\makeatletter
\patchcmd{\@maketitle}% <cmd>
  {\newpage\null\vskip 2em}{}% <search><replace>
  {}{}% <success><failure>
\makeatother

had to be changed to

\usepackage{etoolbox}
\makeatletter
\patchcmd{\@maketitle}% <cmd>
  {\null\vskip 2em}{}% <search><replace>
  {}{}% <success><failure>
\makeatother

to make it work (at least for me).

To reduce the space below the title without adding something to the preamble, I have found this solution Reducing the space below the title

which in the document looks like

enter image description here

using Evil Red Code. That may be easier for someone new to LyX. It doesn't work for pushing the title up the page, however, only for decreasing the space between the subtitle, the date and the text.

No adjustment with \vspace enter image description here

With adjusted \vspace

enter image description here

Neridi
  • 21