# How can you change the alignment of calstable?

calstable is always left aligned.

\documentclass{article}
\usepackage{cals}
\begin{document}
\begin{center}
\begin{calstable}
\colwidths{{1.5cm}{1.5cm}{1.5cm}}
\brow\cell{test1}\cell{test2}\cell{test3}\erow
\brow\cell{test1}\cell{test2}\cell{test3}\erow
\end{calstable}
\end{center}
\end{document}


As you can see center environment has no effect. How can you change the alignment of calstable environment?

Note: This is a multipage table so putting it inside minipage will not help. I am also not looking to load another package to fix this.

Edit: David's solution work, however if you add bottom rule, it does not move to center:

\documentclass{article}
\usepackage{cals}
\makeatletter
\renewcommand\cals@issue@row{%
\nointerlineskip
\setbox0=\vtop{\hbox to \textwidth{\hskip\leftskip \box\cals@current@cs \hskip\rightskip}}%
\ht0=0pt \box0
\nointerlineskip
\hbox to \textwidth{\hskip\leftskip\hbox{\cals@issue@rowsep}\hskip\rightskip}%
\nointerlineskip
\hbox to \textwidth{\hskip\leftskip \box\cals@current@row \hskip\rightskip}%
\let\cals@last@rs@below=\cals@current@rs@below
\let\cals@last@context=\cals@current@context}

\makeatother

\begin{document}

\begin{calstable}\leftskip\fill\rightskip\fill
\makeatletter
\def\cals@borderB{0.4pt}
\makeatother
\colwidths{{1.5cm}{1.5cm}{1.5cm}}
\brow\cell{test1}\cell{test2}\cell{test3}\erow
\brow\cell{test1}\cell{test2}\cell{test3}\erow
\end{calstable}

\end{document}

-

\documentclass{article}
\usepackage{cals}
\makeatletter
\renewcommand\cals@issue@row{%
\nointerlineskip
\setbox0=\vtop{\hbox to \textwidth{\hskip\leftskip \box\cals@current@cs \hskip\rightskip}}%
\ht0=0pt \box0
\nointerlineskip
\hbox to \textwidth{\hskip\leftskip\hbox{\cals@issue@rowsep}\hskip\rightskip}%
\nointerlineskip
\hbox to \textwidth{\hskip\leftskip \box\cals@current@row \hskip\rightskip}%
\let\cals@last@rs@below=\cals@current@rs@below
\let\cals@last@context=\cals@current@context}

\makeatother

\begin{document}

\begin{calstable}\leftskip\fill\rightskip\fill
\colwidths{{1.5cm}{1.5cm}{1.5cm}}
\brow\cell{test1}\cell{test2}\cell{test3}\erow
\brow\cell{test1}\cell{test2}\cell{test3}\erow
\end{calstable}

\end{document}

-
thanks a lot. Please see the edit of my question. Not sure why bottom rule does not go to center. –  Persian TeX Group Apr 30 '13 at 9:41
fixed it. thanks –  Persian TeX Group Apr 30 '13 at 9:51
Your solution works great, David. I contacted the package author to see if he can incorporate this solution into his package. –  Serge Stroobandt May 26 '13 at 15:33

The cals package version 2.2 (updated on CTAN 27 May 2013) should fix the error.

-
The calstable environment now behaves properly when placed inside a center environment.