I know this question has been answered many times but I can't get this to work. I'm a beginner, I started learning Latex last week.
I have two types of tables. I got them to be full width and horizontally centered, but I just can't get the vertical alignment to work.
What I want is:
- full page width
- equal column width
- horizontally centered
- vertically centered
- every other row colored
- rows slightly higher than default
Now how can I get my table cells vertically centered? Alternative solutions are welcome.
This is my code:
\documentclass[11pt,a4paper]{article}
\usepackage{graphicx}
\usepackage{tabularx}
\usepackage[table,xcdraw]{xcolor}
\usepackage[margin=2.5cm]{geometry}
%Tabelle breite gleich & zentriert
\newcolumntype{C}{>{\centering\arraybackslash}X}
\begin{document}
\begin{table}[h]
\rowcolors {2}{lightgray}{white}
\resizebox{\textwidth}{!}{%
\begin{tabularx}{1\textwidth}{l|C|C}
\rowcolor{white}
Aufgabe & Fall 1 & Fall 2 \\[1ex] \cline{1-3}
Anlage von $K_0$ & \multicolumn{2}{c}{5943,79} \\ [1ex]
Erwirtschafteter Ertrag & 5999,40 & 10.462,50 \\ [1ex]
Anlage von Erträgen & 7.288,48 & 12.710,56 \\ [1ex]
\end{tabularx}%
}
\end{table}
\begin{table}[h]
\rowcolors {2}{lightgray}{white}
\resizebox{\textwidth}{!}{%
\begin{tabularx}{1\textwidth}{C|C|C}
\rowcolor{white}
x / y & z / a & b / c \\[1ex] \cline{1-3}
100 & 200 & 300 \\ [1ex]
312 & 469 & 623 \\ [1ex]
432 & 862 & 527 \\ [1ex]
\end{tabularx}%
}
\end{table}
\end{document}
\documentclass{...}
andend{document}
, which demonstrate your problem. Your link can be dead after while and people here will not be able to know, what was your problem.