모든 테이블에 대해 [hbt] 및 \centering을 반복하지 마십시오.

모든 테이블에 대해 [hbt] 및 \centering을 반복하지 마십시오.

내가 작성 중인 문서에서는 익숙한 단어를 사용하고 있습니다.[hbt]플로팅 테이블 옵션을 선택했고센터그들을. 테이블을 생성할 때마다 이 작업을 반복하지 않고 싶습니다. 새로운 환경을 시작할 때마다 이 두 가지 옵션이 사용되도록 하는 내용을 서문에 추가하는 것이 쉽다고 생각합니까 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}

관련 정보