Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
share|improve this question

3 Answers 3

up vote 12 down vote accepted

enter image description here

\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}
share|improve this answer
    
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.

share|improve this answer

There is a development version of cals that takes care of this issue.

See: https://github.com/olpa/tex/raw/master/cals/dev/cals.sty

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

According to cals developer Oleg Parashchenko, a new version of cals will be released on CTAN in the coming days.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.