
간단한 테이블과 tikz 이미지를 나란히 배치하려고 합니다. 전혀 작동하지 않는 것 같고 서로 겹쳐져 있습니다.
\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}
미니페이지를 사용해 보았으나 이미지가 쌓였습니다.
답변1
tabular
다음 대신 환경을 사용하는 것이 좋습니다 minipages
.
\documentclass[11pt]{article}
\usepackage{booktabs, makecell}
\usepackage{tikz}
\begin{document}
\begin{figure}[ht]
\centering
\setcellgapes{5pt}
\makegapedcells
\setlength\belowrulesep{0pt}
\setlength\aboverulesep{0pt}
\begin{tabular}{c@{\qquad}c}
\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}
&
\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{tabular}
\caption{Some matrix}
\label{graph:exampleMatrix}
\end{figure}
\end{document}
셀의 세로 공간에 대해 매크로를 추가 \makegapedcells
하고 간격을 설정 5pt
하고 규칙 주위의 세로 공간을 제거합니다 booktabs
.