3

I really like to center the content of the cells vertically, but I do not know how to do it. Is there maybe someone who can help me? Thank you!

enter image description here

\documentclass[a4paper, fontsize=11pt]{scrartcl}

\usepackage[ngerman]{babel} 
\usepackage[T1]{fontenc}         
\usepackage[latin1]{inputenc}   

\usepackage[onehalfspacing]{setspace}

\usepackage{amsmath}
\usepackage{amssymb} 

\usepackage{multirow,array} 
\usepackage{arydshln}

\begin{document}\begin{table}
\setlength{\extrarowheight}{10pt}
\begin{tabular}{*{5}{c|}}
\multicolumn{2}{c}{} & \multicolumn{3}{c}{Spieler $2$} \\ \cline{3-5}
\multicolumn{1}{c}{} &  & $s_{21}$  & $s_{22}$ & $s_{23}$ \\ \cline{2-5}
\multirow{2}*{Spieler $1$} 
& $s_{11}$ & $(\tfrac{1}{4},\tfrac{1}{2})$ & $(x,y)$ & $(x,y)$ \\ \cline{2-5}
& $s_{12}$ & $(x,y)$ & $(x,y)$ & $(x,y)$ \\ \cline{2-5}
\end{tabular}
\end{table}
\end{document}
1

I'm not sure if this is what you looking for:

enter image description here

The obtain above picture of table is obtained by your code, where I erase \setlength{\extrarowheight}{10pt} (whic add only space above cells content) and add \renewcommand\arraystretch{1.5}. So, the complete code (with some changes in setting of math expressions), is:

\documentclass[a4paper, fontsize=11pt]{scrartcl}
    \usepackage[ngerman]{babel}
    \usepackage[T1]{fontenc}
    \usepackage[latin1]{inputenc}

    \usepackage[onehalfspacing]{setspace}

    \usepackage{amsmath,amssymb}

    \usepackage{multirow,array}
    \usepackage{arydshln}

\begin{document}
    \begin{table}
    \renewcommand\arraystretch{1.5}
\begin{tabular}{*{5}{>{$}c<{$}|}}
\multicolumn{2}{c}{} & \multicolumn{3}{c}{Spieler 2} \\ \cline{3-5}
\multicolumn{1}{c}{} &  & s_{21}  & s_{22} & s_{23} \\ \cline{2-5}
\multirow{2}*{Spieler 1}
& s_{11} & \left(\frac{1}{4},\frac{1}{2}\right) & (x,y) & (x,y) \\ \cline{2-5}
& s_{12} & (x,y) & (x,y) & (x,y) \\ \cline{2-5}
\end{tabular}

    \end{table}
\end{document}    
  • That is exactly what I was looking for. Thank you really much for your help!! : D – hpz1719 Feb 8 '16 at 18:42
  • Can you express your thankfulness with up vote my answer and even accept it :-) – Zarko Feb 8 '16 at 19:06
2

May I suggest to use a version like this:

\documentclass[a4paper, fontsize=11pt]{scrartcl}

\usepackage[ngerman]{babel} 
\usepackage[T1]{fontenc}         
\usepackage[latin1]{inputenc}   

\usepackage[onehalfspacing]{setspace}

\usepackage{amsmath,array,booktabs}

\begin{document}
\begin{table}
  \begin{tabular}{*{4}{c}}
    \toprule
    Spieler $1$ & \multicolumn{3}{c}{Spieler $2$}\\\cmidrule(l){2-4}
                & $s_{21}$  & $s_{22}$ & $s_{23}$ \\\cmidrule(r){1-1}
                \cmidrule(lr){2-2}\cmidrule(lr){3-3}\cmidrule(l){4-4}
    $s_{11}$ & $(\tfrac{1}{4},\tfrac{1}{2})$ & $(x,y)$ & $(x,y)$ \\ 
    $s_{12}$ & $(x,y)$ & $(x,y)$ & $(x,y)$ \\
    \bottomrule
  \end{tabular}
\end{table}
\end{document}

enter image description here

  • Thank you for your help and your version! It looks way better than my version : ). Anyway I will have to do it like my version. I am so sorry. I hope you are not angry. I will try once again to center the things^^ – hpz1719 Feb 7 '16 at 16:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.