I'm trying to place a a simple table and a tikz image side by side. It doesn't seem to be working at all and they get stacked on top of eachother.
\documentclass[11pt]{article}
\usepackage[linesnumbered,ruled,vlined]{algorithm2e}
\usepackage{amssymb}
\usepackage{booktabs}
\usepackage{tikz}
\usepackage{float}
\usepackage{graphicx}
\begin{document}
\begin{figure}[ht]
\centering
\noindent\begin{minipage}{.5\linewidth}
\centering
\begin{tikzpicture}
\node[draw] (A1) at (0,0) {$A_1$};
\node[draw] (A2) at (1.5,0) {$A_2$};
\node[draw] (A3) at (3,0) {$A_3$};
\draw[->] (A1) to (A2);
\draw[bend left, ->] (A2) to (A3);
\draw[bend left, ->] (A3) to (A2);
\end{tikzpicture}
\end{minipage}
\begin{minipage}{.5\linewidth}
\begin{tabular}{l | c c c}
\toprule
Attacking/Attacked & $A_1$ & $A_2$ & $A_3$ \\ \midrule
$A_1$ & 0 & 1 & 0 \\
$A_2$ & 0 & 0 & 1 \\
$A_3$ & 0 & 1 & 0 \\
\toprule
$\sum Attacked$ & 0 & 2 & 1 \\
\bottomrule
\end{tabular}
\end{minipage}
\caption{Some matrix}
\label{graph:exampleMatrix}
\end{figure}
\end{document}
I've tried using minipage, but my image gets stacked.
Best Answer
I suggest to use
tabular
environment instead ofminipages
:For vertical space in cells I add macro
\makegapedcells
, set gabs to5pt
and remove vertical spaces around rules frombooktabs
.