# Only titles in table should be centered, the rest should stay unchanged

I have a table with 2x5 size. I have used the tabular environment to define it. I just want that the titles (the first both cells) should be centered but the rest of the table should be left-justified.

\documentclass[a4paper, %Papiergröße
12pt,             %Schriftgröße
headsepline,   %Linie zwischen Text und Kopfzeile
twoside,       %zweiseitiges Layout
BCOR18mm,      %Binderand von 18mm
DIV14,         %14x14 Streifen pro Seite
dvipsnames,
cmyk]{scrreprt}
\usepackage{tabstackengine,amssymb}
\usepackage{tikz}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{tabularx}
\usepackage{booktabs}
\usetikzlibrary{tikzmark,calc}
\stackMath
\newcommand{\myq}{\,\,\,}
\theoremstyle{definition}
\newtheorem{definition}{Definition}[section]
\newlength\replength
\newcommand\ruleht{0pt}% ELEVATION OF RULE
\newcommand\repfrac{.6}% SOLID FRACTION OF DASH LINE [0->1] (USE 1 FOR SOLID)
\replength=.2em\relax% PERIOD OF DASHED RULE
\newcommand\rulewidth{.4pt}% THICKNESS OF RULE
\newcommand\drulefill{\leavevmode\dashfill\hfil%
\kern\dimexpr\repfrac\replength-\replength\relax}
\smash{\rule[\ruleht]{\repfrac\replength}{\rulewidth}}}\hfill}
\newcommand\udash[2][\hrulefill]{%
\setbox0=\hbox{\stackon{\kern.7em}{\,#2\,}}%
\stackunder{#2}{\makebox[\wd0]{#1}}}
\newcommand\uddash[1]{\udash[\drulefill]{#1}}
\newcommand\mygap{\hspace{.7em}}
\begin{document}

\begin{center}
\setlength\arrayrulewidth{1pt}
\begin{tabular}{c|c}
$\rho_r : (\forall X_r)$ $p_r[ \tabbedShortunderstack{\udash{L_r}\\R_r} ]$ & $\rho_\omega : (\forall X_\omega)$ $p_\omega[ \tabbedShortunderstack{\udash{L_\omega}\\R_\omega} ]$  \\
\hline
$X_r=\{x,i,k,\sigma\}$ & $X_\omega=\{x,i,i',k,\sigma\}$  \\
$W_r=\{\Box\}$ & $W_\omega=\{\Box_1,\Box_2\}$  \\
$p_r=\langle\Box\curvearrowright k\rangle_k \langle\sigma\,x\mapsto i\rangle_{state}$ & $p_\omega=\langle\Box_1\curvearrowright k\rangle_k \langle\sigma\,x\mapsto \Box_1\rangle_{state}$  \\
$L_r(\Box)=x$ & $L(\Box_1)=x=i'$; und $L(\Box_2)=i$  \\
$R_r(\Box)=i$ & $R(\Box_1)=\cdot$ und $R(\Box_2)=i'$  \\
\end{tabular}
\end{center}
\end{document}


This is what I get:

The rest after the vertical line should be left-justified. How can I realize that?

Thanks!

• Please consider removing all unrelated packages to make your post upvotable. – user121799 Nov 5 '18 at 15:19

You could (ab)use \multicolumn for that. That is, you do a "multi"column of 1 column, in which you choose c for the alignment, while the overall alignment is l. I also removed packages and commands that are not used here.

\documentclass[a4paper, %Papiergröße
12pt,             %Schriftgröße
headsepline,   %Linie zwischen Text und Kopfzeile
twoside,       %zweiseitiges Layout
BCOR18mm,      %Binderand von 18mm
DIV14,         %14x14 Streifen pro Seite
dvipsnames,
cmyk]{scrreprt}
\usepackage{tabstackengine}
\usepackage{amsmath,amssymb}
\stackMath
\newcommand\udash[2][\hrulefill]{%
\setbox0=\hbox{\stackon{\kern.7em}{\,#2\,}}%
\stackunder{#2}{\makebox[\wd0]{#1}}}
\begin{document}

\begin{center}
\setlength\arrayrulewidth{1pt}
\begin{tabular}{l|l}
\multicolumn{1}{c|}{$\rho_r : (\forall X_r)$ $p_r[ \tabbedShortunderstack{\udash{L_r}\\R_r} ]$} &
\multicolumn{1}{c}{$\rho_\omega : (\forall X_\omega)$ $p_\omega[ \tabbedShortunderstack{\udash{L_\omega}\\R_\omega} ]$}  \\
\hline
$X_r=\{x,i,k,\sigma\}$ & $X_\omega=\{x,i,i',k,\sigma\}$  \\
$W_r=\{\Box\}$ & $W_\omega=\{\Box_1,\Box_2\}$  \\
$p_r=\langle\Box\curvearrowright k\rangle_k \langle\sigma\,x\mapsto i\rangle_{state}$ & $p_\omega=\langle\Box_1\curvearrowright k\rangle_k \langle\sigma\,x\mapsto \Box_1\rangle_{state}$  \\
$L_r(\Box)=x$ & $L(\Box_1)=x=i'$; und $L(\Box_2)=i$  \\
$R_r(\Box)=i$ & $R(\Box_1)=\cdot$ und $R(\Box_2)=i'$  \\
\end{tabular}
\end{center}
\end{document}