我编写了一个代码,将输出图表列表和表格列表的格式更改为表 1、表 2 ..........和图 1、图 2 ............,而不是 1,2,........
该代码运行良好,但是当我尝试使用长表时,它会产生错误
完整代码如下:
\documentclass{article}
\usepackage{longtable}
\usepackage{caption}% required
\makeatletter
\newcommand{\mycaption}[2][\@empty]% #1 = short caption (optionl), #2 = caption
{\refstepcounter\@captype
\caption@caption*{\csname fnum@\@captype\endcsname{: }#2}%
\ifx\@empty#1
\addcontentsline{\csname ext@\@captype\endcsname}{\@captype}%
{\csname\@captype name\endcsname\space\arabic{\@captype}: #2}%
\else
\addcontentsline{\csname ext@\@captype\endcsname}{\@captype}%
{\csname\@captype name\endcsname\space\arabic{\@captype}: #1}%
\fi
}
\makeatother
\begin{document}
%Creating list of tables and list of figures
\renewcommand{\listtablename}{\LARGE{Tables}}
\renewcommand{\listfigurename}{\LARGE{Figures}}
\listoftables
\listoffigures
\newpage
\begin{table}
\mycaption{A sample table.}
\end{table}
\begin{small}
\begin{longtable}{| p{0.05\linewidth} | p{0.3\linewidth} | p{0.1\linewidth} | p{0.1\linewidth} | p{0.1\linewidth} | p{0.2\linewidth} |}
BLA & BLA
& ++ & ++ & ++
& BLA
\\ \hline
\mycaption{\textbf{BLABLABLA}}
\end{longtable}
\end{small}
\begin{figure}
\renewcommand{\thefigure}{1.1}%
\caption{normal caption}
\renewcommand{\thefigure}{2.6}%
\mycaption{my caption}
\end{figure}
\end{document}
错误是:此行中未定义控制序列
\mycaption{\textbf{BLABLABLA}}
有什么帮助吗?