1

Using IEEEtran I have a table under subsubsection, which is under subsection. But the table appears between those two. Using the float package does nothing. Only if I write something after subsubsection and before the table it looks as it should. Below is the code:

\documentclass{IEEEtran}
\usepackage[spanish]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{float,booktabs}
\begin{document}
    \section{Datos}
    \subsection{Jaula de ardilla}
        \subsubsection{Conexión $\Delta$} % Consider the following table:
            \begin{table}[H]
                \centering
                \caption{Prueba en vacío}
                \begin{tabular}{lr}
                    \toprule
                    Parámetro & Valor \\
                    \midrule
                    Voltaje & 215 V\\
                    Corriente & 0.68 A\\
                    Potencia & 60 W\\
                    \bottomrule
                \end{tabular}
            \end{table}
\end{document}

But it appears like this:

enter image description here

How should I fix this problem?

  • 1
    Welcome to TeX.SE. Could you insert a transition sentence such as (the Spanish equivalent of) "Consider the following tables:" after \subsubsection{Conexión $\Delta$}? The IEEEtran document class defines \subsubsection-level headers to use "run-in" style, and evidently it really wants some real text after \subsubsection if LaTeX is to place the table environment until after the \subsubsection header. – Mico Dec 9 '15 at 16:22
  • it is impossible to run your example as it stands, but if you use [H] (and have loaded the float package to define H) then the table will not float and so will appear exactly where you place it in the source. Are your subsubsection headings display or run in to a paragraph? (I wouldn't have to ask if there was a complete example) – David Carlisle Dec 9 '15 at 16:27
  • @DavidCarlisle - I've augmented the OP's code fragment to make it into an MWE that does generate the problem he/she describes: Even with the [H] positioning specifier, the table environment is placed before the subsubsection-level header unless some filler text, such as "Consider the following table:", is provided. – Mico Dec 9 '15 at 17:35
  • @Mico thanks, but as you say it is trying to add the heading inline to a line that has a full width figure minipage from H so something has to give... – David Carlisle Dec 9 '15 at 17:49
1

The [H] positioning specifier internally creates a full-linewidth minipage and thus can't fit after the \subsubsection-level header, which is set up for run-in style and thus expects to work with something that's less than full line-width.

I can think of two solutions:

  • Provide some filler text, such as (the Spanish equivalent of) "Consider the information in the following table:", between \subsubsection{Conexión $\Delta$} and \begin{table}[H]; or

  • Omit the positioning specifier entirely -- and let LaTeX decide where the table should be placed.

The following screenshot shows the result of the first solution -- I'm afraid I don't know Spanish well enough to translate "Consider the information in the following table:".

enter image description here

\documentclass{IEEEtran}
\usepackage[spanish]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{float,booktabs}
\begin{document}
    \section{Datos}
    \subsection{Jaula de ardilla}
        \subsubsection{Conexión $\Delta$} Consider the following table:
            \begin{table}[H]
                \centering
                \caption{Prueba en vacío}
                \begin{tabular}{lr}
                    \toprule
                    Parámetro & Valor \\
                    \midrule
                    Voltaje & 215 V\\
                    Corriente & 0.68 A\\
                    Potencia & 60 W\\
                    \bottomrule
                \end{tabular}
            \end{table}
\end{document}
  • Thank you for the explanation, the filler text is a good solution. – Rashi Jacobo Dec 9 '15 at 18:05
  • 1
    for filler text, something as small (and invisible) as $ $ should suffice, although it's often better to have something meaningful. – barbara beeton Dec 9 '15 at 19:33
  • @barbarabeeton - The IEEEtran document class appears to be set up to insert an italic-mode colon (:) automatically after the text of the subsubsection-level header; see the screenshot above. Without visible filler text, I think, the header -- text followed by a colon followed by (apparently) nothing -- might look slightly weird. That's why I suggested some visible filler text... – Mico Dec 9 '15 at 20:42
  • good point about the colon. in the present case, i simply considered the table to be the "text" for the subsubsection. (the italic colon does, however, look particularly peculiar following the upright delta, but that's apparently the ieee style.) – barbara beeton Dec 9 '15 at 21:42
1

It worked as you wanted it the way you embedded your example above. I just replaced the optional H into a h. Maybe it could work with h! in your case?

  • Welcome to TeX.SE. Since you've posted your answer, I've augmented the OP's code fragment into a compilable example. The problem behavior, viz., the placement of the subsubsection-level header after the table, occurs with [H], [h], or [h!] specified as the positioning specifier. Please consider editing your answer to provide a real fix. – Mico Dec 9 '15 at 17:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.