关于longtable环境中的中英文标题

81 views
Skip to first unread message

Field

unread,
Sep 1, 2009, 11:56:51 AM9/1/09
to thuthesis
薛博士,您好!

为了实现表的中英双标题,我在thethusis.dtx中定义了一个新的命令:
\newcommand{\TabBiCaption}[2]
{\caption{#1}
\vspace{-1.3ex}
\addtocounter{table}{-1}
\renewcommand{\tablename}{Tab.}
\caption{#2}
}

这个命名对于 table环境好用,对于 longtable环境出错,不能得到正确结果。

错误信息为:
! Misplaced \noalign.
\caption ->\noalign
\bgroup \@ifnextchar [{\egroup \LT@c@ption
\@firstofone ...
l.460 \TabBiCaption{实验}{test}

?

一路回车后,生成的pdf文件中相应的表标题为:

表 1.3 实验 (这行居
中)
表 1.2 test (这行居左)

不知道为什么在table环境中能够得到正确结果,在longtable环境中确不行?

谢谢

Ruini Xue

unread,
Sep 2, 2009, 7:37:25 AM9/2/09
to thut...@googlegroups.com


2009/9/1 Field <shengl...@gmail.com>

薛博士,您好!

为了实现表的中英双标题,我在thethusis.dtx中定义了一个新的命令:
\newcommand{\TabBiCaption}[2]
{\caption{#1}
\vspace{-1.3ex}
\addtocounter{table}{-1}
\renewcommand{\tablename}{Tab.}
\caption{#2}
}

这个命名对于 table环境好用,对于 longtable环境出错,不能得到正确结果。

错误信息为:
! Misplaced \noalign.
\caption ->\noalign
                   \bgroup \@ifnextchar [{\egroup \LT@c@ption
\@firstofone ...
l.460 \TabBiCaption{实验}{test}

看起来是longtable自己定义的LT@caption部分出问题了,我慢慢研究一下.... :(
 

Field

unread,
Sep 13, 2009, 5:07:28 AM9/13/09
to thuthesis
薛博士,您好!

不知这个问题是否解决了?

On 9月2日, 上午7时37分, Ruini Xue <xueru...@gmail.com> wrote:
> 2009/9/1 Field <shengli.xu...@gmail.com>

Ruini Xue

unread,
Sep 16, 2009, 3:26:06 AM9/16/09
to thut...@googlegroups.com


2009/9/13 Field <shengl...@gmail.com>
薛博士,您好!

不知这个问题是否解决了?

 
sorry, 最近瞎忙没时间折腾这个 :(

你用\listfiles把用到的宏包列表打印出来。方便的话,弄个mini example发上来。
 
-- ruini

Shengli Xu

unread,
Oct 4, 2009, 12:19:16 PM10/4/09
to thut...@googlegroups.com
薛博士,您好!

关于longtable的问题还没有解决,我在thuthesis模板的基础上生成了一个小例子:
附件中的 thuthesis.dtx 增加了 \TabBiCaption定义。
在 main.tex 中增加了 \listfiles
在 chap01.txt 中 将 "\caption{复杂表格示例 2}" 改为 "\TabBiCaption{复杂表格示例 2}{Tab 2}",能够实现中英文标题。
但是对于longtable, 将 "\caption{实验数据}" 改为 “\TabBiCaption{实验数据}{Experiment data}”,出现错误,内容输出为out.txt文件。

谢谢!

Shengli

2009/9/16 Ruini Xue <xuer...@gmail.com>



--
Shengli Xu
out.txt
thuthesis.dtx
main.tex
chap01.tex

Ruini Xue

unread,
Oct 6, 2009, 9:19:11 AM10/6/09
to thut...@googlegroups.com


2009/10/5 Shengli Xu <shengl...@gmail.com>

薛博士,您好!

关于longtable的问题还没有解决,我在thuthesis模板的基础上生成了一个小例子:
附件中的 thuthesis.dtx 增加了 \TabBiCaption定义。
在 main.tex 中增加了 \listfiles
在 chap01.txt 中 将 "\caption{复杂表格示例 2}" 改为 "\TabBiCaption{复杂表格示例 2}{Tab 2}",能够实现中英文标题。
但是对于longtable, 将 "\caption{实验数据}" 改为 “\TabBiCaption{实验数据}{Experiment data}”,出现错误,内容输出为out.txt文件。


跟踪了一下,问题应该是longtable的\endfirsthead部分要求是tabular格式数据,也就是说不能直接调用非\noalign命令,而这在一般的table里是不存在的。暂时我没想到好的解决办法,有个很丑的wordaround,就是不直接调用caption命令,而是用表格的一行来模拟(还用模板中的例子):

%================
\caption{实验数据}\label{tab:performance}\\
\multicolumn{7}{c}{Tab.~\thetable\hskip1em Experiment Results.}\\
 %=====================

-- ruini

Shengli Xu

unread,
Oct 7, 2009, 3:30:16 AM10/7/09
to thut...@googlegroups.com
谢谢薛博士,

基本可以了,就是 中文标题和英文标题之间的垂直距离有些大,而英文标题和\toprule生成的横线之间的距离有点小,尝试用\vspace命令进行调整,没有成功。

请问如何适当调整中英文标题,以及英文标题和表最上面横线之间的垂直距离?

谢谢!

shengli

2009/10/6 Ruini Xue <xuer...@gmail.com>



--
Shengli Xu

Ruini Xue

unread,
Oct 7, 2009, 5:55:42 AM10/7/09
to thut...@googlegroups.com


2009/10/7 Shengli Xu <shengl...@gmail.com>

谢谢薛博士,

基本可以了,就是 中文标题和英文标题之间的垂直距离有些大,而英文标题和\toprule生成的横线之间的距离有点小,尝试用\vspace命令进行调整,没有成功。

请问如何适当调整中英文标题,以及英文标题和表最上面横线之间的垂直距离?


\noalign{\vskip....}

Shengli Xu

unread,
Oct 7, 2009, 7:20:10 AM10/7/09
to thut...@googlegroups.com
非常感谢薛博士!

2009/10/7 Ruini Xue <xuer...@gmail.com>



--
Shengli Xu
Reply all
Reply to author
Forward
0 new messages