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'm trying to create a table with 5 columns and 2 rows. The first row should shows images and the second row shows the according text. In my main tex-file I have following code to import the table \input{chapter3/buttonTable}. My buttonTable.tex File has following code in it:

\begin{table}[b]
\begin{tabularx}{\textwidth}{ |X|X|X|X|X| }
    \hline
    \includegraphics{./images/buttons/Windows-Buttons.png}
    & 
    \includegraphics{./images/buttons/MacOSX-Buttons.png}
    & 
    \includegraphics{./images/buttons/Gnome-Buttons.png}
    & 
    \includegraphics{./images/buttons/iOS-Buttons.png}
    & 
    \includegraphics{./images/buttons/Android-Buttons.png}
    \\ \hline
    Windows 7 & Mac OS X & Gnome & iOS & Android \\
    \hline
\end{tabularx}
\end{table}

This is the output: http://i47.tinypic.com/1z5r8ys.jpg

Basically I have two questions:

  1. Why do the images get bigger and bigger and how can I avoid it?
  2. How can I center the text in the table?
share|improve this question
1  
you can avoid it by using the parameter width and height of includegraphics includegraphics[width=2cm,height=1cm,keepaspectratio]{...} –  susis strolch Jan 4 '13 at 15:48
1  
just a guess: the size of the images are different(!) and includegraphics is not changing them. –  susis strolch Jan 4 '13 at 15:54
    
Thank you for your answer. Unfortunately your suggested solution does not work. I have added includegraphics[width=2cm,height=1cm,keepaspectratio] to every image but they still scale up. –  Flying Rocket Jan 4 '13 at 15:55
    
The images are nearly the same size (between 75x50 and 99 x 71 pixels) –  Flying Rocket Jan 4 '13 at 15:56
    
As susius said try the width argument, but I'd say don't use cm instead make it dependend from your tablewidth, so for example try: \includegraphics[width=0.15\textwidth]{<name>} or you could also try to scale the images. (e.g. [scale=0.5]) –  xfoo Jan 4 '13 at 15:57

1 Answer 1

I set up a demo and was unable to recreate the problem. Start with this minimal example and expand it until your problem starts to show.

\documentclass{article}

\usepackage{graphicx}

\begin{document}

\begin{table}
\begin{tabular}{|c|c|c|c|c|}
    \hline
    \includegraphics[height=1cm]{./images/buttons/splash.png}
    & 
    \includegraphics[height=1cm]{./images/buttons/splash.png}
    & 
    \includegraphics[height=1cm]{./images/buttons/splash.png}
    & 
    \includegraphics[height=1cm]{./images/buttons/splash.png}
    & 
    \includegraphics[height=1cm]{./images/buttons/splash.png}
    \\ \hline
    Windows 7 & Mac OS X & Gnome & iOS & Android \\
    \hline
\end{tabular}
\caption{tablecaption}
\label{tablelabel}
\end{table}

\end{document}
share|improve this answer
    
Thank you for your answer Johannes. The limiting of the height does work. Previous user also have suggested this workaround. PS: I am going to have multiple tables just like the one I posted. How can I make sure, that the columns are all having the same width? Furthermore I want the table to have the same width as \textwidth. PPS: Is an image scaled up if it is smaller than 1cm or is this the maximum height? –  Flying Rocket Jan 4 '13 at 16:51

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.