calstable
始终左对齐。
\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}
如您所见,center
环境没有影响。如何更改calstable
环境的对齐方式?
笔记:这是一个多页表,因此将其放入 minipage 中不会有帮助。我也不打算加载另一个包来解决这个问题。
编辑:David 的解决方案有效,但是如果添加底部规则,它不会移动到中心:
\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}
答案1
\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}
答案2
cals 包版本 2.2(2013 年 5 月 27 日 CTAN 更新)应该可以修复该错误。
答案3
有一个开发版本的 cals 可以解决这个问题。
看:https://github.com/olpa/tex/raw/master/cals/dev/cals.sty
calstable
当放置在环境内部时,环境现在能够正常运行center
。
据 cals 开发人员 Oleg Parashchenko 介绍,未来几天将在 CTAN 上发布新版本的 cals。