Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
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. –  barbara beeton Nov 28 '12 at 19:01
    
Thanks @barbarabeeton! I had forgotten that those newlines count for white space as well. –  ArjunShankar Nov 29 '12 at 11:11
add comment

1 Answer 1

up vote 4 down vote accepted

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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