有没有办法把 放在\caption{}
前面\begin{longtable}
?举例说明,而不是
\documentclass{article}
\usepackage{longtable}
\begin{document}
\begin{longtable}{c|c|c|c}
\caption{This is a very nice table}
A & B & A & B \\ \hline
\end{longtable}
\end{document}
我想使用类似
\documentclass{article}
\usepackage{longtable}
\begin{document}
\caption{This is a very nice table}
\begin{longtable}{c|c|c|c}
A & B & A & B \\ \hline
\end{longtable}
\end{document}
答案1
您可以使用 来完成此操作\captionof
。请注意,此处标题和长表之间可以有分页符。
\documentclass{article}
\usepackage{longtable}
\usepackage{caption}
\begin{document}
\captionof{table}{This is a very nice table}
\begin{longtable}{c|c|c|c}
A & B & A & B \\ \hline
\end{longtable}
\addtocounter{table}{-1}
\captionof{table}{This is a very nice table}
\begin{longtable}{c|c|c|c}
A & B & A & B \\ \hline
\end{longtable}
\end{document}