使用以下代码:
\documentclass{article}
\usepackage[utf8]{inputenc} % set input encoding (not needed with XeLaTeX)
\usepackage[plain,noend,noline,boxed]{algorithm2e}
\begin{document}
\begin{algorithm}
\SetKwData{Property}{property}\SetKwData{Shape}{shape}\SetKwData{Game}{game}\SetKwData{Event}{event}
\KwData{A \Game, an \Event, a \Shape, and a \Property that changed}
\KwResult{The code modifications that can change the \Property to its new value according to the game state}
\caption{\Property.template.matches \label{templatematch}}
\end{algorithm}
\end{document}
我最终得到以下无法读取的错误(在 Windows 7 上使用 Texlipse 和基本的 MikTex 安装进行编译)
Argument of \@caption has an extra }. ...ty.template.matches \label{templatematch}} (followed by: ) document.tex /TestLatex line 10 Texlipse Build Error
Paragraph ended before \@caption was complete. ...ty.template.matches \label{templatematch}} (followed by: ) document.tex /TestLatex line 10 Texlipse Build Error
为什么我会收到此错误?这是什么意思?我无法更正它。它之前可以正常工作,我不知道发生了什么变化。谢谢,Mikaël
答案1
\caption{\protect\Property.template.matches \label{templatematch}}
移动参数中的脆弱命令需要\protect