# Strange centering

\centering command, that I use in my document gives strange output - values aren't centered equally

image below should let you understand (elements in red frame and two not framed "value" strings in table, are not centered) code for this page/document:

\documentclass[twoside,titlepage]{article}
\usepackage[polish]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[a4paper,inner=3.5cm,outer=2.0cm,top=2.0cm,bottom=2.0cm]{geometry}
\usepackage{multicol}
\usepackage[titletoc,title]{appendix}
\usepackage[table]{xcolor}
\usepackage{multirow}
\usepackage{mathtools}
\newcommand{\appendixtitle}[2]{\begin{center}(#1)\\ ~ \\ {\Large #2}\end{center}}
\newcolumntype{z}[1]{%
>{\centering\hspace{0pt}}m{#1}}%
\newcommand{\tnl}{\tabularnewline}
\usepackage{lipsum}
\begin{document}
\begin{appendices}
\section[~]{\centering}
\appendixtitle{type}{appendix title}
\newlength{\celllen}
\setlength{\celllen}{\textwidth/5}
\lipsum[1]
\begin{table}[!htb]
\caption{multirowed}
\centering
\begin{tabular}{|*{4}{z{\celllen}|}}
\hline
\multirow{2}{\celllen}{\centering
very very very long cell \newline symbol \newline unit
} & \multicolumn{3}{c|}{ \textbf{   Description } } \tnl
& value & value & value \tnl \hline
\end{tabular}
\end{table}

\begin{table}[!htb]
\caption{final}
\centering
\begin{tabular}{|*{4}{z{\celllen}|}}
\hline
\multirow{5}{\celllen}{\centering
very very very long cell \newline symbol \newline unit
} & \multicolumn{3}{c|}{ \textbf{   Description } } \tnl
& value & value & value \tnl \cline{2-4}
& \multicolumn{3}{c|}{ \textbf{ Description }, symbol, unit } \tnl
& value & value & value \tnl \cline{2-4}
& \multicolumn{3}{c|}{ \textbf{ Description }, symbol, unit } \tnl \hline
value \newline (comment) & value & value & value \tnl \hline
value \newline (comment) & value & value & value \tnl \hline
\end{tabular}
\end{table}
\end{appendices}
\end{document}


How can I make all those red-framed-texts (and "value" strings I forgot to frame) centered, just like other strings

P.S. help with first table (text overflow) is greatly appreciated ;)

-

Don't use \newline but \\.

\documentclass{article}
\begin{document}
\centering

aaa\\ bbbbbb\\ cccccc

aaa\newline bbbbbb\newline cccccc

\end{document}


And try to make simpler examples. Wading through all this \multirow etc doesn't make it easy to debug your code.

-
It's my first real LaTeX document, and first real problem, where I couldn't find answer, so please forgive me my long example here ;) –  Soul Reaver Feb 12 '12 at 18:15
the mechanism for \newline makes this command be equivalent to \\, so what precedes it is treated as an ordinary "paragraph" (ending with \parfillskip glue, messing up the centering). (you are using this inside a table, which means you shouldn't use \\ directly.)
change \newline to \break, avoiding all fancy additions (but also all checking), and every line will center as desired.
Using \ to end centered lines will works fine in the example. \ to end tabular lines will not work in the cell with centering, so you should \tabularnewline instead (or give \ the "end tabular line" meaning back with \\arraybackslash) –  Ulrike Fischer Feb 12 '12 at 18:01
@barbara: Sorry I forget (again) about the problem with the backslashes. So here the hopefully corrected comment: Using  \\  to end centered lines will works fine in the example.  \\  to end tabular lines will not work in the cell with centering, so you should \tabularnewline instead (or give  \\  the "end tabular line" meaning back with  \arraybackslash ) –  Ulrike Fischer Feb 12 '12 at 18:41