2

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}

enter image description here

3 Answers 3

2

Here is a way, with \clines 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} 

enter image description here

2
  • Thank you for your anwser!! But I need to have the whole right side to be white
    – user193482
    Commented May 13, 2021 at 20:37
  • I had misunderstood your requirement. I've updated my answer. Roughly, I added \cellcolor{white} in the last (empty) cell of the first row and used \multirow{-8}` in the place of –7. Please see if it's what you want.
    – Bernard
    Commented May 13, 2021 at 20:55
2

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).

Output of the above code

0

What about something like the following?

enter image description here

\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.5\textwidth}
  \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} 

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .