2

I have a table and a figure, I want to align them one next to the other (not one under the other):

\documentclass{llncs}
\usepackage{capt-of}
\usepackage[demo]{graphicx}
\begin{document}


\begin{table}[t]
\begin{minipage}[t]{.5\textwidth }
\footnotesize
\begin{tabular}{ | c || c | c | c | c | } \hline
\textbf{ABC} & \textbf{KO} & \textbf{Ro} & \textbf{Ov} & \textbf{Params} \\ \hline
\multicolumn{5}{|c|}{\textbf{Well this is a text here}} \\ \hline
\textit{A1} & 123 & 123 & 123 & 123 \\ \hline
\textit{Z2} & 123 & 123 & 123 & 123 \\ \hline
\multicolumn{5}{|c|}{\textbf{Well this is another text here)}} \\ \hline
\textit{O1} & 123 & 123 & 123 & 123 \\ \hline
\textit{U9} & 123 & 123 & 123 & 123 \\ \hline
\end{tabular}
\caption{results in this table}
\label{validation}
\end{minipage}%
\begin{minipage}[t]{.5\textwidth}
\includegraphics[width=0.45\textwidth]{plot.pdf}
\caption{This is a figure not a table}
\label{plot}
\end{minipage}
\end{table}

\end{document}
  • Possible duplicate of tex.stackexchange.com/questions/6850/… – bloodworks Jul 5 '12 at 12:41
  • In beamer there is the columns environment which allows you to do this. I'm not sure if this environment is available outside of beamer. – Leeser Jul 5 '12 at 12:48
  • @Leeser nope. But there´s something more reliable. See my answer below. – bloodworks Jul 5 '12 at 12:52
  • @bloodworks The figure and its caption are overlapping with the table, with your solution – user995434 Jul 5 '12 at 13:22
  • 1
    @bloodworks. No worries, I didn't take anything personal, so no need to apologise. It is hard to convey tone and meaning in a few short characters and it can come across quite different to what was meant. I hope you didn't think I was getting worked up ...as it appears ...now that I re-read my 2nd reply...! – Leeser Jul 5 '12 at 15:14
5

Assuming a MWE you could do the following:

\documentclass{book}
\usepackage{capt-of}
\usepackage[demo]{graphicx}
\begin{document}


\begin{table}[t]
    \begin{minipage}[t]{.5\textwidth }
        \footnotesize
        \begin{tabular}{ | c || c | c | c | c | } \hline
            &\\
        \end{tabular}
        \caption{the caption of table}
        \label{thelabeltab}
    \end{minipage}%
    \begin{minipage}[t]{.5\textwidth}
        \includegraphics[width=0.45\textwidth]{myimage.pdf}
        \captionof{figure}{my caption goes here}
        \label{thelab}
    \end{minipage}
\end{table}

\end{document}

enter image description here

When using a KOMAScript Class capt-ofis not needed. If the Example doesn´t help you i suggest that you provide a MWE.

Update: Here comes a extended example with some (debuging) frames to show you the placement of the two objects. (When you compare this example with the one above you`ll easily figure out which commands to strip to get rid of those lines.)

\documentclass{book}
\usepackage{capt-of, showframe, blindtext}
\usepackage[demo]{graphicx}
\begin{document}
\blindtext

\begin{table}[t]\fbox{
\begin{minipage}[b]{.50\textwidth }%
\footnotesize
\begin{tabular}{ | c || c | c | c | c | } \hline
\textbf{ABC} & \textbf{KO} & \textbf{Ro} & \textbf{Ov} & \textbf{Params} \\ \hline
\multicolumn{5}{|c|}{\textbf{Well this is a text here}} \\ \hline
\textit{A1} & 123 & 123 & 123 & 123 \\ \hline
\textit{Z2} & 123 & 123 & 123 & 123 \\ \hline
\multicolumn{5}{|c|}{\textbf{Well this is another text here)}} \\ \hline
\textit{O1} & 123 & 123 & 123 & 123 \\ \hline
\textit{U9} & 123 & 123 & 123 & 123 \\ \hline
\end{tabular}%
\caption{results in this table}\label{validation}%
\end{minipage}}%
\fbox{\begin{minipage}[b]{.45\textwidth}%
\hspace*{0pt}\includegraphics[width=0.45\textwidth]{plot.pdf}%
\captionof{figure}{This is a figure not a table\label{x}}%
\end{minipage}}
\end{table}

\end{document}

enter image description here

  • With this, I get that the figure and its caption is overlapping with the table ! – user995434 Jul 5 '12 at 13:22
  • @user995434 absolutely not: see the edit. Remember this is all you gave us. Thats why i asked you for a MWE. – bloodworks Jul 5 '12 at 13:46
  • I have edited my first post to put a code with a table and figure as you said, but they are not aligned perfectly ! and the figure is called Table 2 instead of Fig 1 ... – user995434 Jul 5 '12 at 13:58
  • @user995434: You didn't use the \captionof{figure}, and your tabular is simply to large and so sticks out of the minipage. – Ulrike Fischer Jul 5 '12 at 14:06
  • using the "llncs" class instead of "book" will not make the captions aligned together ! – user995434 Jul 5 '12 at 15:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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