TransWikia.com

Centering table caption for two-column layout

TeX - LaTeX Asked on April 15, 2021

documentclass{article}
usepackage[left=2cm, right=2cm, top=2cm, bottom=2cm]{geometry}
usepackage{multicol,lipsum, booktabs}
usepackage{caption}
DeclareCaptionLabelSeparator{par}{par}
DeclareCaptionLabelFormat{Wijaya}{hfilMakeUppercase{#1}space Roman{table}}
DeclareCaptionTextFormat{sc}{{scshape #1}}
captionsetup{labelsep=par, labelformat=Wijaya, textformat=sc}
begin{document}
begin{multicols}{2}
lipsum[1-5]
end{multicols}
begin{table}[h!]
    renewcommand{arraystretch}{1.2}
    caption{Description of Variables and Parameters} label{table1}
    begin{tabular}{cp{5.5cm}}
        hline
        midrule[0.1pt]
        Symbol& Parameters
        hline
        $S$&Susceptible subpopulations
        $E$&Educated subpopulations
        $I$&Infected subpopulations
        $R$&Recovered subpopulations
        $B$&Bacteria populations
        $Lambda$&Human birth rate
        $mu$&The human natural death rate
        $beta_1$&Interaction rate of susceptible subpopulations with bacteria populations
        $beta_2$&Interaction rate of educated subpopulations with bacteria populations
        $k$&Constant saturation rate of the bacteria population
        $omega$&The loss rate of immunity
        $phi$&Educated rate
        $gamma$&The recovery rate of naturally infected populations
        $alpha$&Death rate that caused by cholera infection
        $xi$&The growth rate of bacteria
        $delta$&The natural death rate of bacteria
        hline
        midrule[0.1pt]
    end{tabular}
end{table}
end{document}

Why the caption table cannot center in left column? How to fix it?

enter image description here

I want

enter image description here

2 Answers

Some suggestions and comments:

  • To typeset the table across the entire width of text block, use a table* environment, not a table environment.

  • To center-set the "Table I" label, replace hfil with centering in the DeclareCaptionLabelFormat{Wijaya}{...} directive.

  • I would replace the two instance of the old-fashioned hlinemidrule[0.1pt] directives with toprule and bottomrule, respectively.

enter image description here

documentclass{article}
usepackage[margin=2cm]{geometry}
usepackage{multicol,lipsum, booktabs, ragged2e,array}

usepackage{caption}
DeclareCaptionLabelSeparator{par}{par}
DeclareCaptionLabelFormat{Wijaya}{centeringMakeUppercase{#1}space Roman{table}}
DeclareCaptionTextFormat{sc}{{scshape #1}}
captionsetup{labelsep=par, labelformat=Wijaya, textformat=sc}
begin{document}
%begin{multicols}{2}
%lipsum[1-5]
%end{multicols}
begin{table*}
centering
    %renewcommand{arraystretch}{1.2}
    setlengthextrarowheight{2pt}
    caption{Description of Variables and Parameters} label{table1}
    begin{tabular}{@{} >{$}c<{$} >{RaggedRight}p{5.5cm} @{}}
        toprule
        mbox{Symbol} &  Parameters
        midrule
        S & Susceptible subpopulations
        E & Educated subpopulations
        I & Infected subpopulations
        R & Recovered subpopulations
        B & Bacteria populations
        Lambda & Human birth rate
        mu     & Human natural death rate
        beta_1 & Interaction rate of susceptible subpopulations with bacteria populations
        beta_2 & Interaction rate of educated subpopulations with bacteria populations
        k       & Constant saturation rate of the bacteria population
        omega  & Loss rate of immunity
        phi    & Educated rate
        gamma  & Recovery rate of naturally infected populations
        alpha  & Death rate that caused by cholera infection
        xi     & Growth rate of bacteria
        delta  & Natural death rate of bacteria
        bottomrule
    end{tabular}
end{table*}
end{document}

Correct answer by Mico on April 15, 2021

As I mentioned in my comment, it is not clear, what is your problem. Your table can be easy fit in one column, so I would stick with following solution:

documentclass[twocolumn]{article} % <---
usepackage[left=2cm, right=2cm, top=2cm, bottom=2cm]{geometry}
usepackage{amsmath}  % <---
usepackage{booktabs, tabularx}  % <---
usepackage{caption}
captionsetup[table]{ % <---
    skip=1ex,
    name=TABLE,
    labelfont={normalsize}, font={footnotesize,sc},
    labelsep=newline,
    justification=centerlast
                    }
renewcommand{thetable}{Roman{table}}  % <---

usepackage{lipsum}

begin{document}
lipsum[1]
begin{table}[ht!]
    centering
    renewcommand{arraystretch}{1.2}
    caption{Description of Variables and Parameters} label{table1}
    begin{tabularx}{linewidth}{@{} >{$}c<{$} X @{}}  % <---
        toprule
    text{Symbol}
        &   Parameters                          
        midrule
    S   &   Susceptible subpopulations          
    E   &   Educated subpopulations             
    I   &   Infected subpopulations             
    R   &   Recovered subpopulations            
    B   &   Bacteria populations                
Lambda &   Human birth rate                    
mu     &   The human natural death rate        
beta_1 &   Interaction rate of susceptible subpopulations with bacteria populations
beta_2 &   Interaction rate of educated subpopulations with bacteria populations
    k   &   Constant saturation rate of the bacteria population
omega  &   The loss rate of immunity           
phi    &   Educated rate                       
gamma  &   The recovery rate of naturally infected populations
alpha  &   Death rate that caused by cholera infection
xi     &   The growth rate of bacteria         
delta  &   The natural death rate of bacteria  
    bottomrule
    end{tabularx}  % <---
end{table}
lipsum[2-6]
end{document}

Note: changes in compasin of your MWE are marked by <--- above code.

enter image description here

Answered by Zarko on April 15, 2021

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