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 asked a question a while ago about vertically aligning enumerate labels to the top of table. Now I am having the same problem, but with images. Since my problem was solved in my previous thread, I tried sticking the image in a single-cell table and aligning that with the tabular's alignment parameter, but it seemed to have no effect.

Can someone explain what is the correct way to align this image and why didn't sticking it in a table work as expected? I am simply trying to align the enumerate label with the top of my image.

enter image description here

\begin{enumerate}[label=(\alph*)]
  \item\begin{tabular}[t]{l}\includegraphics[width=10cm]{13a.png}\end{tabular}
\end{enumerate}
share|improve this question

2 Answers 2

up vote 11 down vote accepted

Martin Scharrer's package adjustbox will help you:

\usepackage{adjustbox}
...
\begin{enumerate}[label=(\alph*)]
  \item\adjustbox{valign=t}{\includegraphics[width=10cm]{13a.png}}
\end{enumerate}

The image will be set so that its height will match that of words and it will stick below the baseline.


In case adjustbox is not available, one can do in a more complicated way; after loading the calc package

\usepackage{calc}

saying

\raisebox{-\height+\ht\strutbox}{\includegraphics[width=10cm]{13a.png}}

will have the same effect.

share|improve this answer
    
With that I get this error: |149 error| Illegal unit of measure (pt inserted). \relax ...udegraphics[valign=t,width=10cm]{13a.png} . Any ideas what that is about? –  nw. Oct 3 '11 at 18:04
    
@nw. I changed the code –  egreg Oct 3 '11 at 18:14
    
Exactly what I was looking for, thanks! –  nw. Oct 3 '11 at 18:17
    
@nw.: This error got fixed with v0.8 of adjustbox. You can since use the following again: \includegraphics[width=10cm,valign=t]{13a.png}. Note that the order of the options influences the alignment. If valign is used first width will also scale the height and depth. –  Martin Scharrer Feb 5 '13 at 22:42
1  
@Turion I've added the code –  egreg Mar 4 '13 at 15:50

Just saw this when looking for myself. I found the easiest way to do this is:

item[a)] \text{}\\
\includegraphics{foo.bar}

No need for extra packages.

share|improve this answer
1  
Welcome to TeX.sx! –  Kurt Apr 18 '13 at 18:09
    
i think you want a backslash before \item, and you might also want to note that the packages graphicx and amsmath are needed. otherwise, very nice. –  barbara beeton Apr 18 '13 at 18:23

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.