4

I am trying to customize the title of my scrreprt class document.

The \titlehead looks like this (basically, three 'columns' created with three instances of \minipage):

  \titlehead{

    \large

    \begin{minipage}[t]{0.3\textwidth}
    \includegraphics[width=0.9\textwidth]{logo}
    \end{minipage}
% 
    \begin{minipage}[t]{0.4\textwidth}
    \begin{center}
      Foo \\
      Bar \\
      Baz
    \end{center}
    \end{minipage}
%
    \begin{minipage}[t]{0.2\textwidth}
    \begin{flushright}
    Fubar
    \end{flushright}
    \end{minipage}
  }

I have two problems:

  1. I want the top of the logo, to align with the top of the text in the other two minipages. I used the [t] option of \minipage to achieve this. But while the two textual minipages line up properly, the image doesn't. It gets rendered much higher than the text. I assume this is because \includegraphics is not text and so, the [t] option is meaningless for the first minipage. So what should I be doing to set this right?

  2. I expected the total widths of the minipages to add up to \textwidth. But if I set the third minipage to 0.3\textwidth (so that the total width adds up to whole), PDFLaTeX decides to push my third minipage down because apparently the three of them side-by-side are too wide. Is there some way I can cleanly fix this? e.g. like, making the third \minipage fill the available horizontal space? If so, how?

2
  • 3
    i won't tackle the alignment, but the width problem might be solved by placing a % immediately after the first two instances of \end{minipage}. another approach, decidedly plain, not latex, is to insert \hss in those same locations, setting \parfillskip=0pt locally, and ending the \titlehead argument with \par. Nov 28, 2012 at 19:01
  • Thanks @barbarabeeton! I had forgotten that those newlines count for white space as well. Nov 29, 2012 at 11:11

1 Answer 1

4

You can use the adjustbox package:

\documentclass{report}
\usepackage[pass,showframe]{geometry}
\usepackage[demo]{graphicx}
\usepackage{adjustbox}
\begin{document}

\noindent
\adjustbox{valign=t,left=0.3\textwidth}{%
  \includegraphics[width=0.27\textwidth]{logo}}% 
\begin{minipage}[t]{0.4\textwidth}
  \centering
  Foo \\
  Bar \\
  Baz
\end{minipage}%
\begin{minipage}[t]{0.3\textwidth}
\raggedleft
    Fubar
\end{minipage}

\end{document}

Notice how the end of lines are masked so they don't count as a space.

The demo option to graphicx and the geometry package are just to show the example (they provide a mock image and the frame respectively).

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .