未定义的控制序列
我正在用 LaTeX 制作硕士论文,但我无法使用所提供的样式。具体来说,当使用在 mscthesis.sty
中定义的函数 makeformaltitlepages
时,我收到错误“未定义的控制序列”。在互联网上,我能找到的唯一答案是简单的“您可能打错了”,或者“您可能忘记包含软件包”,但我有理由相信这些都不适用于我。
在序言中,我使用样式文件中定义的宏设置了几个变量,例如我的姓名和提供作业的公司的公司信息。在文档开始之后,从样式文件中调用函数maketitlepages
,该函数创建几个与大学风格相匹配的标题页。
[编辑]
找到解决方案后,我现在知道错误来自哪里。下面是一个小样式文件和一个小文档,可以编译它们以重新创建错误。简而言之,我使用 includegraphics
来包含一个文件名包含空格的图像文件。
example.sty:
\def\company#1{\gdef\@company{#1}}
\def\maketitlepages
{\begingroup
\newpage
\noindent
\begin{center}
\vskip 0em \rule{\textwidth}{1.5pt}
\vskip 1em {\Huge \@title \par}
\vskip 1em \rule{\textwidth}{1.5pt} \par \nobreak
\vskip 4em {\large A DOCUMENT}
\vskip 2em by
\vskip 2em {\large \@author}
\vfill
\@company
\end{center}
\newpage
\endgroup}
文档.tex:
\documentclass{article}
\usepackage{url}
\usepackage{example}
\usepackage[dvips]{graphicx}
\usepackage[dvips]{color}
\author{Your name}
\company{
\includegraphics[width=4cm]{company logo.eps}\\
A Company\\
Addressline 1\\
Addressline 2\\
Country\\
\url{www.acompany.com}
}
\title{Undefined control sequence}
\begin{document}
\pagestyle{empty}
\maketitlepages
I am making my Master's Thesis with LaTeX, but I can't get the provided style to work. Specifically, I get the error 'Undefined control sequence' when using the function makeformaltitlepages
, which is defined in mscthesis.sty
. On the internet, the only answer I could find is the straightforward 'you probably made a typo', or 'you probably forgot to include the package', but I have reason to believe neither of those apply to me.
In the preamble, I set several variables using macros defined in the style file, such as my name and the company information of the company that provided the assignment. After the beginning of the document, the function maketitlepages
is called from the style file, which creates several title pages matching the university style.
[edit]
After finding the solution, I now know where the error comes from. Below is a small style file and a small document that can be compiled to recreate the error. In a nutshell, I used includegraphics
to include an image file whose filename contained a space.
example.sty:
\def\company#1{\gdef\@company{#1}}
\def\maketitlepages
{\begingroup
\newpage
\noindent
\begin{center}
\vskip 0em \rule{\textwidth}{1.5pt}
\vskip 1em {\Huge \@title \par}
\vskip 1em \rule{\textwidth}{1.5pt} \par \nobreak
\vskip 4em {\large A DOCUMENT}
\vskip 2em by
\vskip 2em {\large \@author}
\vfill
\@company
\end{center}
\newpage
\endgroup}
document.tex:
\documentclass{article}
\usepackage{url}
\usepackage{example}
\usepackage[dvips]{graphicx}
\usepackage[dvips]{color}
\author{Your name}
\company{
\includegraphics[width=4cm]{company logo.eps}\\
A Company\\
Addressline 1\\
Addressline 2\\
Country\\
\url{www.acompany.com}
}
\title{Undefined control sequence}
\begin{document}
\pagestyle{empty}
\maketitlepages
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我们可以看到
mscthesis.sty
的相关部分吗?我(否则不知情)猜测这就是错误所在 - 我怀疑当它定义\makeformaltitlepages
时,它使用该命令。Can we see the relevant part of
mscthesis.sty
? My (otherwise uninformed) guess is that's where the error is -- I suspect that when it defines\makeformaltitlepages
, it uses that command.我们需要的是一个显示问题的完整示例(即从 \documentclass{...} 开始一直到 \end{document})。很可能你的其中一句“胡言乱语”很重要。 (这可能在 LaTeX 社区论坛等地方得到更好的答案。)
What we need is a complete example showing the problem (i.e. starting with \documentclass{...} and going through to \end{document}). Quite possibly one of your "gibberish lines" are important. (This is probably better answered somewhere like The LaTeX Community forums.)