TransWikia.com

Gap Between tabular and caption* Inside table

TeX - LaTeX Asked by Junyong Kim on October 30, 2020

I am inserting two tabulars in one table for Panels A and B. The table has one caption, and each tabular also has one caption* as follows.

documentclass{article}
usepackage{caption}
begin{document}
begin{table}
centering
caption{SHORT TITLE}
caption*{Panel A. LONG DESCRIPTION}
begin{tabular}{*5c} hline
0 & 0 & 0 & 0 & 0 
0 & 0 & 0 & 0 & 0  hline
end{tabular}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%             I ALSO NEED A GAP HERE             %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

caption*{Panel B. LONG DESCRIPTION}
begin{tabular}{*5c} hline
0 & 0 & 0 & 0 & 0 
0 & 0 & 0 & 0 & 0  hline
end{tabular}
end{table}
end{document}

And I found that the gap between the first tabular and the second caption* is too tight. The other three gaps (captioncaption*, caption*tabular, caption*tabular) are OK. Why do they have different gaps?

I also tried subtables as follows, but still the tight gap looks ugly.

documentclass{article}
usepackage{caption,subcaption}
begin{document}
begin{table}
centering
caption{SHORT TITLE}
begin{subtable}{textwidth}
centering
subcaption{Panel A. LONG DESCRIPTION}
begin{tabular}{*5c} hline
0 & 0 & 0 & 0 & 0 
0 & 0 & 0 & 0 & 0  hline
end{tabular}
end{subtable}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%              STILL NO GAP APPLIED              %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

begin{subtable}{textwidth}
centering
subcaption{Panel B. LONG DESCRIPTION}
begin{tabular}{*5c} hline
0 & 0 & 0 & 0 & 0 
0 & 0 & 0 & 0 & 0  hline
end{tabular}
end{subtable}
end{table}
end{document}

Here I add my version (vspace{10pt} for caption* and vspace{6pt} for subcaption*) but don’t know if best.

documentclass{article}
usepackage{caption}
begin{document}
begin{table}
centering
caption{SHORT TITLE}
caption*{Panel A. LONG DESCRIPTION}
begin{tabular}{*5c} hline
0 & 0 & 0 & 0 & 0 
0 & 0 & 0 & 0 & 0  hline
end{tabular}vspace{10pt}

caption*{Panel B. LONG DESCRIPTION}
begin{tabular}{*5c} hline
0 & 0 & 0 & 0 & 0 
0 & 0 & 0 & 0 & 0  hline
end{tabular}
end{table}
end{document}

One Answer

Perhaps this example will help.

documentclass{article}

RequirePackage{float}
RequirePackage{caption}

begin{document}
    
centerline{SHORT TITLE}

    begin{table}[H]
        centering      
        caption*{Panel A. LONG DESCRIPTION}
        begin{tabular}{*5c} hline
            0 & 0 & 0 & 0 & 0 
            0 & 0 & 0 & 0 & 0  hline
        end{tabular}
    end{table}     
        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                     I ALSO NEED A GAP HERE             %
        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    begin{table}[H]    
            centering
        caption*{Panel B. LONG DESCRIPTION}
        begin{tabular}{*5c} hline
            0 & 0 & 0 & 0 & 0 
            0 & 0 & 0 & 0 & 0  hline
        end{tabular}
    end{table}

end{document}

enter image description here

Or this one: (you can also use subcaption*{⟨heading⟩} )

documentclass{article}
usepackage{subcaption}
begin{document}

begin{table}
    caption{FULL CAPTION}
    begin{subtable}[t]{.5linewidth}
      centering
     subcaption{    Panel A. LONG DESCRIPTION LONG DESCRIPTION }
        begin{tabular}{*5c} hline
            0 & 0 & 0 & 0 & 0 
            0 & 0 & 0 & 0 & 0  hline
        end{tabular}
    end{subtable}%
    begin{subtable}[t]{.5linewidth}
      centering
    subcaption{  Panel B. LONG DESCRIPTION  LONG DESCRIPTION}
      begin{tabular}{*5c} hline
        0 & 0 & 0 & 0 & 0 
        0 & 0 & 0 & 0 & 0  hline
      end{tabular}
    end{subtable} 
end{table}

end{document}

enter image description here

UPDATE after the comment. Put everything in a table environment.

documentclass{article}

RequirePackage{float}
RequirePackage{caption}

begin{document}

begin{table}
      
caption{SHORT TITLE 1}

    begin{table}[H]
        centering      
        caption*{Panel A. LONG DESCRIPTION}
        begin{tabular}{*5c} hline
            0 & 0 & 0 & 0 & 0 
            0 & 0 & 0 & 0 & 0  hline
        end{tabular}
    end{table}     
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                 I ALSO NEED A GAP HERE             %
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    begin{table}[H]    
        centering
        caption*{Panel B. LONG DESCRIPTION}
        begin{tabular}{*5c} hline
            0 & 0 & 0 & 0 & 0 
            0 & 0 & 0 & 0 & 0  hline
        end{tabular}
    end{table}

end{table}

noindent ANOTHER GAP HERE    

begin{table}[H] 
  
    caption{SHORT TITLE 2}
    
    begin{table}[H]
        centering      
        caption*{Panel C. LONG DESCRIPTION}
        begin{tabular}{*5c} hline
            0 & 0 & 0 & 0 & 0 
            0 & 0 & 0 & 0 & 0  hline
        end{tabular}
    end{table}     
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PLUS ANOTHER GAP HERE               %
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    begin{table}[H]    
        centering
        caption*{Panel D. LONG DESCRIPTION}
        begin{tabular}{*5c} hline
            0 & 0 & 0 & 0 & 0 
            0 & 0 & 0 & 0 & 0  hline
        end{tabular}
    end{table}
    
end{table}

end{document}

enter image description here

Correct answer by Simon Dispa on October 30, 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