TeX - LaTeX Asked on October 1, 2021
I want to increase the width of left column of table in the same design.
MWE
documentclass[xcolor=dvipsnames]{beamer}
usepackage[utf8]{inputenc}
usepackage[T1]{fontenc}
renewcommand{rmdefault}{ptm}
usefonttheme{structurebold}
definecolor{myblue}{RGB}{0,82,155}
mode<presentation> {
usetheme{CambridgeUS}
usecolortheme[named=myblue]{structure}
setbeamertemplate{navigation symbols}{} % To remove the navigation symbols from the bottom of all slides uncomment this line
}
setbeamerfont{table}{size=footnotesize}
usepackage{graphicx} % Allows including images
usepackage{booktabs} % Allows the use of toprule, midrule and bottomrule in tables
usepackage{tcolorbox}
usepackage{tabularx}
usepackage{array}
usepackage{colortbl}
tcbuselibrary{skins}
newcolumntype{Y}{>{raggedrightarraybackslash}X}
tcbset{tab1/.style={fonttitle=bfseriessmall,fontupper=footnotesizermfamily,
colback=green!10!white,colframe=red!75!black,colbacktitle=green!40!white,
coltitle=black,center title,freelance,frame code={
foreach n in {north east,north west,south east,south west}
{path [fill=green!75!black] (interior.n) circle (2mm); };},}}
tcbset{tab2/.style={enhanced,fonttitle=bfseries,fontupper=footnotesizermfamily,
colback=green!10!white,colframe=red!50!black,colbacktitle=Salmon!40!white,
coltitle=black,center title}}
begin{document}
begin{frame}
begin{tcolorbox}[tab1,tabularx={X||Y||Y}]
textbf{ Description} & {1st Revised} & 2nd Revision hlinehline
textbf{Construction Cost} & 598.762 & 620.991 hline
{ 10% External Development Charges} & 54.449 & 56.398hline
textbf{Sub Total} & 653.211& 677.388 hlinehline
Price variation of allotted works & {} & 6.502hline
Price variation of allotted works G-1 &{} & 0.946hline
External Electric connection payable to WAPDA & 5.000 & 5.000hline
Add for Sui Gas connection charges & 3.000 & 3.000hline
2% Consultancy fee for resident supervision&13.064&13.548hline
1% for Tree Planation & 6.532 & 6.774hline
5% PST& {-}&8.654hlinehline
Grand Total &671.346 &721.813hlinehline
end{tcolorbox}
end{frame}
end{document}
Just change the first column width which you assigned at begin{tcolorbox}[tab1,tabularx={l||Y||Y}]
from X
to l
like that
begin{tcolorbox}[tab1,tabularx={l||Y||Y}]
You get the output like this
Keeping the three columns at X
and Y
widths will ensure that the three columns widths are equal, which you don't want. Assigning l
for the first column width will let have its normal content width without breaking its cells lines, and then only equate widths of the 2nd and 3rd columns.
Answered by hesham on October 1, 2021
Maybe you'll like it:
documentclass[xcolor={dvipsnames, table}]{beamer}
usepackage[T1]{fontenc}
renewcommand{rmdefault}{ptm}
usefonttheme{structurebold}
definecolor{myblue}{RGB}{0,82,155}
mode<presentation> {
usetheme{CambridgeUS}
usecolortheme[named=myblue]{structure}
setbeamertemplate{navigation symbols}{} % To remove the navigation symbols from the bottom of all slides uncomment this line
}
setbeamerfont{table}{size=footnotesize}
usepackage{siunitx}
usepackage{booktabs,tabularx} % Allows the use of toprule, midrule and bottomrule in tables
usepackage{xparse}
NewExpandableDocumentCommandmcx{O{X}m}
% O: optional, if it is not given, than is used default in {...}
% m: mandatory
{multicolumn{1}{>{centeringarraybackslashbfseries}#1}{#2}}
usepackage{tcolorbox}
tcbuselibrary{skins}
tcbset{tab1/.style={fonttitle=bfseriessmall,fontupper=footnotesizermfamily,
colback=green!10!white,colframe=red!75!black,colbacktitle=green!40!white,
coltitle=black,center title,freelance,frame code={
foreach n in {north east,north west,south east,south west}
{path [fill=green!75!black] (interior.n) circle (2mm); };},}}
tcbset{tab2/.style={enhanced,fonttitle=bfseries,fontupper=footnotesizermfamily,
colback=green!10!white,colframe=red!50!black,colbacktitle=Salmon!40!white,
coltitle=black,center title}}
begin{document}
begin{frame}[fragile]
sisetup{group-four-digits}
begin{tcolorbox}[tab1,tabularx={l || S[table-format=6.0]|| S[table-format=6.3] }]
textbf{Description} & mcx[X||]{1st Revised} & mcx{2nd Revision}
hlinehline
textbf{Construction Cost}
& 598 762 & 620 991
hline
SI{10}{%} External Development Charges
& 54 449 & 56 398
hline
textbf{Sub Total} & 653 211 & 677 388
hlinehline
Price variation of allotted works
& {--} & 6 502
hline
Price variation of allotted works G-1
& {--} & 0.946
hline
External Electric connection payable to WAPDA
& 5 000 & 5 000
hline
Add for Sui Gas connection charges
& 3 000 & 3 000
hline
SI{2}{%} Consultancy fee for resident supervision
& 13 064 & 13 548
hline
SI{1}{%} for Tree Planation
& 6 532 & 6 774
hline
SI{5}{%} PST & {--} & 8 654
hlinehline
textbf{Grand Total} & 671 346 & 721 813
hlinehline
end{tcolorbox}
end{frame}
end{document}
Answered by Zarko on October 1, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP