我最近发现了鲜为人知的用于定义 HTML 样式表格的 cals 包。
以下是我找到的所有文档:
- http://www.ctan.org/tex-archive/macros/latex/contrib/cals(演示和文档)
- http://tug.org/TUGboat/tb32-2/tb101parashchenko.pdf(用户手册)
我可以创建漂亮的表格,但按照说明删除垂直单元格边框不起作用。有人能帮忙吗?
这是一个有效的例子:
\documentclass{report}
\listfiles
%tables in CALS markup
\usepackage{cals}
%calculate with \textwidth etc.
\usepackage{calc}
\newlength{\lengthw}
\begin{document}
\setlength{\lengthw}{\textwidth-5cm}
\begin{table}[ht]
\caption{Aantal uitgangen}
\begin{calstable}
\colwidths{{\lengthw}{5cm}}
\def\cals@cs@width{0pt} %this should delete column borders but is does not!
\thead{
\brow
\alignL\cell{} \alignC\cell{\vfil Aantal uitgangen}\erow
}
\brow
\alignL\cell{\vfil$aantal\ gebruikers < 50$}
\alignC\cell{\vfil 1 of 2 uitgangen (cfr. 7.1.2)}
\erow
\brow
\alignL\cell{\vfil$50 \leq aantal\ gebruikers < 500$}
\alignC\cell{\vfil 2}
\erow
\brow
\alignL\cell{\vfil$500 \leq aantal\ gebruikers < 1000$}
\alignC\cell{\vfil 3}
\erow
\brow
\alignL\cell{\vfil $1000 \times n \leq aantal\ gebruikers < 1000 \times (n+1)$
\\met $n = 1, 2, 3, \dots$}
\alignC\cell{\vfil$n+3$}
\erow
\end{calstable}
\end{table}
\end{document}
答案1
因为宏的名称中\cals@cs@width
包含字符@
,所以需要用\makeatletter
and将使用它的部分括起来\makeatother
(→\makeatletter 和 \makeatother 起什么作用?)
\makeatletter
\def\cals@cs@width{0pt}%
\makeatother
如果您在文档的前言部分(加载cals
包之后)使用它,则无需每次都重复它。
如果您想为每个表格决定是否需要垂直规则(我不建议这样做),那么您最好使用@
在文档序言中定义的 -less 宏。
\makeatletter
\newcommand*{\calsNoVertRules}{%
\renewcommand*{\cals@cs@width}{0pt}%
}
\makeatother
现在您只需使用即可\calsNoVertRules
关闭垂直规则。
答案2
\documentclass{report}
\listfiles
%tables in CALS markup
\usepackage{cals}
%calculate with \textwidth etc.
\usepackage{calc}
\newlength{\lengthw}
%my suggestion
\makeatletter
\begin{document}
\setlength{\lengthw}{\textwidth-5cm}
\begin{table}[ht]
\caption{Aantal uitgangen}
\begin{calstable}
\colwidths{{\lengthw}{5cm}}
%\def\cals@cs@width{0pt} %this should delete column borders but is does not!
\thead{
%my suggestion
%\def\cals@borderT{0.4pt} %borderTop
%\def\cals@borderB{0.4pt} %borderBottom
%\def\cals@borderL{0pt} %borderLeft
\def\cals@borderR{0pt} %borderRight
\brow
\alignL\cell{} \alignC\cell{\vfil Aantal uitgangen}\erow
}
\brow
\alignL\cell{\vfil$aantal\ gebruikers < 50$}
\alignC\cell{\vfil 1 of 2 uitgangen (cfr. 7.1.2)}
\erow
\brow
\alignL\cell{\vfil$50 \leq aantal\ gebruikers < 500$}
\alignC\cell{\vfil 2}
\erow
\brow
\alignL\cell{\vfil$500 \leq aantal\ gebruikers < 1000$}
\alignC\cell{\vfil 3}
\erow
\brow
\alignL\cell{\vfil $1000 \times n \leq aantal\ gebruikers < 1000 \times (n+1)$
\\met $n = 1, 2, 3, \dots$}
\alignC\cell{\vfil$n+3$}
\erow
\end{calstable}
\end{table}
\end{document}