TeX - LaTeX Asked by BuddhiLW on May 11, 2021
I have a pretty formatted table with tcolorbox, which uses tabularx under the hood. But, I don’t know how I would configure it, as is possible with tabularx, to make the table fit the linewidth – without leaving a blankspace inside the table.
One solution I would be looking forward to have would, for an example, stretch automatically one of the cells to make it occupy the total space (like what my goal-table does with the "Esteira Transportadora" cell).
MWE
documentclass[12pt,a4paper, article]{abntex2}
%%%%%%%%%%%% ----------- PACOTES/PACKAGES ----------- %%%%%%%%%%%%%%
%%% Special Tables // Tabelas especiais
usepackage[table, dvipsnames, svgnames]{xcolor} %% Definição de cores
usepackage[most]{tcolorbox} %%Mudar ambientes de blocos
%multi-row
begin{document}
newcolumntype{Y}{>arraybackslashmultirow{2}{*}{X}}% see tabularx
tcbset{enhanced,fonttitle=bfserieslarge,fontupper=normalsizesffamily,
colback=yellow!10!white, colframe=red!50!black,colbacktitle=Salmon!30!white,
coltitle=black,center title,sharp corners, drop fuzzy shadow=black!30!white}
begin{tcolorbox}[tabularx={l|c|c|c|c|c|c|}]
%%%%%%%%%%%%%% Primeira coluna
hline
cellcolor{orange!30} &
cellcolor{Lavender!70} &
cellcolor{white} &
cellcolor{Lavender!70} &
Setor & Planta & Patrimônio
%%%%%%%%%%%%% Primeira coluna
cline{5-7}
%%%%%%%%%%%%%%%% Segunda coluna
multirow{-2}{*}{cellcolor{orange!30}42.} &
multirow{-2}{*}{cellcolor{Lavender!70} textbf{Máquina}}&
multirow{-2}{*}{cellcolor{white} textbf{Esteira Transportadora}}&
multirow{-2}{*}{cellcolor{Lavender!70} textbf{Localização}}&
53,8% &
&
Não identificado
%%%%%%%%%%%%%%%% Segunda coluna
end{tcolorbox}
end{document}
I poked around with the configurations on tcolorbox and did this:
newcolumntype{Y}{>{raggedleft}X}% see tabularx
tcbset{enhanced,fonttitle=bfserieslarge,fontupper=normalsizesffamily,
colback=yellow!10!white, colframe=red!50!black,colbacktitle=Salmon!30!white,
coltitle=black,center title,sharp corners, drop fuzzy shadow=black!30!white}
begin{tcolorbox}[tabularx={l|c|X|c|c|c|c|}]
%%%%%%%%%%%%%% Primeira coluna
hline
cellcolor{orange!30} &
cellcolor{Lavender!70} &
cellcolor{white} &
cellcolor{Lavender!70} &
Setor & Planta & Patrimônio
%%%%%%%%%%%%% Primeira coluna
cline{5-7}
%%%%%%%%%%%%%%%% Segunda coluna
multirow{-2}{*}{cellcolor{orange!30}42.} &
multirow{-2}{*}{cellcolor{Lavender!70} textbf{Máquina}}&
multirow{-2}{*}{cellcolor{white} textbf{Esteira Transportadora}}&
multirow{-2}{*}{cellcolor{Lavender!70} textbf{Localização}}&
53,8% &
&
Não identificado
%%%%%%%%%%%%%%%% Segunda coluna
end{tcolorbox}
It worked like this, although I don't understand why it wasn't working then. Or why is it working now. But, I accept it.
Answered by BuddhiLW on May 11, 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