2

I'm using a standard template for my title page of my document as found at the latex wikibook

However, for some reason, the minipage on the right, with my supervisor's information, renders about one inch left of where it should.

I wonder if anyone can help me with this. Here's my source:

\documentclass{article}
\usepackage[top=1in, bottom=1in, left=1in, right=1in]{geometry}
\usepackage{graphicx}
\usepackage{url}
\begin{document}
\raggedright
\begin{titlepage}
    \begin{center}
        \textsc{\LARGE University of Blah} \\
        \vspace{1cm}
        \textsc{\Large School of Egg Decoration} \\
        \vspace{0.8cm}
        \rule{\linewidth}{0.5mm} \\[0.35cm]
        \bfseries{\huge On the decoration of Ostrich Eggs}
        \rule{\linewidth}{0.5mm}
    \end{center}
    \begin{minipage}{0.4\textwidth}
        \begin{flushleft}
            \emph{Author:} \\
            \textsc{Edward Eggman} \\
            \url{E.Eggman@ublah.edu}
        \end{flushleft}
    \end{minipage}
    \begin{minipage}{0.4\textwidth}
        \begin{flushright}
            \emph{Supervisor:} \\
            \textsc{Dr James Eggthusiast} \\
            \url{J.Eggthusiast@ublah.edu}
        \end{flushright}
    \end{minipage} \\
    \vfill
    \begin{center}
    \large \emph{30\textsuperscript{th} June 2015}
    \end{center}
\end{titlepage}
% document content here
\end{document}

Many thanks.

gman
  • 1,807
AlexJ136
  • 133
  • 4
  • 2
    Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. For your problem, you have two minipages with 40 % width which are just separated by a white-space. Just end the first minipage with \end{minipage}\hfill in order to get the second minipage flushed right. – LaRiFaRi Jun 15 '15 at 11:42
  • @LaRiFaRi I think that the \raggedright before the \begin{titlepage} doesn't help. There seems to be no reason to have it before the titlepage instead of after it. – Astrinus Jun 15 '15 at 11:49
  • 1
    @LaRiFaRi I'll definitely have a read of the starter guide, sorry for my poor etiquette. And your solution worked perfectly! Thank you! – AlexJ136 Jun 15 '15 at 11:57

2 Answers2

4

Rather than use a minipage and have to guess the width, usually better to use a tabular and allow each box to be its natural width, so you can left align the text in the box but set the box flush right.

enter image description here

\documentclass{article}
\usepackage[top=1in, bottom=1in, left=1in, right=1in]{geometry}
\usepackage{graphicx}
\usepackage{url}
\begin{document}
\raggedright
\begin{titlepage}
    \begin{center}
        \textsc{\LARGE University of Blah} \\[1cm]
        \textsc{\Large School of Egg Decoration} \\[0.8cm]
        \rule{\linewidth}{0.5mm} \\[0.35cm]
        \bfseries{\huge On the decoration of Ostrich Eggs}
        \rule{\linewidth}{0.5mm}
    \end{center}

        \begin{tabular}{@{}l@{}}
            \emph{Author:} \\
            \textsc{Edward Eggman} \\
            \url{E.Eggman@ublah.edu}
        \end{tabular}\hfill
        \begin{tabular}{@{}l@{}}
            \emph{Supervisor:} \\
            \textsc{Dr James Eggthusiast} \\
            \url{J.Eggthusiast@ublah.edu}
        \end{tabular}
    \par
    \vfill
    \begin{center}
    \large \emph{30\textsuperscript{th} June 2015}
    \end{center}
\end{titlepage}
% document content here
\end{document}
David Carlisle
  • 757,742
3

Just use an \hfill to force space between the minipages

\documentclass{article}
\usepackage[top=1in, bottom=1in, left=1in, right=1in]{geometry}
\usepackage{graphicx}
\usepackage{url}
\begin{document}
\begin{titlepage}
    \begin{center}
        \textsc{\LARGE University of Blah} \\
        \vspace{1cm}
        \textsc{\Large School of Egg Decoration} \\
        \vspace{0.8cm}
        \rule{\linewidth}{0.5mm} \\[0.35cm]
        \bfseries{\huge On the decoration of Ostrich Eggs}
        \rule{\linewidth}{0.5mm}
    \end{center}
    \begin{minipage}{0.4\textwidth}
        \begin{flushleft}
            \emph{Author:} \\
            \textsc{Edward Eggman} \\
            \url{E.Eggman@ublah.edu}
        \end{flushleft}
    \end{minipage}\hfill
    \begin{minipage}{0.4\textwidth}
        \begin{flushright}
            \emph{Supervisor:} \\
            \textsc{Dr James Eggthusiast} \\
            \url{J.Eggthusiast@ublah.edu}
        \end{flushright}
    \end{minipage} \\
    \vfill
    \begin{center}
    \large \emph{30\textsuperscript{th} June 2015}
    \end{center}
\end{titlepage}
\raggedright

% document content here \end{document}

enter image description here

And for some other nice examples of title pages: Showcase of beautiful title page done in TeX