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 working on LaTeX and R. I want to put text (here itemize top aligned) in minipage.

enter image description here

In the attached image (dummy image with itemize text), how can I put itemize

. First line
. Second line

on the top?

enter image description here

\begin{mdframed}[roundcorner=10pt,leftmargin=1, rightmargin=1, 
  linecolor=goldenpoppy,outerlinewidth=.5,
  innerleftmargin=8,innertopmargin=8,innerbottommargin=8]
\begin{minipage}{0.2\linewidth}
\includegraphics[width=.88\textwidth]{images}
\end{minipage}
\hspace{.1mm}
\begin{minipage}{0.6\linewidth}
\begin{itemize}
\item first line
\item second line
\end{itemize}
\end{minipage}
\end{mdframed}
share|improve this question
3  
Can you post your code you developed so far? –  Count Zero May 27 '12 at 12:55
    
And please avoid excessive white space in posted images. Thanks. –  Martin Scharrer May 27 '12 at 13:06

3 Answers 3

up vote 2 down vote accepted

Usually, you can use the [t] option with minipage to get top alignment:

\begin{minipage}[t]{2in}
   first block of text\\
   (with multiple lines)
\end{minipage}
\begin{minipage}[t]{3in}
   second block of text
\end{minipage}

Unfortunately that doesn't work here with because the text block will be aligned to the bottom of the image (from what I understand, that's the baseline of the image.)

You might take a look at Aligning image and text on top, with minipages, which seems to address the same question.

share|improve this answer

An image is always adjusted at the bottom. In your case the line has a depth of 0pt but a height of height of image.

To change this behavior you can use the command \raisebox. For example

\raisebox{-\height}{\includegraphics{image}}

In this case the line will have height of 0pt. To align this with you right site you need a new raising by the height of \strutbox:

\raisebox{\dimexpr-\height+\ht\strutbox\relax}{\includegraphics{image}}

In this case you will get:

enter image description here

Here the code:

\documentclass{article}
\usepackage[framemethod=tikz]{mdframed}
\usepackage{graphicx}
\usepackage{mwe}
\begin{document}
\begin{mdframed}[roundcorner=10pt,leftmargin=1, rightmargin=1, 
  linecolor=orange,outerlinewidth=.5,
  innerleftmargin=8,innertopmargin=8,innerbottommargin=8]
\begin{minipage}[t]{0.2\linewidth}
\raisebox{\dimexpr-\height+\ht\strutbox\relax}{\includegraphics[width=.88\textwidth]{example-image-a}}
\end{minipage}
\hspace{.1mm}
\begin{minipage}[t]{0.6\linewidth}
\begin{itemize}
\item first line
\item second line
\end{itemize}
\end{minipage}
\end{mdframed}
\end{document}

To make the usage more user friendly you can work with the package adjustbox.

share|improve this answer

Yuou can do the same what @pac said, but instead of [t] write [b] and it should go to the top.

share|improve this answer

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.