0

I want to put a table next to a figure on the same row and in order to do that I am using the floatrow package. However, I cannot align the two. This is what is happening:

enter image description here

The code I am using to produce this is:

\documentclass[10pt]{scrartcl}
%=======================================================================
%I am listing all packages defined in my main
\usepackage[utf8]{inputenc}
\usepackage{comment}
\usepackage[margin=3cm]{geometry}
\usepackage[titles]{tocloft}
\usepackage[parfill]{parskip}
\usepackage[hidelinks]{hyperref}
\usepackage{fancyhdr}
\usepackage{graphicx}
\usepackage{epstopdf}
\usepackage{floatrow}
\usepackage{amsmath,amssymb,amsthm,multirow,algorithm,algorithmic,amsfonts}
\numberwithin{equation}{section}
\usepackage{gensymb}
\usepackage[square,numbers,comma,sort&compress]{natbib}
\usepackage[titletoc]{appendix}
\usepackage[final]{pdfpages}
\usepackage{afterpage}
\usepackage{multicol}
\usepackage{enumitem}
\usepackage{color}
\usepackage{textcomp}
\usepackage{pdfpages}
\usepackage{tabularx}
\usepackage{lscape}
\usepackage{listings}
\usepackage{diagbox}
\usepackage{colortbl}
%======================================================================
\pagestyle{plain}
%======================================================================
\newfloatcommand{\capbtabbox}{table}[][\FBwidth]
\newcommand{\HRule}{\rule{\linewidth}{0.04cm}}
\renewcommand{\abstractname}{{\Large Summary}}
\renewcommand{\cftsecleader}{\cftdotfill{\cftdotsep}}
\setlength{\parskip}{12pt plus8pt minus6pt}
\setlength{\itemsep}{-5pt}
\newlength{\wideitemsep}
\setlength{\wideitemsep}{.5\itemsep}
\addtolength{\wideitemsep}{-7pt}
\let\olditem\item
\renewcommand{\item}{\setlength{\itemsep}{\wideitemsep}\olditem}
\numberwithin{equation}{section}
%========================================================================
\newenvironment{drawing}
%========================================================================
\begin{document}
%ACTUAL CODE TO PRODUCE FIGURES
%========================================================================
\begin{figure}[H]
\begin{floatrow}
\ffigbox{%
  \includegraphics[width=0.45\textwidth]{figures/dummy.jpg}%
}{%
  \caption{A figure}%
}
\capbtabbox{%
\begin{tabular}{|l|l|l|l|l}
\cline{1-4}
Number & Entry 1 & Entry 2 & Entry 3 &  \\ \cline{1-4}
Number & Entry 4 & Entry 5 & Entry 6 &  \\ \cline{1-4}
Number & Entry 7 & Entry 8 & Entry 9 &  \\ \cline{1-4}
Number} & Entry 10 & Entry 11 & Entry 12 &  \\ \cline{1-4}
\end{tabular}
}{%
  \caption{A table}%
}
\end{floatrow}
\end{figure}

I have been trying for several hours to align the two figures and their captions, without any success. I am using ShareLaTeX.

  • Please, reduce your code to minimal working example. Remove all package and commands not related to your problem. Welcome to TeX.SE! – Zarko Nov 15 '16 at 9:38
0

Note that your code does not compile due to Number}. You are probably looking for something like this:

\documentclass{article}
\usepackage{graphicx,floatrow,booktabs}

\begin{document}
\begin{figure}[tbp]
  \CenterFloatBoxes
  \begin{floatrow}
    \ffigbox{\includegraphics[width=0.45\textwidth]{example-image-1x1}}{%
      \caption{A Figure}%
      \label{fig:a}%
    }
    \killfloatstyle
    \ttabbox[\FBwidth]{%
      \begin{tabular}{llll}
        \toprule
        Head   & Head    & Head    & Head      \\ \midrule
        Number & Entry 1 & Entry 2 & Entry 3   \\ 
        Number & Entry 4 & Entry 5 & Entry 6   \\ 
        Number & Entry 7 & Entry 8 & Entry 9   \\ 
        Number & Entry 10 & Entry 11 & Entry 12   \\
        \bottomrule
      \end{tabular}%
    }{%
      \caption{A table}%
      \label{tab:a}%
    }
  \end{floatrow}
\end{figure}
\end{document}

enter image description here

Code is taken from the documentation, check section 2.3.1 Mixed Row.

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.