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 have a problem with alignment one picture in a table. I can not understand, How to alignment picture in cell in a table. Please help me. Thank you in advance.

LATEX

\begin{figure}
\centering
            \begin{tabular}{cccccccc}
                \toprule
                Objekt & Treffer & \multicolumn{2}{c}{Ausreißer}\\
                %\cmidrule{3-4}
                & & Objekt & Platzierung \\
                \midrule
                \raisebox{-.5\height}{\includegraphics[width=0.2\textwidth]{Bueste_1.jpg}} & 6 
                    & \raisebox{-.5\height}{\includegraphics[width=0.1\textwidth]{Bueste_8.jpg}} & 25 \\
                \midrule
                    \multirow{2}{*}{                \includegraphics[scale=0.4]{Bueste_2.jpg}} 
                    & \multirow{2}{*}{5}    &   \includegraphics[width=0.08\textwidth]{Bueste_7.jpg} & 13\\
                    \multicolumn{2}{c}{}    & \includegraphics[width=0.08\textwidth]{Bueste_8.jpg} & 24 \\
            \bottomrule
        \end{tabular}
\caption{Mit Normalisierung}
\end{figure}

enter image description here

latex source to table https://www.dropbox.com/s/lvfm9po4xlid0pp/tabelle.tex

picture source https://www.dropbox.com/s/ds3kih9nuq601n5/img.rar

share|improve this question

2 Answers 2

I did several things here. First, I created a macro \centergraphics that is basically an \includegraphics with the baseline going through the midpoint of the picture (rather than the base of the picture). I also used stacks instead of multirows to achieve the effect.

\documentclass{article}
\usepackage[usestackEOL]{stackengine}
\usepackage{booktabs}
\usepackage[demo]{graphicx}
\usepackage{multirow}
\let\tw\textwidth
\newsavebox\tempbox
\newcommand\centergraphics[2][]{%
  \sbox\tempbox{\includegraphics[#1]{#2}}%
  \raisebox{-.5\ht\tempbox}{\usebox{\tempbox}}%
}
\begin{document}
\begin{figure}
\centering
            \begin{tabular}{cccccccc}
                \toprule
                Objekt & Treffer & \multicolumn{2}{c}{Ausreier}\\
                %\cmidrule{3-4}
                & & Objekt & Platzierung \\
                \midrule
  \centergraphics[width=0.2\tw,height=.2\tw]{Bueste_1.jpg}
& 6 
                    &
\centergraphics[width=0.1\tw,height=.1\tw]{Bueste_8.jpg}
& 25 \\
                \midrule
\centergraphics[width=0.2\tw,height=.2\tw]{Bueste_2.jpg}
                    & 5 &
\stackanchor{%
\centergraphics[width=0.08\tw,height=.08\tw]{Bueste_7.jpg}%
}{%
\centergraphics[width=0.08\tw,height=.08\tw]{Bueste_8.jpg}%
}& \stackanchor[.06\tw]{13}{24}\\
            \bottomrule
        \end{tabular}
\caption{Mit Normalisierung}
\end{figure}
\end{document}

enter image description here

share|improve this answer
    
thank you. But I do not understand,why it is not working by me. –  user2902946 Jan 27 at 21:19
    
@user2902946 One possibility is that you don't have the stackengine package loaded. The other is that your version of it is out of date. Current version should be 3.24. –  Steven B. Segletes Jan 28 at 10:53

This is a workaround solution based on OP's code. Here multirow{8}{*}{...} is assumed for (2,1) entry wher the OP used multirow{2}{*}{...}. Since (2,3) entry contains two figures alinged vertically, so multirow{4}{*}{...} is used for each.

enter image description here

Code

\documentclass[a4paper,11pt]{article}
\usepackage[margin=10pt]{geometry}
\usepackage{graphicx}
\usepackage{booktabs,multirow}

\begin{document}

\begin{figure}
\centering
            \begin{tabular}{cccc}
                \toprule
                Objekt & Treffer & \multicolumn{2}{c}{Ausreißer}\\
                %\cmidrule{3-4}
                & & Objekt & Platzierung \\
                \midrule
                \raisebox{-.5\height}{\includegraphics[width=0.2\textwidth]{Bueste_1.jpg}} & 6 
                    & \raisebox{-.5\height}{\includegraphics[width=0.1\textwidth]{Bueste_8.jpg}} & 25 \\
                \midrule
\multirow{8}{*}{\includegraphics[scale=0.9]{Bueste_2.jpg}} &\multirow{8}{*}{5}  &\multirow{4}{*}{\includegraphics[width=0.08\textwidth]{Bueste_7.jpg}} & \multirow{4}{*}{13} \\[2cm]
\multicolumn{2}{c}{} &  \multirow{4}{*}{\includegraphics[width=0.08\textwidth]{Bueste_8.jpg}} &  \multirow{4}{*}{24} \\[1.3cm]
 \bottomrule
        \end{tabular}
\caption{Mit Normalisierung}
\end{figure}

\end{document}
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.