TransWikia.com

How to add a new column at the end of the table?

TeX - LaTeX Asked on August 16, 2021

Could someone please show me how to add a new column at the end of the table?

documentclass[11pt]{article}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
usepackage{babel}
usepackage{mathtools,amssymb}
usepackage{booktabs, makecell, 
            threeparttable}       % <---
setlengthheavyrulewidth{2pt}    % <---
setlengthlightrulewidth{1.2pt}  % <---

setcellgapes{3pt}
renewcommandtheadfont{normalsizebfseries}
renewcommandtheadgape{}

usepackage{isotope}
usepackage[table]{xcolor}
arrayrulecolor{teal}
usepackage[skip=0.5ex]{caption}
    DeclareCaptionLabelFormat{uc}{MakeUppercase{#1}~#2}                % <===
    DeclareCaptionFont{teal}{color{teal}fontfamily{iwona}selectfont} % <===
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%usepackage{booktabs}
%usepackage[flushleft]{threeparttable} % <---
usepackage{dcolumn}
newcolumntype{d}[1]{D{.}{.}{#1}}
begin{document}

begin{table}[ht] centering
begin{threeparttable}
renewcommandthetable{3}
caption{XXXXXXXXXXX XXXXXXX XXXXXXXXX XXXXXXXX XXXXXXXX}

begin{tabular}{ l d{3.1} d{1.1} }
toprule
multicolumn{1}{c}{XXXXXXX XXXXX}
&multicolumn{1}{c}{XXXX XXXXXX}
&multicolumn{1}{c}{XX(^a)}
midrule
  
XXX & 8.2 & 1.2  
  
XXX & 305.2 & 1.1  

XXXXX & 189.3 & 0.6 

XXXX & 62.3 & 0.1 
 
XXXX XXXX & 2.3  & 0.4 

XXXXX XXXXX & 39.5 & 1.2 
  
XXX  & 0.3 & 1.2 

XXXXXX XXXXXXXX & 9.2 & 0.9 

XXXXXXXX & 8.9 & 1.4 
    midrule
multicolumn{1}{c}{XXXXX XXXX} 
cmidrule{1-1}

XXXXXXX & 9.2 & 0.5 
XXXXXX XXXXXX XXXXXXXX 90 & 562.3 & 2 
XXXX XXXXX XXXXXX 10 & 98.2 & 1.2 
XX XXXXXXX XXXXXXX 30 & 1.9 & 0.1 
XXXXXX XXXXX 10 & 90.3 & 1.5 
XXXXX XXXXXXX 20 & 9.8 & 1.9 
    bottomrule
end{tabular}

begin{tablenotes}[para]    % <---

(^a)XX = XXXXX XXXXXXXXX
end{tablenotes}
end{threeparttable}
end{table}
end{document} 

One Answer

As far as I can tell, this is what you're looking for:

documentclass[11pt]{article}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
usepackage{babel}
usepackage{mathtools,amssymb}
usepackage{booktabs, makecell, 
            threeparttable}       % <---
setlengthheavyrulewidth{2pt}    % <---
setlengthlightrulewidth{1.2pt}  % <---

setcellgapes{3pt}
renewcommandtheadfont{normalsizebfseries}
renewcommandtheadgape{}

usepackage{isotope}
usepackage[table]{xcolor}
arrayrulecolor{teal}
usepackage[skip=0.5ex]{caption}
    DeclareCaptionLabelFormat{uc}{MakeUppercase{#1}~#2}                % <===
    DeclareCaptionFont{teal}{color{teal}fontfamily{iwona}selectfont} % <===
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%usepackage{booktabs}
%usepackage[flushleft]{threeparttable} % <---
usepackage{dcolumn}
newcolumntype{d}[1]{D{.}{.}{#1}}
begin{document}

begin{table}[ht] centering
begin{threeparttable}
renewcommandthetable{3}
caption{XXXXXXXXXXX XXXXXXX XXXXXXXXX XXXXXXXX XXXXXXXX}

begin{tabular}{ l r r r}
toprule
multicolumn{1}{c}{XXXXXXX XXXXX}
&multicolumn{1}{c}{XXXX XXXXXX}
&multicolumn{1}{c}{XX(^a)}
&multicolumn{1}{c}{XX(^{a+1})}
midrule
  
XXX & 8.2 & 1.2 & 1.2+1 
  
XXX & 305.2 & 1.1 & 1.1+1 

XXXXX & 189.3 & 0.6 & 0.6+1

XXXX & 62.3 & 0.1 &0.1+1
 
XXXX XXXX & 2.3 & 0.4 & 0.4+1

XXXXX XXXXX & 39.5 & 1.2 & 1.2+1
  
XXX  & 0.3 & 1.2 & 1.2+1

XXXXXX XXXXXXXX & 9.2 & 0.9 & 0.9+1

XXXXXXXX & 8.9 & 1.4 & 1.4+1
    midrule
multicolumn{1}{c}{XXXXX XXXX} 
cmidrule{1-1}

XXXXXXX & 9.2 & 0.5 & 0.5+1
XXXXXX XXXXXX XXXXXXXX 90 & 562.3 & 2 & 2+1
XXXX XXXXX XXXXXX 10 & 98.2 & 1.2 & 1.2+1
XX XXXXXXX XXXXXXX 30 & 1.9 & 0.1 & 0.1+1
XXXXXX XXXXX 10 & 90.3 & 1.5 & 1.5+1
XXXXX XXXXXXX 20 & 9.8 & 1.9 & 1.9+1
    bottomrule
end{tabular}

begin{tablenotes}[para]    % <---

(^a)XX = XXXXX XXXXXXXXX
end{tablenotes}
end{threeparttable}
end{table}
end{document} 

Note for the future: since nobody is here to steal what you accomplished, you should avoid writing Xs instead of the content that you really want to be displayed on your document.
Somebody in the future may need the same things that you asked and they could easily find it on the search bar :D
Have a great day!

Answered by LukeTheWolf on August 16, 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