TransWikia.com

Table captions expanding over both columns in a single-column table

TeX - LaTeX Asked by Mate de Vita on December 16, 2020

I’m using the 2-column IET template and am running into a problem with tables. Namely, the captions of the tables extend over both columns even when the table itself is single-column. I’ve set up a dummy project with a MWE .tex file to demonstrate the problem:

documentclass{cta-author}

begin{document}

supertitle{Test}

title{Test}

author{au{First Author$^{1}$}, au{Second Author$^{2corr}$}, au{Third Author$^{3}$}}

address{add{1}{First Department, First University, Address, City, Country Name}
add{2}{Second Company Department, Company Address, City, Country Name}
add{3}{Third Department, Third University, Address, Country Name}
add{4}{Current affiliation: Fourth Department, Fourth University, Address, Country Name}
email{[email protected]}}

begin{abstract}
In the beginning the Universe was created. This had made many people very angry and has been widely regarded as a bad move.
end{abstract}

maketitle

section{Figure}

Figures work fine as seen in Figure ref{fig:sample}.

begin{figure}
    centering
    includegraphics[width=linewidth]{example-image-a}
    caption{This is a fairly long caption that doesn't actually provide any relevant, helpful, or indeed at all useful information about the figure in question.}
    label{fig:sample}
end{figure}

section{Table}

However, table captions extend over two columns even when the table itself is in a single column as seen in Table ref{tab:sample}.

begin{table}
    caption{This is another long and unhelpful caption that doesn't actually say anything about the below table but it does helpfully demonstrate the problem being discussed. Notice the table itself is appropriately placed and centred but the caption extends over both columns.}
    label{tab:sample}
    centering
    begin{tabular}{c|c}
         1 & 2 
         3 & 4
    end{tabular}
end{table}

end{document}

Compiled PDF of above code

(I cannot paste in the class file itself, as it breaks the 30k character limit.)

What do I need to fix in the class file to solve this problem? I’d like to avoid having to add manual line breaks in all my table captions.

One Answer

The cta-author class has a quite peculiar syntax required for table.

documentclass{cta-author}
usepackage{lipsum} % for filler text

begin{document}

supertitle{Test}

title{Test}

author{au{First Author$^{1}$}, au{Second Author$^{2corr}$}, au{Third Author$^{3}$}}

address{add{1}{First Department, First University, Address, City, Country Name}
add{2}{Second Company Department, Company Address, City, Country Name}
add{3}{Third Department, Third University, Address, Country Name}
add{4}{Current affiliation: Fourth Department, Fourth University, Address, Country Name}
email{[email protected]}}

begin{abstract}
In the beginning the Universe was created. This had made many people very angry and has been widely regarded as a bad move.
end{abstract}

maketitle

section{Figure}

Figures work fine as seen in Figure ref{fig:sample}.

begin{figure}
    centering
    includegraphics[width=linewidth]{example-image-a}
    caption{This is a fairly long caption that doesn't actually provide any relevant, helpful, or indeed at all useful information about the figure in question.}
    label{fig:sample}
end{figure}

section{Table}

However, table captions extend over two columns even when the table itself is in a single column as seen in Table ref{tab:sample}.

begin{table}
processtable{This is another long and unhelpful caption that doesn't actually say anything 
about the below table but it does helpfully demonstrate the problem being 
discussed. Notice the table itself is appropriately placed and centred but the 
caption extends over both columns.label{tab:sample}}
{makebox[columnwidth]{begin{tabular}{c|c}
1 & 2 
3 & 4
end{tabular}}}{}
end{table}

lipsum

end{document}

enter image description here

Actually, the caption is typeset with the same width as the table (for reasons that I can't understand), so I cheated with makebox[columnwidth]{...}.

Correct answer by egreg on December 16, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP