9

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}

3 Answers 3

12

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}
1
  • Your solution works great, David. I contacted the package author to see if he can incorporate this solution into his package. Commented May 26, 2013 at 15:33
2

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

1

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .