0

Right now my table is at bottom and caption is on the bottom too

enter image description here The code I used is

  \begin{minipage}[b]{0.6\textwidth}
  \centering
  \includegraphics[width=1\linewidth]{../matlab/SCEP_mcep_compare/graphs/diff_qos_types_thoughput}
  \captionof{figure}{A table beside a figure}\label{diff_qos_types_thoughput}
  \end{minipage}
  \hfill
  \begin{minipage}[b][][c]{0.4\textwidth}
    \centering
    \renewcommand{\arraystretch}{1}
    \begin{tabular}{| c | c | c | c |} 
    \hline
    $\lambda$ & Qos2 & Qos1   & Qos0  \\  \hline
    10    &  10    &  10      & 10         \\
    50    &  49.50 &  42.00   & 22.54      \\
    200   &  85.00 &  42.00   & 91.10      \\
    500   &  86.00 &  42.00   & 233.11     \\
    1000  &  88.00 &  42.00   & 233.11     \\
    1500  &  87    &  42.00   & 707.06     \\
    2000  &  86.00 &  42.00   & 947.90     \\
    3000  &  82.00 &  42.00   & 961.64     \\
      \hline
      \end{tabular}
      \captionof{table}{Values for \cref{diff_qos_types_thoughput} }
      \end{minipage}f{table}{Values for \cref{diff_qos_types_thoughput} }
      \end{minipage}

For achieving the table contents in the center I tried to use \begin{minipage}[b][][c]{0.4\textwidth} as explained here, but it resulted in same output.

How can I put my table in the center and while table caption is at the bottom?

1 Answers1

2

like this?

enter image description here

\documentclass{article}
\usepackage{booktabs}
\usepackage{caption}
\usepackage[export]{adjustbox} % for set image baseline to its center

\usepackage{cleveref}


\begin{document}
    \begin{figure}
\begin{tabular}{p{\dimexpr0.6\linewidth-2\tabcolsep}
                p{\dimexpr0.4\linewidth-2\tabcolsep}}
\includegraphics[width=1\linewidth,valign=c]{example-image-duck}
    &
    \begin{tabular}{c c c c}
    \toprule
$\lambda$ & Qos0 & Qos1 & Qos2  \\
    \midrule
30 & 28.276 &  20 & 39 \\
40 & 29.889 &  20 & 39 \\
50 & 31.766 &  20 & 39 \\
60 & 37.274 &  20 & 39 \\
68 & 48.673 &  20 & 39 \\
    \bottomrule
    \end{tabular}                           \tabularnewline
\caption{A figure beside of \cref{tab:diff_qos_types_thoughput}
\label{fig:diff_qos_types_thoughput}
    &
    \captionof{table}{Values for \cref{fig:diff_qos_types_thoughput} }
    \label{tab:diff_qos_types_thoughput}
\end{tabular}
    \end{figure}
\end{document}
Zarko
  • 296,517
  • Thanks for your answer. I have one more issue, which has been appended to the original question. – Amarjit Dhillon Jun 15 '18 at 22:04
  • please, always provide complete document as i do in my answer. to test your adoption of my answer i need to have more information about your document preamble. actually, your problem with referencing is new question :-) – Zarko Jun 15 '18 at 22:11
  • and i can't reproduce your problem. see edited answer. – Zarko Jun 15 '18 at 22:14
  • The issue is resolved, I was using the diff_qos_types_thoughput earlier as well. You are absolutely right, I will provide the complete document in future. Much respect for your efforts. – Amarjit Dhillon Jun 15 '18 at 22:15
  • if you also use hyperref package, it should be loaded before cleveref package and \cref{...} used in in caption had to be protected. for example \captionof{table}{Values for \protect\cref{fig:diff_qos_types_thoughput} }. – Zarko Jun 15 '18 at 22:19