% 上标值和下标值情况下第 2 行、第 3 行和第 4 行之间的主导问题
\documentclass{article}
\usepackage{cals}
\begin{document}
\par\begin{calstable}
\colwidths{{50pt}{50pt}{50pt}{50pt}}
\thead{\bfseries\brow \cell{col1} \cell{col2} \cell{col3} \cell{col4}\erow\mdseries}
\brow \cell{col1}\cell{r1,col2} \cell{r1,col3} \cell{col4}\erow
\brow \cell{col1} \cell{r2,col2} \cell{r2,col3} \cell{col4}\erow
\brow \cell{col1$_3^3$} \cell{r3,col2$^1_5$} \cell{r3,col3}\cell{col4} \erow
\brow \cell{col1} \cell{r4,col2} \cell{r4,col3} \cell{col4}\erow
\brow \cell{col1$5^+_5$} \cell{r5,col2} \cell{r5,col3} \cell{col4}\erow
\end{calstable}
\end{document}
答案1
引用cals
用户指南:
要将单元格垂直对齐到中间或底部,请在单元格内容前添加
\vfil
或 。\vfill
下面显示了与包含上标和下标的表格单元格结合使用不同的对齐选项的情况:
\documentclass{article}
\usepackage{cals}
\begin{document}
\begin{calstable}
\colwidths{{50pt}{50pt}{50pt}{50pt}}
\brow \cell{col1$_3^3$} \cell{top} \cell{\vfil center}\cell{\vfill bottom} \erow
\end{calstable}
\end{document}
为了使包含上标和下标的行中的文本垂直居中,您可以使用\vfil
如以下 MWE 所示:
\documentclass{article}
\usepackage{cals}
\begin{document}
\begin{calstable}
\colwidths{{50pt}{50pt}{50pt}{50pt}}
\thead{\bfseries\brow \cell{col1} \cell{col2} \cell{col3} \cell{col4}\erow\mdseries}
\brow \cell{col1}\cell{r1,col2} \cell{r1,col3} \cell{col4}\erow
\brow \cell{col1} \cell{r2,col2} \cell{r2,col3} \cell{col4}\erow
\brow \cell{col1$_3^3$} \cell{r3,col2$^1_5$} \cell{\vfil r3,col3}\cell{\vfil col4} \erow
\brow \cell{col1} \cell{r4,col2} \cell{r4,col3} \cell{col4}\erow
\brow \cell{col1$5^+_5$} \cell{\vfil r5,col2} \cell{\vfil r5,col3} \cell{\vfil col4}\erow
\end{calstable}
\end{document}
答案2
不幸的是,上标对于对齐来说太高了。 cals 包希望第一行的高度不大于字母“Ml”的高度。可能的解决方案是:
1)自动基线对齐:
\cell{
\vskip-\baselineskip \phantom{ly}\par
col1$_3^3$
}
2)所有首行的高度均增大:
\cell{\strut r5,col2}
答案3
如果要使行均等,可以增加行距:
\documentclass{article}
\usepackage{cals}
\begin{document}
\begin{calstable}\linespread{1.25}\selectfont
\colwidths{{50pt}{50pt}{50pt}{50pt}}
\thead{\bfseries\brow \cell{col1} \cell{col2} \cell{col3} \cell{col4}\erow\mdseries}
\brow \cell{col1}\cell{r1,col2} \cell{r1,col3} \cell{col4}\erow
\brow \cell{col1} \cell{r2,col2} \cell{r2,col3} \cell{col4}\erow
\brow \cell{col1$_3^3$} \cell{r3,col2$^1_5$} \cell{r3,col3}\cell{col4} \erow
\brow \cell{col1} \cell{r4,col2} \cell{r4,col3} \cell{col4}\erow
\brow \cell{col1$5^+_5$} \cell{r5,col2} \cell{r5,col3} \cell{col4}\erow
\end{calstable}
\end{document}
值 1.25 仅用于举例;如果是 1.1,则