TransWikia.com

Landscape table going off the page in elsarticle

TeX - LaTeX Asked by Cairan Van Rooyen on May 1, 2021

I have a big table, which means i need to change to landscape orientation in an elsarticle document. The problem i have is the table goes off the page and I am not sure how to fix this.

MWE below:

documentclass[final,10p,twocolumn,authoryear]{elsarticle}
usepackage[a4paper,width=180mm,top=25mm,bottom=25mm]{geometry}
usepackage{multirow}
usepackage{booktabs}
usepackage{pdflscape}
usepackage{array}
usepackage{arydshln}
setlengthdashlinedash{0.2pt}
setlengthdashlinegap{1.5pt}
setlengtharrayrulewidth{0.3pt}


begin{document}

begin{landscape}
begin{table*}
    caption[Caption.]{Caption.}
    label{label}
    begin{tabular}{ p{0.082textwidth} p{0.08textwidth} p{0.08textwidth} p{0.08textwidth} p{0.08textwidth} p{0.08textwidth} p{0.08textwidth} p{0.08textwidth} p{0.08textwidth} p{0.08textwidth} p{0.08textwidth} } toprule
        & multicolumn{8}{c}{Something}         &   ~   
        Something                   & multicolumn{3}{c}{Something(2)}                  & multicolumn{3}{c}{Something(1)}              & multicolumn{3}{c}{Something (0)}             & Something          
        & Some & Some & Some                            & Some & Some & Some                        & Some & Some & Some                        &                midrule
        Something (2)                           & textbf{data (data%)} & data (data%) & data (data%)                    & data (data%) & data (data%) & data (data%)                         & data  (data%) & data (data%) & data (data%)                            & data           hdashline
        Something (2)                           & textbf{data (data%)} & data (data%) & data (data%)                    & data (data%) & data (data%) & data (data%)                         & data  (data%) & data (data%) & data (data%)                            & data           hdashline
        Something (2)                           & textbf{data (data%)} & data (data%) & data (data%)                    & data (data%) & data (data%) & data (data%)                         & data  (data%) & data (data%) & data (data%)                            & data          
        bottomrule
    end{tabular}
end{table*}
end{landscape}

end{document}

enter image description here

2 Answers

I think begin{landscape} is messing with page layout. See that the page number is misplaced.

I'd rotate the table manually with a minipage inside a rotatebox. Needed to use centering to put the table in the middle of the page.

Check if this is enough for your problem:

documentclass[final,10p,twocolumn,authoryear]{elsarticle}
usepackage[a4paper,width=180mm,top=25mm,bottom=25mm]{geometry}
%usepackage{multirow}
usepackage{booktabs}
usepackage{pdflscape}
%usepackage{array}
usepackage{arydshln}
setlengthdashlinedash{0.2pt}
setlengthdashlinegap{1.5pt}
setlengtharrayrulewidth{0.3pt}


begin{document}


begin{table*}
    centering
    rotatebox{90}{
    begin{minipage}{textwidth}
    caption[Caption.]{Caption.}
    label{label}

    begin{tabular}{ p{0.082textwidth} p{0.08textwidth} p{0.08textwidth} p{0.08textwidth} p{0.08textwidth} p{0.08textwidth} p{0.08textwidth} p{0.08textwidth} p{0.08textwidth} p{0.08textwidth} p{0.08textwidth} } toprule
        & multicolumn{8}{c}{Something}         &   ~   
        Something                   & multicolumn{3}{c}{Something(2)}                  & multicolumn{3}{c}{Something(1)}              & multicolumn{3}{c}{Something (0)}             & Something          
        & Some & Some & Some                            & Some & Some & Some                        & Some & Some & Some                        &                midrule
        Something (2)                           & textbf{data (data%)} & data (data%) & data (data%)                    & data (data%) & data (data%) & data (data%)                         & data  (data%) & data (data%) & data (data%)                            & data           hdashline
        Something (2)                           & textbf{data (data%)} & data (data%) & data (data%)                    & data (data%) & data (data%) & data (data%)                         & data  (data%) & data (data%) & data (data%)                            & data           hdashline
        Something (2)                           & textbf{data (data%)} & data (data%) & data (data%)                    & data (data%) & data (data%) & data (data%)                         & data  (data%) & data (data%) & data (data%)                            & data          
        bottomrule
    end{tabular}
    end{minipage}
}
end{table*}

end{document}

enter image description here

Correct answer by Jander on May 1, 2021

Just use table in place of table*:

documentclass[final,10p,twocolumn,authoryear]{elsarticle}
usepackage[a4paper,width=180mm,top=25mm,bottom=25mm]{geometry}
usepackage{multirow}
usepackage{booktabs}
usepackage{pdflscape}
usepackage{array}
usepackage{arydshln}
setlengthdashlinedash{0.2pt}
setlengthdashlinegap{1.5pt}
setlengtharrayrulewidth{0.3pt}

begin{document}
 
 begin{landscape}
  begin{table}
   centering
   caption[Caption.]{Caption.}
   label{label}
   begin{tabular}{ p{0.082textwidth} p{0.08textwidth} p{0.08textwidth} p{0.08textwidth} p{0.08textwidth} p{0.08textwidth} p{0.08textwidth} p{0.08textwidth} p{0.08textwidth} p{0.08textwidth} p{0.08textwidth} } toprule
    & multicolumn{8}{c}{Something}         &   ~   
    Something                   & multicolumn{3}{c}{Something(2)}                  & multicolumn{3}{c}{Something(1)}              & multicolumn{3}{c}{Something (0)}             & Something          
    & Some & Some & Some                            & Some & Some & Some                        & Some & Some & Some                        &                midrule
    Something (2)                           & textbf{data (data%)} & data (data%) & data (data%)                    & data (data%) & data (data%) & data (data%)                         & data  (data%) & data (data%) & data (data%)                            & data           hdashline
    Something (2)                           & textbf{data (data%)} & data (data%) & data (data%)                    & data (data%) & data (data%) & data (data%)                         & data  (data%) & data (data%) & data (data%)                            & data           hdashline
    Something (2)                           & textbf{data (data%)} & data (data%) & data (data%)                    & data (data%) & data (data%) & data (data%)                         & data  (data%) & data (data%) & data (data%)                            & data          
    bottomrule
   end{tabular}
  end{table}
 end{landscape}
 
end{document}

enter image description here

Answered by Ivan on May 1, 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