latex : table の caption ごと左寄せする方法
latex で文章を書いているとき、表を(cell ごとのでなく、全体を)左寄せに書きたいときがある。しかし
\documentclass{article} \begin{document} Hogehogehogehoge \begin{table}[h] \caption{Hoge} \begin{tabular}{|c|c|c|c|} \hline A & B & C & D \\ \hline E & F & G & H \\ \hline \end{tabular} \end{table} Hogehoge \end{document}
このようにやると、出力が下のようになり、caption が取り残される。table 環境を flushleft 環境で囲っても同じ結果になる。
これは threeparttable パッケージを使えば解決できた。下のように tabular 環境を threeparttable 環境で囲む。
\documentclass{article} \usepackage{threeparttable} \begin{document} Hogehogehogehoge \begin{table}[h] \begin{threeparttable} \caption{Hoge} \begin{tabular}{|c|c|c|c|} \hline A & B & C & D \\ \hline E & F & G & H \\ \hline \end{tabular} \end{threeparttable} \end{table} Hogehoge \end{document}
出力は下のようになり、caption も引っ張ってこれる。
threeparttable にはほかにも機能がありそうなので、色々試してみたい。