Wie erstelle ich Vergleichstabellen in LaTeX?

Wie erstelle ich Vergleichstabellen in LaTeX?

Ich bin ein neuer Benutzer (sowohl von LaTeX als auch von diesem Forum).

Ich möchte eine Vergleichstabelle für einen Artikel erstellen (wie die hier gezeigte):

Bildbeschreibung hier eingeben

Kann mir bitte jemand dabei helfen.

Antwort1

Ich schwöre, jemand hat TikZ gesagt!

\documentclass{standalone}
\usepackage{tikz}
\usepackage{PTSansNarrow}
\usepackage[T1]{fontenc}

\usetikzlibrary{matrix}

\begin{document}
\begin{tikzpicture}
\clip node (m) [matrix,matrix of nodes,
fill=black!20,inner sep=0pt,
nodes in empty cells,
nodes={minimum height=1cm,minimum width=2.6cm,anchor=center,outer sep=0,font=\sffamily},
row 1/.style={nodes={fill=black,text=white}},
column 1/.style={nodes={fill=gray,text=white,align=right,text width=2.5cm,text depth=0.5ex}},
column 2/.style={text width=4cm,align=center,every even row/.style={nodes={fill=white}}},
column 3/.style={text width=3cm,align=center,every even row/.style={nodes={fill=white}},},
row 1 column 1/.style={nodes={fill=gray}},
prefix after command={[rounded corners=4mm] (m.north east) rectangle (m.south west)}
] {
                & Enterprise SAN                     & ioDrive \\
Form Factor     & Rack Applicance (40U $\times$ 20") & Low Profile PCIe \\
Interface       & FC-4                               & PCIe x4 \\
Drive Units     & 150$\times$15 RPM disks            & 2$\times$80gig\\
Data Protection & Mirroring                          & Mirroring\\
Power           & 33.372 kWh/yr                      & 114 kWh/yr\\
SPC-1 I0PS      & 24.998                             & 86.127\\
};
\end{tikzpicture}
\end{document}

Bildbeschreibung hier eingeben

Antwort2

tcolorboxEnthält eine tabularxOption, mit der Tabellen mit Rahmen und abgerundeten Ecken erstellt werden können.

\documentclass[tikz,table,border=2mm]{standalone}
\usepackage{PTSansNarrow}
\usepackage[T1]{fontenc}
\usepackage{array,tabularx}
\usepackage[most]{tcolorbox}

\begin{document}

\rowcolors{1}{black!30}{white}
\begin{tcolorbox}[enhanced, notitle, clip upper, fontupper=\sffamily,%
    tabularx={>{\cellcolor[gray]{.5}\color{white}}r%
              >{\centering\arraybackslash}X%
              >{\centering\arraybackslash}X}]
  &\cellcolor{black!80}\color{white}Enterprise SAN &\cellcolor{black!80}\color{white}ioDrive \\
Form Factor     & Rack Applicance (40U $\times$ 20") & Low Profile PCIe \\
Interface       & FC-4                               & PCIe x4 \\
Drive Units     & 150$\times$15 RPM disks            & 2$\times$80gig\\
Data Protection & Mirroring                          & Mirroring\\
Power           & 33.372 kWh/yr                      & 114 kWh/yr\\
SPC-1 I0PS      & 24.998                             & 86.127
\end{tcolorbox}
\end{document}

Bildbeschreibung hier eingeben

Antwort3

Wer auf die abgerundeten Ecken verzichten kann, kann so etwas machen.

\documentclass{article}
\usepackage{xcolor}
\usepackage{tabu}
\usepackage{colortbl}

\begin{document}

\taburowcolors[2]{white .. black!20}

\sffamily\footnotesize
\tabulinesep=6pt
\begin{tabu}{|>{\cellcolor{black!60}\color{white}}r|X[cm]|X[cm]|}
\hline
\rowcolor{black!80}\strut  & \color{white}Enterprise SAN & \color{white}ioDrive \\
Form Factor & Rack Applicance (40U $\times$ 20") & Low Profile PCIe \\
Interface & FC-4 & PCIe x4 \\
Drive Units & 150$\times$15 RPM disks & 2$\times$80gig\\
\hline
\end{tabu}

\end{document}

Bildbeschreibung hier eingeben

Für abgerundete Ecken ist wahrscheinlich etwas TikZ-Magie erforderlich. Ich werde sehen, ob mir etwas einfällt.

Antwort4

Mit {NiceTabular}von nicematrix(Sie benötigen mehrere Zusammenstellungen).

\documentclass{article}
\usepackage{geometry}
\usepackage[T1]{fontenc}
\usepackage{nicematrix,tikz}

\begin{document}

\sffamily

\begin{center}
\renewcommand{\arraystretch}{1.4}
\begin{NiceTabular}[rounded-corners]{>{\color{white}\bfseries}rcc}
\CodeBefore
  \cellcolor{black!80}{1-2,1-3}
  \columncolor[gray]{0.5}{1}
  \rowcolors{2}{black!30}{}[cols={2,3}]
\Body
    \RowStyle{\color{white}\bfseries}
                    & Enterprise SAN                     & ioDrive \\
    Form Factor     & Rack Applicance (40U $\times$ 20") & Low Profile PCIe \\
    Interface       & FC-4                               & PCIe x4 \\
    Drive Units     & 150$\times$15 RPM disks            & 2$\times$80gig\\
    Data Protection & Mirroring                          & Mirroring\\
    Power           & 33.372 kWh/yr                      & 114 kWh/yr\\
    SPC-1 I0PS      & 24.998                             & 86.127
\CodeAfter
  \tikz \draw [rounded corners,thick] (1-|1) rectangle (last-|last) ; 
\end{NiceTabular}
\end{center}

\end{document}

Ausgabe des obigen Codes

verwandte Informationen