[Tex/LaTex] Center table on page

horizontal alignmenttables

I would like to center a table on the page, not only the content. But I can't find the right keyparameter or command.

I have follwing table

\documentclass[11pt]{scrartcl}
\usepackage{multirow}

\usepackage[a4paper]{geometry} 
\geometry{a4paper,tmargin=3.5cm, bmargin=2.5cm, lmargin=2cm, rmargin=2.5cm, headheight=3em, headsep=1.5cm, footskip=1cm} 


\begin{document}
Erstellen Sie folgende Tabelle in der Datei \emph{A2.tex}. Verwenden sie
  dazu die Befehle \texttt{\textbackslash multirow},  \texttt{\textbackslash
  multicolumn}, \texttt{\textbackslash hline} und \texttt{\textbackslash cline}.

    \begin{tabular}{|c|c|c|c|}
        \hline
        \multirow{3}{*}{Zelle A}& Zelle B & \multicolumn{2}{|c|}{Zelle C} \\
        \cline{2-4}
        &\multicolumn{2}{|c|}{Zelle D}& Zelle F \\
        \cline{2-4}
         & Zelle H & Zelle I & Zelle J \\
         \cline{1-4}
        \multicolumn{4}{|c|}{Zelle K} \\
        \hline
    \end{tabular}

\end{document}

How can I center the whole table horizontally?

Best Answer

You can also enclose the tabularenvironment within a table environment. Not only will it allow you to center it (using the command \centering) but also to add a caption, a label for cross-reference, and to tweak the placement on the page.

So, for the most basic use :

\begin{table}[h]
\centering
  \begin{tabular}{|c|c|c|c|}
    \hline
    \multirow{3}{*}{Zelle A}& Zelle B & \multicolumn{2}{|c|}{Zelle C} \\
    \cline{2-4}
    &\multicolumn{2}{|c|}{Zelle D}& Zelle F \\
    \cline{2-4}
     & Zelle H & Zelle I & Zelle J \\
     \cline{1-4}
    \multicolumn{4}{|c|}{Zelle K} \\
    \hline
  \end{tabular}
\end{table}

If you really need the table to be where you added it in the source, the other answers (most notably the center environment) will probably prove less irritating.

Related Question