0

I'm trying to alter how a \documentclass{report} title page appears for a package I'm putting together for work. I've cobbled together enough knowledge to make it very close to what I want, but I'm stuck now.

A MWE:

\documentclass{report}

\usepackage{lipsum}
\usepackage{showframe}

\title{An exceptionally long title that probably needs to look better than it does, and will span multiple lines}
\author{Company!\\Street!\\City!, State! ZIP!}

\makeatletter
\renewcommand{\maketitle}{\begin{titlepage}
  \let\footnotesize\small
  \let\footnoterule\relax
  \let \footnote \thanks
    \begin{flushleft}
        \includegraphics[width=10cm]{example-image-a}
    \end{flushleft}
  \vfill 
  \begin{flushright}
    {\LARGE \@title}
    \vskip 3em
    {\large
     \lineskip .75em
      \begin{tabular}[t]{l}
        \@author
      \end{tabular}\par}
      \vskip 1.5em
  \end{flushright}
\end{titlepage}
}
\makeatother

\begin{document}
\maketitle
\section{Lorem Ipsum}
\lipsum[1-3]
\end{document}

This provides the following output: enter image description here

but I want the title to line up with the address. I've tried putting the title in the \tabular environment but things went haywire and my constant tweaking couldn't fix it.

How can I make the title--regardless of title length--line up with the right edge of the address?

  • You seem to have some spurious spaces in your input, but the Brief article will not align with the tabular this way! – user31729 Jun 15 '16 at 17:35
  • Not sure where the spaces are coming from, but I do try to keep my code aligned with tabs/spaces so that it's easier for me to read in my editor. – Steven Jun 15 '16 at 17:37
  • @Steven: I've updated my answer to accommodate your needs. It seems to do what you ask. – Werner Jun 15 '16 at 18:16
  • Isn't \begin{tabular}[t]{@{}l@{}}\@author\end{tabular} sufficient? – egreg Jun 15 '16 at 21:26
1

In order to maintain an appropriate alignment between the title and the author, set it in the same tabular that has a single column that is left aligned (removing the inter-column gap on the right via @{}):

enter image description here

\documentclass{report}

\usepackage{lipsum,graphicx}
\usepackage{showframe}

\title{Brief article with a very long title}
\author{Company! \\ Street! \\ City!, State! ZIP!}

\makeatletter
\renewcommand{\maketitle}{%
  \begin{titlepage}
    \let\footnotesize\small
    \let\footnoterule\relax
    \let\footnote\thanks
    \noindent \includegraphics[width=10cm]{example-image}

    \vfill 

    \noindent{\raggedleft\LARGE \@title\par}

    \bigskip

    \mbox{}\hfill
    {\large\begin{tabular}{l@{}}
      \@author
    \end{tabular}}

    \vspace{1.5em}
  \end{titlepage}
}
\makeatother

\begin{document}

\maketitle

\section{Lorem Ipsum}
\lipsum[1-3]

\end{document}

The title is set using \raggedleft, allowing it to stretch across the entire title page if need be and ragged-wrap as required.

There is no need to additional packages to move content left/right on the page. Either set it inside a \raggedright/\raggedleft paragraph, or move content over to the right via \mbox{}\hfill<stuff>. \mbox{} sets a "mark" containing nothing, from which \hfill can stretch over to the right side of the page.

1
\documentclass{report}

\usepackage{graphicx}
\usepackage{lipsum}
\usepackage{showframe}

\title{Brief Article}
\author{Company!\\Street!\\City!, State! ZIP!}

\makeatletter
\renewcommand{\maketitle}{%
  \begin{titlepage}
    \let\footnotesize\small%
    \let\footnoterule\relax%
    \let\footnote\thanks%
    \begin{flushleft}%
      \includegraphics[width=10cm]{example-image-a}%
    \end{flushleft}%
    \vfill%
    \begin{flushright}
      {\large%
        \begin{tabular}[t]{l}
          \LARGE\@title \\
          \tabularnewline[.75em]%
          \@author%
        \end{tabular}%
      }%
      \vskip1.5em%
    \end{flushright}%
  \end{titlepage}%
}
\makeatother

\begin{document}
\maketitle%
\section{Lorem Ipsum}
\lipsum[1-3]
\end{document}

A version without flushright and flushleft:

\documentclass{report}

\usepackage{graphicx}
\usepackage{lipsum}
\usepackage{ragged2e}
\usepackage{showframe}

\title{A long stupid title that should not be there!}
\author{Company!\\Street!\\City!, State! ZIP!}

\makeatletter
\renewcommand{\maketitle}{%
  \begin{titlepage}
    \let\footnotesize\small%
    \let\footnoterule\relax%
    \let\footnote\thanks%
    {%
      \RaggedRight
      \includegraphics[width=10cm]{example-image-a}%
    }
    \vfill%
    {%
      \RaggedLeft
      {\large%
        \begin{tabular}[t]{p{0.3\textwidth}}
          \LARGE\@title \\
          \tabularnewline[.75em]
          \@author
        \end{tabular}%
      }%

      \vskip1.5em
     }%
  \end{titlepage}%
}
\makeatother

\begin{document}
\maketitle%
\section{Lorem Ipsum}
\lipsum[1-3]
\end{document}

enter image description here

  • Yes, this makes the title line up with the address but if the title is exceptionally long, then things fall apart. – Steven Jun 15 '16 at 17:40
  • 1
    @Steven: Your demo title is not exceptionally long -- you're changing the question right now – user31729 Jun 15 '16 at 17:41
  • Hmm. You're right. My apologies. Honestly I hadn't considered it until your first answer. – Steven Jun 15 '16 at 17:43
  • @Steven: Have you seen my update at all? ;-) – user31729 Jun 15 '16 at 17:49
  • 2
    @Steven: yes, but question changing is not very nice -- it kills all efforts that have been made so far! – user31729 Jun 15 '16 at 17:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.