Tabelle mit multirow and multicolumn

Tabellen und Grafiken erstellen und anordnen


gill88
Forum-Anfänger
Forum-Anfänger
Beiträge: 22
Registriert: Fr 8. Feb 2013, 13:17

Tabelle mit multirow and multicolumn

Beitrag von gill88 »

Hey,

ich habe mal wieder ein Problem mit der Erstellung einer Tabelle. Vielleicht sieht jemand von euch ja den Fehler :)
Ich habe die Tabelle mit Hilfe von excel2latex ertstellt, und dabei hat sich ein Fehler eingeschlichen.
Hiermal der Code:
\documentclass[a4paper,12pt]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{mathptmx} 
\usepackage{bigstrut}
\usepackage{booktabs}
\usepackage{geometry}
\usepackage{arydshln}
\begin{table}[htbp]
  \centering
  \caption{Add caption}
    \begin{tabular}{rrrrr}
    \toprule
    Approach & Scenario & \multicolumn{1}{c}{Price change at 75th percentile} & \multicolumn{1}{c}{Price change at 90th percentile} & \multicolumn{1}{c}{Price change at 95th percentile} \\
    \midrule
    \multicolumn{1}{l}{\multirow{2}[1]{*}{Drawing of different years}} & Simulated price change & 0.3   & 8.7   & 14.29 \\
    \multicolumn{1}{l}{} & Variabilty increased by 25\% & 3.28  & 15.49 & 23.37 \\
          & Variabilty increased by 50\% & 6.5   & 22.81 & 35.07 \\
          & Variabilty increased by 100\% & 11.47 & 33.61 & 52.25 \\
          & Random variability & 5.18  & 19.28 & 29.72 \\
          & Consecutive dry days & 13.77 & 36.08 & 55.04 \\
          & Soil moisture anomaly & 12.43 & 33.93 & 49.63 \\
          & Heat waves & 10.11 & 31.39 & 47.78 \\
    \multicolumn{1}{l}{\multirow{2}[0]{*}{Drawing of same years}} & Simulated price change  & 1.74  & 7.6   & 11.15 \\
    \multicolumn{1}{l}{} & Variability increased by 25\% & 4.22  & 12.29 & 17.42 \\
          & Variability increased by 50\% & 9.22  & 17.6  & 22.66 \\
          & Consecutive dry days & 11.53 & 26.54 & 35.47 \\
    \bottomrule
    \end{tabular}%
  \label{tab:addlabel}%
\end{table}%

Ich denke mal, es liegt irgendwie an dem Befehl multirow, kann aber nicht genau sagen woran.
Wäre toll, wenn jemand hier Bescheid weiß!

Vielen Dank!

Epllus
Forum-Guru
Forum-Guru
Beiträge: 470
Registriert: So 23. Sep 2012, 17:31

Beitrag von Epllus »

Vielleicht, das im Dokument weder "multirow" geladen wird, noch "\begin{document}" und "\end{document}" steht?
\documentclass[a4paper,12pt]{scrartcl} 
\usepackage[applemac]{inputenc} 
\usepackage{amsmath} 
\usepackage{amsfonts} 
\usepackage{amssymb} 
\usepackage{mathptmx} 
\usepackage{bigstrut,multirow} 
\usepackage{booktabs} 
\usepackage{geometry} 
\usepackage{arydshln} 
\begin{document}
\begin{table}[htbp] 
  \centering 
  \caption{Add caption} 
    \begin{tabular}{rrrrr} 
    \toprule 
    Approach & Scenario & \multicolumn{1}{c}{Price change at 75th percentile} & \multicolumn{1}{c}{Price change at 90th percentile} & \multicolumn{1}{c}{Price change at 95th percentile} \\ 
    \midrule 
    \multicolumn{1}{l}{\multirow{2}[1]{*}{Drawing of different years}} & Simulated price change & 0.3   & 8.7   & 14.29 \\ 
    \multicolumn{1}{l}{} & Variabilty increased by 25\% & 3.28  & 15.49 & 23.37 \\ 
          & Variabilty increased by 50\% & 6.5   & 22.81 & 35.07 \\ 
          & Variabilty increased by 100\% & 11.47 & 33.61 & 52.25 \\ 
          & Random variability & 5.18  & 19.28 & 29.72 \\ 
          & Consecutive dry days & 13.77 & 36.08 & 55.04 \\ 
          & Soil moisture anomaly & 12.43 & 33.93 & 49.63 \\ 
          & Heat waves & 10.11 & 31.39 & 47.78 \\ 
    \multicolumn{1}{l}{\multirow{2}[0]{*}{Drawing of same years}} & Simulated price change  & 1.74  & 7.6   & 11.15 \\ 
    \multicolumn{1}{l}{} & Variability increased by 25\% & 4.22  & 12.29 & 17.42 \\ 
          & Variability increased by 50\% & 9.22  & 17.6  & 22.66 \\ 
          & Consecutive dry days & 11.53 & 26.54 & 35.47 \\ 
    \bottomrule 
    \end{tabular}% 
  \label{tab:addlabel}% 
\end{table}% 

Ich denke mal, es liegt irgendwie an dem Befehl multirow, kann aber nicht genau sagen woran. 
Wäre toll, wenn jemand hier Bescheid weiß! 

Vielen Dank!
\end{document}
Grüße
Epllus

Antworten