1

I have a Page a Chapter and some Text. Then I add a table after my text.

\begin{table}[]
\centering
\caption{Entwicklungsmöglichkeiten}
\label{Entwicklungsmöglichkeiten}
\begin{tabular}{@{}llll@{}}
\toprule
 Text& Text& Text& Text\\ \midrule
 \textbf{Text}& - & ++ & ++ \\
 \textbf{Text}& + & - & ++ \\
 \textbf{Text}& -- & - &  ++ \\
 \textbf{Text}& ++ & - & ++ \\
 \textbf{Text}& + & - & ++ \\
 \textbf{Text}& -- & - & ++ \\ \midrule
\end{tabular}
\end{table}

The table jumps above my text chapter!

Questions:

  • How can I avoid that?
  • How can I make the table as wide as the page?
  • How can I put the Caption of the table to the bottom of it?
  • 1
    Use a specifier in the third bracket after \begin{table}. Replace \begin{table}[] with \begin{table}[h]. – ddas Oct 06 '16 at 11:10
  • super, that worked - the table is now on its place. The other two questions? :) Caption on bottom - like on figures(images) and the width of the table? thank you very much – PomeGranate Oct 06 '16 at 11:13
  • 1
    move the caption entry after \end{tabular} – ddas Oct 06 '16 at 11:20
  • ok worked too! thx – PomeGranate Oct 06 '16 at 11:26
  • 1
    You asked, "How can I make the table as [wide] as the page?" I assume that you wish to make the table as wide as the text block, rather than as wide as the page itself. Is this correct? – Mico Oct 06 '16 at 11:29
  • Note that table captions are typically placed above the table, as you had it, see http://tex.stackexchange.com/q/3243/586 (If you were aware of this, sorry for the noise.) – Torbjørn T. Oct 06 '16 at 11:30
  • Concerning the table position, there is a lot more info on the topic in the three highest questions tagged with [tag:floats] and [tag:positioning]: http://tex.stackexchange.com/questions/tagged/floats+positioning – Torbjørn T. Oct 06 '16 at 11:35
  • @TorbjørnT. wow no I didn't know that. interesting. – PomeGranate Oct 06 '16 at 11:35
  • 2
    as clearly seen in the images in mico's answer, making the table full width makes it much harder to read, it just introduces unwanted white space making it much harder for the eye to locate the column/row associations, just centering the natural width table would be much easier to read. – David Carlisle Oct 06 '16 at 11:52

1 Answers1

5

You have two main options for setting the width of the tabular material to \textwidth:

  • Use a tabular* environment.

  • Use a tabularx environment.

tabular*, when used in conjunction with @{\extracolsep{\fill}}, works by modifying the amount of intercolumn whitespace. tabularx works by changing the widths of columns of type X. Both options are illustrated in the following screenshot and option.

enter image description here

\documentclass{article}
\usepackage{tabularx,booktabs}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\begin{document}
\begin{table}[h]
\begin{tabular*}{\textwidth}{@{}l@{\extracolsep{\fill}}lll@{}}
\toprule
 Text& Text& Text& Text\\ \midrule
 \textbf{Text}& - & ++ & ++ \\
 \textbf{Text}& + & - & ++ \\
 \textbf{Text}& -- & - &  ++ \\
 \textbf{Text}& ++ & - & ++ \\
 \textbf{Text}& + & - & ++ \\
 \textbf{Text}& -- & - & ++ \\ \midrule
\end{tabular*}
\caption{Entwicklungsmöglichkeiten}
\label{Entwicklungsmöglichkeiten}

\bigskip

\begin{tabularx}{\textwidth}{@{}XXXX@{}}
\toprule
 Text& Text& Text& Text\\ \midrule
 \textbf{Text}& - & ++ & ++ \\
 \textbf{Text}& + & - & ++ \\
 \textbf{Text}& -- & - &  ++ \\
 \textbf{Text}& ++ & - & ++ \\
 \textbf{Text}& + & - & ++ \\
 \textbf{Text}& -- & - & ++ \\ \midrule
\end{tabularx}
\caption{Weitere Entwicklungsmöglichkeiten}
\label{WeitereEntwicklungsmöglichkeiten}
\end{table}

\end{document}
Mico
  • 506,678
  • Couldn't use it :/ ! LaTeX Error: Can be used only in preamble.See the LaTeX manual or LaTeX Companion for explanation.Type H for immediate help.... \documentclass – PomeGranate Oct 06 '16 at 11:34
  • @PomeGranate - Did you place one or more \usepackage statements after \begin{document}? Please advise. – Mico Oct 06 '16 at 11:36
  • thx for the hint. Its my first latex document. Worked! THX! – PomeGranate Oct 06 '16 at 11:44
  • last Q: Is it possible to make the first column a bit wider? or as wide as its content is? -really last question! :D – PomeGranate Oct 06 '16 at 11:48
  • @PomeGranate - How much wider do you want the first column to be? – Mico Oct 06 '16 at 13:08
  • As wide as its content, so that there is no linebreak in the cell? otherwise lets say a number: 4cm? – PomeGranate Oct 06 '16 at 13:33
  • @PomeGranate - "As wide as its content, so that there is no linebreak in the cell": that's as wide as it is with the tabular* approach. It's actually less wide than the present tabularx approach (because the first column only contains \textbf{Text} for now). If you don't want to allow linebreaks, stick with the tabular* approach. – Mico Oct 06 '16 at 13:36