2016年1月31日日曜日

TeXで図を並べる

自分はTeXで図を並べるとき、

\begin{figure}
  \begin{center}
  \begin{tabular}{cc}
    \includegraphics[width=0.45\hsize]{hoge.png} &
    \includegraphics[width=0.45\hsize]{hoge.png} \\
    (a) hoge &
    (b) hoge \\
    \includegraphics[width=0.45\hsize]{hoge.png} &
    \includegraphics[width=0.45\hsize]{hoge.png} \\
    (c) hoge &
    (d) hoge \\
  \end{tabular}
  \end{center}
\end{figure}

みたいに書くのですが、図が大きいと縦にはみ出ることがある。
で、longtableを使えば解決するのかなと思ったんですが、どうやらfigure内でpagebreakすることができないらしい。
でも、figureを2個にすると図番号がなぁ...とか思ってたら、figure*するといいらしい。
具体的には
\begin{figure*}
  \begin{center}
  \begin{tabular}{cc}
    \includegraphics[width=0.45\hsize]{hoge.png} &
    \includegraphics[width=0.45\hsize]{hoge.png} \\
    (a) hoge &
    (b) hoge \\
  \end{tabular}
  \end{center}
\end{figure*}
\begin{figure}
  \begin{center}
  \begin{tabular}{cc}
    \includegraphics[width=0.45\hsize]{hoge.png} &
    \includegraphics[width=0.45\hsize]{hoge.png} \\
    (c) hoge &
    (d) hoge \\
  \end{tabular}
  \end{center}
\end{figure}
って書いとけばOKって話。
\section*{hoge}的なのは知ってたけど、figureとかにも*が使えるっぽいですね。
勉強になりました。


0 件のコメント:

コメントを投稿