0

I'm having some trouble with the placement of captions in my LaTeX document. I'm using the trivfloat package to create a "quadro" environment for my tables, similar to the regular "table" environment.

Here's a minimal example of my code:

\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}

As you can see, the caption for the "table" environment is placed above the table, which is what I want. However, the caption for the "quadro" environment is placed below the table, and I'd like it to be above the quadro, similar to the "table" environment.

Is there a way to achieve this using the trivfloat package, or is there another package or method I should be using instead?

Any help or suggestions would be greatly appreciated. Thank you in advance!

5
  • trivfloat uses either float (in your case) or floatrow for new floats. See the manual of these packages about changing caption position. BTW: An alternative would be to use the newfloat package from the same author as caption.
    – cabohah
    Commented Feb 7 at 18:55
  • Do you employ the babel package? If so, with which language option(s)? Please also clarify if you intend to employ both table and quadro environments, or just quadro environments.
    – Mico
    Commented Feb 7 at 19:01
  • Thx I'm using Springer Verlag global LaTeX document class for monographs Commented Feb 7 at 20:11
  • I intend to employ both table and quadro environments. Commented Feb 7 at 20:12
  • FYI crosspost: latex.org/forum/viewtopic.php?f=45&t=35784
    – Stefan Kottwitz
    Commented Feb 8 at 15:32

2 Answers 2

0

I discovered a solution by implementing Caboha's advice: In order to place the caption at the top of my "quadro" environment, I added the floatstyle: \usepackage{trivfloat} \trivfloat{quadro} \floatstyle{plaintop} \restylefloat{quadro}.

0

You want to use 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}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .