如果这个问题已经在某处得到解答,我深表歉意。我一直在尝试用 MikTeX 制作抽认卡,并且安装了该软件包。这是我的示例代码。
\documentclass[frame]{flashcards}
\begin{document}
\begin{flascard}{why}
are you doing this to me
\end{flashcard}
\end{document}
这是我使用 TeXWorks 和 WinEdt 编译时遇到的错误:
This is pdfTeX, Version 3.14159265-2.6-1.40.17 (MiKTeX 2.9 64-bit)
entering extended mode
("C:/Users/Jay/Desktop/Latex/testing 3.tex"
LaTeX2e <2016/03/31> patch level 1
Babel <3.9r> and hyphenation patterns for 75 language(s) loaded.
("C:\Program Files\MiKTeX 2.9\tex\latex\flashcards\flashcards.cls"
Document Class: flashcards 2010/08/13 1.0.1 ([email protected])
("C:\Program Files\MiKTeX 2.9\tex\latex\base\ifthen.sty")
("C:\Program Files\MiKTeX 2.9\tex\latex\base\article.cls"
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
("C:\Program Files\MiKTeX 2.9\tex\latex\base\size10.clo"))
! Undefined control sequence.
\reserved@b ...@onefilewithoptions #1[{\cardpaper
}][{}]\noexpand \@pkgexten...
l.77 \setlength
{\oddevenshift}{\oddoffset}
?
更具体地说,当我单击 TeXWorks 中的警告和错误选项卡时,它会显示以下内容:
flashcards.cls
77
Undefined control sequence.
\reserved@b ...@onefilewithoptions #1[{\cardpaper
}][{}]\noexpand \@pkgexten...
l.77 \setlength
{\oddevenshift}{\oddoffset}
我从今天早上 10 点就开始为此绞尽脑汁。我尝试过的方法包括卸载并重新安装、重启电脑、下载 flashcards 文件夹并将其放入 tex 文件中(老实说,我不知道我是否将其放在了正确的文件夹中)、卸载 MikTeX 2.9 并重新安装最新版本。之前有一次,当我没有手动安装软件包时,它给了我一个错误,告诉我找不到 flashcards.cls。我很困惑,读完 pdf 后,我觉得这对我来说是制作抽认卡的完美设置……有人能帮我告诉我这个错误是什么意思以及如何修复它吗?我将不胜感激!
编辑:上面的代码中我有一个拼写错误。这是我最近在更正后编译的(感谢 Willie Wong):
\documentclass[frame,avery5388]{flashcards}
\begin{document}
\begin{flashcard}{why}
are you doing this to me
\end{flashcard}
\end{document}
以下是它产生的错误:
This is pdfTeX, Version 3.14159265-2.6-1.40.17 (MiKTeX 2.9 64-bit)
entering extended mode
(C:/Users/Jay/Documents/untitled-1.tex
LaTeX2e <2016/03/31> patch level 1
Babel <3.9r> and hyphenation patterns for 75 language(s) loaded.
("C:\Program Files\MiKTeX 2.9\tex\latex\flashcards\flashcards.cls"
Document Class: flashcards 2010/08/13 1.0.1 ([email protected])
("C:\Program Files\MiKTeX 2.9\tex\latex\base\ifthen.sty")
("C:\Program Files\MiKTeX 2.9\tex\latex\base\article.cls"
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
("C:\Program Files\MiKTeX 2.9\tex\latex\base\size10.clo"))
Coudln't find avery5388.cfg, using defualt.
! Undefined control sequence.
\reserved@b ...@onefilewithoptions #1[{\cardpaper
}][{}]\noexpand \@pkgexten...
l.77 \setlength
{\oddevenshift}{\oddoffset}
?
显然,avery5388.cfg
文件未被读取。有人有修复建议吗?
答案1
编辑:对于 MikTeX 用户,显然软件包打包过程中存在错误flashcards
,导致某些关键配置文件被遗漏。快速解决方法是复制以下代码:
\newcommand{\cardpapermode}{portrait}
\newcommand{\cardpaper}{letterpaper}
\newcommand{\cardrows}{3}
\newcommand{\cardcolumns}{1}
\setlength{\cardheight}{3.0in}
\setlength{\cardwidth}{5.0in}
\setlength{\topoffset}{1.0in}
\setlength{\oddoffset}{1.75in}
\setlength{\evenoffset}{1.75in}
将其粘贴到名为的文件中avery5388.cfg
,并将该文件放在与 tex 文件相同的目录中。
或者,您可以使用 TeX 的命令来创建,而不是avery5388.cfg
手动创建filecontents
。为此,只需将 tex 源代码编辑为
\begin{filecontents}{avery5388.cfg}
\newcommand{\cardpapermode}{portrait}
\newcommand{\cardpaper}{letterpaper}
\newcommand{\cardrows}{3}
\newcommand{\cardcolumns}{1}
\setlength{\cardheight}{3.0in}
\setlength{\cardwidth}{5.0in}
\setlength{\topoffset}{1.0in}
\setlength{\oddoffset}{1.75in}
\setlength{\evenoffset}{1.75in}
\end{filecontents}
\documentclass[frame,avery5388]{flashcards}
\begin{document}
\begin{flashcard}{why}
are you doing this to me
\end{flashcard}
\end{document}
原则上,编译上述代码应该会自动创建必要的.cfg
文件(如果该文件不存在)。
根据手动的,使用文档类时必须指定纸张大小flashcards
。该类预定义了两种大小,其中一种用于avery5388
索引卡(另一种用于名片大小的卡片)。手册中有关于如何定义自定义大小卡片的完整说明。
您的错误消息表明命令序列
\cardpaper
未定义。如果您未定义纸张尺寸(阅读.cls
文件代码),就会发生这种情况。(没有定义默认值有点搞笑,但无论如何。)
因此修复你的代码以读取
\documentclass[frame,avery5388]{flashcards}
\begin{document}
\begin{flashcard}{why}
are you doing this to me
\end{flashcard}
\end{document}
它建造得很好
[Fri Jul 29 10:12 AM] ArchDesktop ~/tmp $ pdflatex t.tex
This is pdfTeX, Version 3.14159265-2.6-1.40.16 (TeX Live 2015/Arch Linux) (preloaded format=pdflatex)
restricted \write18 enabled.
entering extended mode
(./t.tex
LaTeX2e <2015/10/01> patch level 2
Babel <3.9m> and hyphenation patterns for 79 languages loaded.
(/usr/share/texmf-dist/tex/latex/flashcards/flashcards.cls
Document Class: flashcards 2010/08/13 1.0.1 ([email protected])
(/usr/share/texmf-dist/tex/latex/base/ifthen.sty)
(/usr/share/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/share/texmf-dist/tex/latex/base/size10.clo))
(/usr/share/texmf-dist/tex/latex/flashcards/avery5388.cfg)
(/usr/share/texmf-dist/tex/latex/geometry/geometry.sty
(/usr/share/texmf-dist/tex/latex/graphics/keyval.sty)
(/usr/share/texmf-dist/tex/generic/oberdiek/ifpdf.sty)
(/usr/share/texmf-dist/tex/generic/oberdiek/ifvtex.sty)
(/usr/share/texmf-dist/tex/generic/ifxetex/ifxetex.sty))) (./t.aux)
*geometry* driver: auto-detecting
*geometry* detected driver: pdftex
[1{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] [2] (./t.aux) )</usr/sha
re/texmf-dist/fonts/type1/public/amsfonts/cm/cmbx12.pfb></usr/share/texmf-dist/
fonts/type1/public/amsfonts/cm/cmr10.pfb>
Output written on t.pdf (2 pages, 21254 bytes).
Transcript written on t.log.
带有输出(2 页,在我的图像查看器中裁剪得有些不均匀)