1

Sorry for my incorrect English.

This question is probably already asked by someone, but I found nothing related, so

Here is my code:

\documentclass[paper = landscape, pagesize, twocolumn, table, ngerman]{scrartcl}%table: for color tables
\usepackage[margin = 5mm, bottom = 25mm]{geometry}
\usepackage{babel, xcolor, float}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenx}

\rowcolors{2}{black!10}{black!30}%alternating row colors in tables

\begin{document}
  \section{Punktetabelle}
    \begin{table}[H]
      \caption{Punktetabelle}
      \begin{tabular*}{\linewidth}{cr}\rowcolor{black!50}%makes the first line darker
        Aufgabe         & erreichbare Punktzahl\\
        \multicolumn{2}{c}{1.~Vorbereitung}\\
        a)              & /9\\
        b)              & /3\\
        c)              & /2\\
        d)              & /2\\
        $\Sigma$        & /16\\
        2.~Durchführung & /8\\
        \multicolumn{2}{c}{3.~Auswertung}\\
        a)              & /3\\
        b)              & /2\\
        c)              & /2\\
        d)              & /2\\
        $\Sigma$        & /9\\
        4.~Fazit        & /2
      \end{tabular*}
    \end{table}
    \textbf{Gesamt}:\quad/35
\end{document}

And the result:

result

The table is left aligned. Why? I wish a centering aligning. How can I make this?

Using \centering or \begin{center} ... \end{center} changes nothing. Here the code besides:

\documentclass[paper = landscape, pagesize, twocolumn, table, ngerman]{scrartcl}%table: for color tables
\usepackage[margin = 5mm,bottom = 25mm]{geometry}
\usepackage{babel, xcolor, float}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenx}

\rowcolors{2}{black!10}{black!30}

\begin{document}
  \section{Punktetabelle}
    \begin{table}[H]
      \caption{Punktetabelle}
      \centering
      \begin{tabular*}{\linewidth}{cr}\rowcolor{black!50}
        Aufgabe         & erreichbare Punktzahl\\
        \multicolumn{2}{c}{1.~Vorbereitung}\\
        a)              & /9\\
        b)              & /3\\
        c)              & /2\\
        d)              & /2\\
        $\Sigma$        & /16\\
        2.~Durchführung & /8\\
        \multicolumn{2}{c}{3.~Auswertung}\\
        a)              & /3\\
        b)              & /2\\
        c)              & /2\\
        d)              & /2\\
        $\Sigma$        & /9\\
        4.~Fazit        & /2
      \end{tabular*}
    \end{table}
    \textbf{Gesamt}:\quad/35
\end{document}

The result is the same as above. And:

\documentclass[paper = landscape, pagesize, twocolumn, table, ngerman]{scrartcl}
\usepackage[margin = 5mm, bottom = 25mm]{geometry}
\usepackage{babel, xcolor, float}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenx}

\rowcolors{2}{black!10}{black!30}

\begin{document}
  \section{Punktetabelle}
    \begin{table}[H]
      \caption{Punktetabelle}
      \begin{center}
        \begin{tabular*}{\linewidth}{cr}\rowcolor{black!50}
          Aufgabe         & erreichbare Punktzahl\\
          \multicolumn{2}{c}{1.~Vorbereitung}\\
          a)              & /9\\
          b)              & /3\\
          c)              & /2\\
          d)              & /2\\
          $\Sigma$        & /16\\
          2.~Durchführung & /8\\
          \multicolumn{2}{c}{3.~Auswertung}\\
          a)              & /3\\
          b)              & /2\\
          c)              & /2\\
          d)              & /2\\
          $\Sigma$        & /9\\
          4.~Fazit        & /2
        \end{tabular*}
      \end{center}
    \end{table}
    \textbf{Gesamt}:\quad/35
\end{document}

Again the same result as above.

Also any other optimization is welcome too.

Thank you for your help and effort in advance!

3
  • \begin{table*}...\end{table*}
    – user31729
    Commented Jan 21, 2017 at 15:31
  • 2
    It should be noted that [H] doesn't work with table*, only t, b, and p. Commented Jan 21, 2017 at 16:32
  • 1
    \centering works, if you change to the non-starred version of tabular. I guess forcing the table to stretch to \linewidth (even though there is no content requiring it) makes centering impossible.
    – hakaze
    Commented Jan 21, 2017 at 16:41

1 Answer 1

4

You need to use the table*-environment.

Please, don't use the [H]-option, as it leads the float environment ad absurdum. Either you allow that content to flow around, or not. So option [H] renders the float inconsistent.

\documentclass[paper = landscape, pagesize, twocolumn, table, ngerman]{scrartcl}%table: for color tables
\usepackage[margin = 5mm, bottom = 25mm]{geometry}
\usepackage[main=ngerman]{babel}
\usepackage{xcolor}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{tabularx}

\rowcolors{2}{black!10}{black!30}%alternating row colors in tables

\begin{document}
  \section{Punktetabelle}
    \begin{table*}
      \caption{Punktetabelle}
      \begin{tabularx}{\linewidth}{cX}\rowcolor{black!50}%makes the first line darker
        Aufgabe         & erreichbare Punktzahl\\
        \multicolumn{2}{c}{1.~Vorbereitung}\\
        a)              & /9\\
        b)              & /3\\
        c)              & /2\\
        d)              & /2\\
        $\Sigma$        & /16\\
        2.~Durchführung & /8\\
        \multicolumn{2}{c}{3.~Auswertung}\\
        a)              & /3\\
        b)              & /2\\
        c)              & /2\\
        d)              & /2\\
        $\Sigma$        & /9\\
        4.~Fazit        & /2
      \end{tabularx}
    \end{table*}
    \textbf{Gesamt}:\quad/35
\end{document}
1
  • Hello everybody! Thank you for your answers and comments!
    – Su-47
    Commented Jan 22, 2017 at 12:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .