TeX - LaTeX Asked by user193482 on June 13, 2021
I tried to make a table with alternating red and blue lines, which I succeeded in doing. But I try in vain to write a flowing text on the right side with multirow. But I want it to be completely white and on the same lines as the left text.
The code:
begin{document}
definecolor{NbaBlue}{RGB}{181, 191, 245}
definecolor{NbaRed}{RGB}{245, 187, 181}
newcolumntype{w}{>{columncolor{white}}l}
begin{table}[h]
centering
begin{tabular}{c !{color{white}vrule}!{color{white}vrule} l !{color{white}vrule} w}
rowcolor{NbaRed}
1. & Philadelphia 76ers & multirow{8}{6cm}{Die NBA ist in zwei Konferenzen (engl. Conferences) eingeteilt. Die Eastern und die Western Conference. Beide bestehen aus 15 verschiedenen Teams. Diese Tabelle zeigt die momentan 8 besten Teams der Eastern Conference.}
hline
rowcolor{NbaBlue}
2. & Brooklyn Nets
hline
rowcolor{NbaRed}
3. & Milwaukee Bucks
hline
rowcolor{NbaBlue}
4. & Atlanta Hawks
hline
rowcolor{NbaRed}
5. & Miami Heat
hline
rowcolor{NbaBlue}
6. & New York Knicks
hline
rowcolor{NbaRed}
7. & Boston Celtics
hline
rowcolor{NbaBlue}
8. & Charlotte Hornets
hline
end{tabular}
caption{Eastern Conference}
label{}
end{table}
end{document}
Here is a way, with cline
s and cellcolor
. Note it is not a good idea to denote a new column type as w
; this specifier is defined in recent versions of the array
package.
documentclass{article}
usepackage{array}
usepackage{multirow}
usepackage[table]{xcolor}
definecolor{NbaBlue}{RGB}{181, 191, 245}
definecolor{NbaRed}{RGB}{245, 187, 181}
begin{document}
begin{table}[!h]
begin{tabular}{c !{{color{white}vrule}}!{color{white}vrule} l !{color{white}vrule} l}
rowcolor{NbaRed} 1. & Philadelphia 76ers & cellcolor{white}
cline{1-2}
rowcolor{NbaBlue} 2. & Brooklyn Nets
cline{1-2}
rowcolor{NbaRed} 3. & Milwaukee Bucks
cline{1-2}
rowcolor{NbaBlue} 4. & Atlanta Hawks
cline{1-2}
rowcolor{NbaRed} 5. & Miami Heat
cline{1-2}
rowcolor{NbaBlue} 6. & New York Knicks
cline{1-2}
rowcolor{NbaRed} 7. & Boston Celtics
cline{1-2}
rowcolor{NbaBlue}8. & Charlotte Hornets & multirow{-8}{6cm}{cellcolor{white}Die NBA ist in zwei Konferenzen (engl. Conferences) eingeteilt. Die Eastern und die Western Conference. Beide bestehen aus 15 verschiedenen Teams. Diese Tabelle zeigt die momentan 8 besten Teams der Eastern Conference.}
%hline
end{tabular}
caption{Eastern Conference}
label{}
end{table}
end{document}
Answered by Bernard on June 13, 2021
What about something like the following?
documentclass{article}
usepackage{array}
usepackage{multirow}
usepackage[table]{xcolor}
definecolor{NbaBlue}{RGB}{181, 191, 245}
definecolor{NbaRed}{RGB}{245, 187, 181}
begin{document}
begin{table}[!h]
centering
rowcolors{1}{NbaRed}{NbaBlue}
begin{tabular}{c !{{color{white}vrule}}!{color{white}vrule} l !{color{white}vrule}}
1. & Philadelphia 76ers hline
2. & Brooklyn Nets hline
3. & Milwaukee Bucks hline
4. & Atlanta Hawks hline
5. & Miami Heat hline
6. & New York Knicks hline
7. & Boston Celtics hline
8. & Charlotte Hornets hline
end{tabular}
quad
begin{minipage}{0.5textwidth}
raggedright
Die NBA ist in zwei Konferenzen (engl. Conferences) eingeteilt. Die Eastern und die Western Conference. Beide bestehen aus 15 verschiedenen Teams. Diese Tabelle zeigt die momentan 8 besten Teams der Eastern Conference.
end{minipage}
caption{Eastern Conference}
label{}
end{table}
end{document}
Answered by leandriis on June 13, 2021
With {NiceTabular}
of nicematrix
.
documentclass{article}
usepackage{xcolor}
usepackage{caption}
usepackage{nicematrix,tikz}
begin{document}
begin{table}[h]
centering
begin{NiceTabular}{>{arabic{iRow}.}clp{6cm}}
CodeBefore
rowcolors[RGB]{1}{245, 187, 181}{181, 191, 245}[cols={1,2}]
tikz draw [white,very thick] (1-|2) -- (last-|2) ;
Body
cline{1-2}
& Philadelphia 76ers & Block{*-1}{parbox{6cm}{Die NBA ist in zwei Konferenzen (engl. Conferences)
eingeteilt. Die Eastern und die Western Conference. Beide bestehen aus 15 verschiedenen Teams. Diese
Tabelle zeigt die momentan 8 besten Teams der Eastern Conference.}} cline{1-2}
& Brooklyn Nets cline{1-2}
& Milwaukee Bucks cline{1-2}
& Atlanta Hawks cline{1-2}
& Miami Heat cline{1-2}
& New York Knicks cline{1-2}
& Boston Celtics cline{1-2}
& Charlotte Hornets cline{1-2}
end{NiceTabular}
caption{Eastern Conference}
label{}
end{table}
end{document}
You need several compilations (because nicematrix
uses PGF/Tikz nodes under the hood).
Answered by F. Pantigny on June 13, 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