![すべてのテーブルで [hbt] と \centering を繰り返さないようにする](https://rvso.com/image/287060/%E3%81%99%E3%81%B9%E3%81%A6%E3%81%AE%E3%83%86%E3%83%BC%E3%83%96%E3%83%AB%E3%81%A7%20%5Bhbt%5D%20%E3%81%A8%20%5Ccentering%20%E3%82%92%E7%B9%B0%E3%82%8A%E8%BF%94%E3%81%95%E3%81%AA%E3%81%84%E3%82%88%E3%81%86%E3%81%AB%E3%81%99%E3%82%8B.png)
私が書いている文書では、おなじみの[hbt]
私のフローティングテーブルのためのオプション、そして私は中心テーブルを作成するたびにこれを繰り返さないようにしたいのですが、新しい環境を開始するたびにこれらの 2 つのオプションが使用されるようにする何かをプリアンブルに追加するのは簡単だと思いますかtable
?
\documentclass{article}
\begin{document}
\begin{table}[hbt]
\centering
\begin{tabular}{*3{l}}
1 & 2 & 3\\
a & b & c\\
\end{tabular}
\end{table}
\end{document}
答え1
デフォルトの図形の配置は次のように設定できます。
\makeatletter
\renewcommand\fps@figure{htbp}
\makeatletter
p
(デフォルトに含めないのはほとんどの場合悪い考えです)
中央揃えにするには、\@floatboxreset
\makeatletter
\def \@floatboxreset {%
\reset@font
\normalsize
\@setminipage
\centering%<<<<<<<<<<<<<<<<<<<
}
\makeatletter
答え2
のfloat
パッケージ特定のフロートのフロート配置を指定するためのインターフェースを提供します。
\floatplacement{<type>}{<spec>}
この\floatplacement
コマンドは、フロートのクラスのデフォルトの配置指定子をリセットします。つまり、次のように使用できます。
\floatplacement{table}{hbt}
あなたが求めているものを達成するためです。
答え3
試す
\documentclass{article}
\newenvironment{mytable}
{\begin{table}[hbt]
\centering}
{\end{table}}
\begin{document}
\begin{mytable}
\begin{tabular}{*3{l}}
1 & 2 & 3\\
a & b & c\\
\end{tabular}
\end{mytable}
\end{document}
\end{document}
答え4
ヴェルナーの答えロックステップでここに答えに画像を自動的に中央に配置するにはどうすればいいですか?次のように実行できます。
\documentclass{article}
\usepackage{floatrow} % this automatically centers all floats
\floatplacement{table}{hbtp} % all tables are given the [hbtp] option
\begin{document}
\begin{table}
\begin{tabular}{*3{l}}
1 & 2 & 3\\
a & b & c\\
\end{tabular}
\end{table}
\end{document}