Latex図の書き方

[pukiwiki]

一段組で、スペース削減のために複数の図や表を横に並べたいときがあります。そういうときは、minipage コマンドを使って以下のようにします。

%% 図を横に並べる場合
\begin{figure}
\begin{tabular}{cc}
\begin{minipage}{0.4\textwidth}
Left Figure\caption{Caption Left}\label{fig:right}
\end{minipage} &
\begin{minipage}{0.4\textwidth}
Right Figure\caption{Caption Right}\label{fig:left}
\end{minipage}
\end{tabular}
\end{figure}

しかし、これで caption をつけると両方とも一番外の float 環境の形式になってしまうので、図 (figure) と表 (table) を並べると caption が変になってしまいます。本当は、multicol.sty などを使うのが良いのかもしれませんが、例えば ad hoc には以下のようにしてしまいましょう。

%% 図と表とを横に並べる場合
\begin{figure}
\begin{tabular}{cc}
\begin{minipage}{0.4\textwidth}
Left Figure\caption{Caption Left}\label{fig:right}
\end{minipage} &
\renewcommand{\figurename}{Table}
\setcounter{figure}{nt} %% 表の番号をセット
\begin{minipage}{0.4\textwidth}\caption{Caption Right}\label{fig:left}
Right Figure
\end{minipage}
\end{tabular}
\end{figure}
\renewcommand{\figurename}{Figure}
\setcounter{figure}{nf} %% 図の番号をリセット

[/pukiwiki]