
LaTeX 문서에 캡션을 배치하는 데 문제가 있습니다. 저는 trivfloat 패키지를 사용하여 일반 "테이블" 환경과 유사한 테이블용 "quadro" 환경을 만들고 있습니다.
내 코드의 최소한의 예는 다음과 같습니다.
\documentclass{article}
\usepackage{caption}
\usepackage{trivfloat}
\trivfloat{quadro}
\begin{document}
\section{Introduction}
\begin{table}[!htbp]
\centering
\caption{Example of a table}
\begin{tabular}{|c|c|}
\hline
Column 1 & Column 2 \\
\hline
Data 1 & Data 2 \\
Data 3 & Data 4 \\
\hline
\end{tabular}
\end{table}
\begin{quadro}[!htbp]
\centering
\caption{Example of a quadro}
\begin{tabular}{|c|c|}
\hline
Column 1 & Column 2 \\
\hline
Data 1 & Data 2 \\
Data 3 & Data 4 \\
\hline
\end{tabular}
\end{quadro}
\end{document}
보시다시피 "테이블" 환경에 대한 캡션은 제가 원하는 테이블 위에 배치됩니다. 다만, "쿼드로" 환경에 대한 캡션이 테이블 아래에 배치되어 있는데, "테이블" 환경과 유사하게 쿼드로 위에 있었으면 좋겠습니다.
trivfloat 패키지를 사용하여 이를 달성할 수 있는 방법이 있습니까? 아니면 대신 사용해야 하는 다른 패키지나 방법이 있습니까?
어떤 도움이나 제안이라도 대단히 감사하겠습니다. 미리 감사드립니다!
답변1
나는 Caboha의 조언을 구현하여 해결책을 찾았습니다. "quadro" 환경의 상단에 캡션을 배치하기 위해 floatstyle을 추가했습니다: \usepackage{trivfloat} \trivfloat{quadro} \floatstyle{plaintop} \restylefloat{quadro} .
답변2
을(를) 사용하고 싶습니다 newfloat
.
\documentclass{article}
\usepackage{caption}
\usepackage{newfloat}
\DeclareFloatingEnvironment[
fileext=loq,
listname=List of Quadros,
name=Quadro,
placement=htp,
]{quadro}
\captionsetup[quadro]{position=top}
\begin{document}
\listofquadros
\section{Introduction}
\begin{table}[!htbp]
\centering
\caption{Example of a table}
\begin{tabular}{|c|c|}
\hline
Column 1 & Column 2 \\
\hline
Data 1 & Data 2 \\
Data 3 & Data 4 \\
\hline
\end{tabular}
\end{table}
\begin{quadro}[!htbp]
\centering
\caption{Example of a quadro}
\begin{tabular}{|c|c|}
\hline
Column 1 & Column 2 \\
\hline
Data 1 & Data 2 \\
Data 3 & Data 4 \\
\hline
\end{tabular}
\end{quadro}
\end{document}