![为第二页的表格添加双语标题](https://linux22.com/image/448686/%E4%B8%BA%E7%AC%AC%E4%BA%8C%E9%A1%B5%E7%9A%84%E8%A1%A8%E6%A0%BC%E6%B7%BB%E5%8A%A0%E5%8F%8C%E8%AF%AD%E6%A0%87%E9%A2%98.png)
我正在尝试将 bicaption 用于 longtable,但是遇到了一个问题:
我想为第二页的表格添加双语标题,但我只能添加英文标题或其他语言标题。我该怎么做才能实现?
以下是一个例子:
\documentclass[UTF-8]{ctexbook}
\usepackage{lipsum} % for random text
\usepackage{longtable} % for long table
\usepackage{makecell}
\usepackage{bicaption}
\DeclareCaptionOption{bi-first}[]{
\def\tablename{表}
\def\figurename{图}}
\DeclareCaptionOption{bi-second}[]{
\def\tablename{Table.}
\def\figurename{Fig.}}
\captionsetup[bi-first]{bi-first}
\captionsetup[bi-second]{bi-second}
\usepackage{booktabs}
\begin{document}
\lipsum[1]
{
\small
\begin{longtable}{p{4cm}<{\centering} p{4cm}<{\centering} p{4cm}<{\centering}}
\bicaption{表}{table}
\label{table:cabin_setup}\\
\toprule[1.5pt]
column1 & column2 & column3 \\
\midrule[0.5pt]
\endfirsthead
\multicolumn{3}{c}%
{\tablename\ \thetable{} table(continued)}\\
\toprule[1.5pt]
column1 & column2 & column3\\
\midrule[0.5pt]
\endhead
\bottomrule[1.5pt] \\
\endfoot
\bottomrule[1.5pt]
\endlastfoot
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\ \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
\end{longtable}
}
\end{document}
答案1
如果你想在后面的每一页上使用相同的标题格式,那么你不必手动添加它,只需\bicaption
在后面添加另一个命令即可\endfirsthead
。我在每个参数前放置方括号,并将它们留空,如下所示:\bicaption[]{表(续)}[]{table(continued)}
为了让标题编号,但不是每次都添加到表格列表中。我将表格加长以显示效果,并在第一页包含表格列表。我不知道这是否比你的方法更好。你可以决定你想要哪种风格。以下是代码:
\documentclass[UTF-8]{ctexbook}
\usepackage{lipsum} % for random text
\usepackage{longtable} % for long table
\usepackage{makecell}
\usepackage{bicaption}
\DeclareCaptionOption{bi-first}[]{
\def\tablename{表}
\def\figurename{图}}
\DeclareCaptionOption{bi-second}[]{
\def\tablename{Table.}
\def\figurename{Fig.}}
\captionsetup[bi-first]{bi-first}
\captionsetup[bi-second]{bi-second}
\usepackage{booktabs}
\begin{document}
\listoftables
\clearpage
\lipsum[1]
{
\small
\begin{longtable}{p{4cm}<{\centering} p{4cm}<{\centering} p{4cm}<{\centering}}
\bicaption{表}{table}
\label{table:cabin_setup}\\
\toprule[1.5pt]
column1 & column2 & column3 \\
\midrule[0.5pt]
\endfirsthead
\bicaption[]{表(续)}[]{table(continued)}\\
\toprule[1.5pt]
column1 & column2 & column3\\
\midrule[0.5pt]
\endhead
\bottomrule[1.5pt] \\
\endfoot
\bottomrule[1.5pt]
\endlastfoot
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\ \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
\end{longtable}
}
\end{document}
答案2
问题解决了,我尝试手动添加字幕,虽然可能不够完美,但还是得到了我想要的效果,代码如下:
\documentclass[UTF-8]{ctexbook}
\usepackage{lipsum} % for random text
\usepackage{longtable} % for long table
\usepackage{makecell}
\usepackage{bicaption}
\DeclareCaptionOption{bi-first}[]{
\def\tablename{表}
\def\figurename{图}}
\DeclareCaptionOption{bi-second}[]{
\def\tablename{Table.}
\def\figurename{Fig.}}
\captionsetup[bi-first]{bi-first}
\captionsetup[bi-second]{bi-second}
\usepackage{booktabs}
\begin{document}
\lipsum[1]
{
\small
\begin{longtable}{p{4cm}<{\centering} p{4cm}<{\centering} p{4cm}<{\centering}}
\bicaption{表}{table}
\label{table:cabin_setup}\\
\toprule[1.5pt]
column1 & column2 & column3 \\
\midrule[0.5pt]
\endfirsthead
\multicolumn{3}{c}%
{\tablename\ \thetable{} 表(续)}\\
\multicolumn{3}{c}%
{\tablename\ \thetable{} table(continued)}\\
\toprule[1.5pt]
column1 & column2 & column3\\
\midrule[0.5pt]
\endhead
\bottomrule[1.5pt] \\
\endfoot
\bottomrule[1.5pt]
\endlastfoot
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\ \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
\end{longtable}
}
\end{document}