1

I have the following document with a table. There are two things that are not like I want them to be. First I want the text in the fourth column to be in central position (like in the first three columns). I have to use a p-Line for this column because I want to break the line.

Moreover in the third and fourth row and fourth column there is a fairly big gap between the word "unterbrechbar" and "und". How can I avoid such a gap?

 \listfiles
\documentclass[oneside,12pt]{scrartcl}
\usepackage[ngerman]{babel}
%\usepackage{amsmath}
\usepackage[fixamsmath,disallowspaces]{mathtools}
\begin{document}
\begin{tabular}{|c|c|c|p{4cm}|}
\hline
  & Szenario 1.1 & Szenario 1.2 & Szenario 1.3\\
\hline
 Waschmaschine & einmalig startbar & einmalig startbar & einmalig startbar und lastflexibel  \\
\hline 
 Trockner & einmalig startbar & unterbrechbar & unterbrechbar und lastflexibel \\
\hline 
 Geschirrspülmaschine & einmalig startbar & unterbrechbar & unterbrechbar und lastflexibel\\
\hline
\end{tabular}

\end{document}
1

Load array package and use

>{\centering\arraybackslash}p{4cm}

Code:

 \listfiles
\documentclass[oneside,12pt]{scrartcl}
\usepackage[ngerman]{babel}
%\usepackage{amsmath}
\usepackage[fixamsmath,disallowspaces]{mathtools}
\usepackage{array}
\begin{document}
\begin{tabular}{|c|c|c|>{\centering\arraybackslash}p{4cm}|}
\hline
  & Szenario 1.1 & Szenario 1.2 & Szenario 1.3\\
\hline
 Waschmaschine & einmalig startbar & einmalig startbar & einmalig startbar und lastflexibel  \\
\hline
 Trockner & einmalig startbar & unterbrechbar & unterbrechbar und lastflexibel \\
\hline
 Geschirrspülmaschine & einmalig startbar & unterbrechbar & unterbrechbar und lastflexibel\\
\hline
\end{tabular}

\end{document}

enter image description here

To align them vertically at the center use m column type:

>{\centering\arraybackslash}m{4cm}

as in

\begin{tabular}{|c|c|c|>{\centering\arraybackslash}m{4cm}|}

enter image description here

  • Thanks for you help. Now the entries are horizontally cetral but not vertically. Is there a way to make the entries vertically central (For example the entries for "einmalig startbar" should be in the middle of the cell instead of being at the upper rim) – user88009 Sep 18 '15 at 15:51
  • @Felix See the edit. – user11232 Sep 18 '15 at 16:25
0

For vertical centering instead p{<width>} use m{<width<}:

\documentclass[oneside,12pt]{scrartcl}
    %\usepackage[ngerman]{babel}
    \usepackage{amsmath}
    \usepackage{array}
\renewcommand{\arraystretch}{1.1}

    \begin{document}
\begin{tabular}{|c|c|c|>{\centering\arraybackslash}m{4cm}|}
\hline
  & Szenario 1.1 & Szenario 1.2 & Szenario 1.3\\
\hline
 Waschmaschine & einmalig startbar & einmalig startbar & einmalig startbar und lastflexibel  \\
\hline
 Trockner & einmalig startbar & unterbrechbar & unterbrechbar und lastflexibel \\
\hline
 Geschirrspülmaschine & einmalig startbar & unterbrechbar & unterbrechbar und lastflexibel\\
\hline
\end{tabular}
    \end{document}

With this you obtain table with following look-up:

enter image description here

Is this what you looking for?

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.