
我正在嘗試對 longtable 使用 bicaption,但有一個問題:
我想為第二頁的表格添加雙語標題,但我只能添加英文標題或其他語言標題。我可以做什麼來實現它?
這是一個例子:
\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}