我对 Latex [pdfTeX,版本 3.14159265-2.6-1.40.17 (MiKTeX 2.9 64 位)] 和词汇表有疑问。我曾尝试编写词汇表、首字母缩略词列表和符号列表(后者请参阅此链接: 词汇表:如何自定义带有单位附加列的符号列表?),一切似乎都正确,但我有以下错误:
Undefined control sequence. \glsXpageXglsnumberformat{}{1}}}
我尝试根据 Miede 的 ClassicThesis 简化我的代码。希望足够或不过分:我无法说出对您有什么帮助,对此我深表歉意,我是 Latex 和此网站的新用户。
论文2.tex:
% A Classic Thesis Style
\RequirePackage{fix-cm}
\documentclass[ twoside]{scrreprt} % Classe: Report
\input{Thesis-config2}
\begin{document}
%\dominitoc
\frenchspacing
\raggedbottom
\selectlanguage{English} % american ngerman
%\renewcommand*{\bibname}{new name}
%\setbibpreamble{}
\pagenumbering{roman}
\pagestyle{plain}
\cleardoublepage\include{FrontBackmatter/Contents2}
\cleardoublepage\pagenumbering{arabic}
\setcounter{page}{1}
The \gls{latex} typesetting markup ... other glossary \gls{other}
Given a set of numbers, there are elementary methods to compute
its \acrlong{gcd}, which is abbreviated \acrshort{gcd}. This
process is similar to that used for the \acrfull{gcd} \\
This is height \gls{height} and this velocity \gls{velocity}
\end{document}
论文-config2.txt
\PassOptionsToPackage{parts,%drafting,%
listings,floatperchapter,%linedheaders,%
subfig,eulerchapternumbers,beramono,eulermath,pdfspacing}
{classicthesis}
\usepackage{classicthesis}
% 3. Load packages
\usepackage[utf8]{inputenc} % Encoding inputs
\usepackage[italian,english]{babel} % Select language (last most used)
\usepackage[T1]{fontenc} % T2A for cyrillics
\newcounter{dummy} % necessary for correct hyperlinks (to index, bib, etc.)
\usepackage{siunitx} % International system units
% 4. Setup floats: tables, (sub)figures, and captions
\usepackage{tabularx} % better tables
\setlength{\extrarowheight}{3pt} % increase table row height
\newcommand{\tableheadline}[1]{\multicolumn{1}{c}{\spacedlowsmallcaps{#1}}}
\newcommand{\myfloatalign}{\centering} % to be used with each float for alignment
\usepackage{caption} % Ita: didascalie
\captionsetup{font=small} % format=hang,
\usepackage{subfig}
% 6. PDFLaTeX, hyperreferences and citation backreferences
% Using PDFLaTeX
\PassOptionsToPackage{pdftex,hyperfootnotes=false,pdfpagelabels}{hyperref}
\usepackage{hyperref} % backref linktocpage pagebackref
\pdfcompresslevel=9
\pdfadjustspacing=1
\PassOptionsToPackage{pdftex}{graphicx}
\usepackage{graphicx}
% Glossary, list of symbols and nomenclature
\usepackage[nonumberlist,nopostdot,acronym,xindy]{glossaries}
\setlength{\glsdescwidth}{15cm}
\newglossary[slg]{symbolslist}{syi}{syg}{List of Symbols} % create add. symbolslist
\glsaddkey{unit}{\glsentrytext{\glslabel}}{\glsentryunit}{\GLsentryunit}{\glsunit}{\Glsunit}{\GLSunit} % Inserts unit column
\makeglossaries
\input{glossary-defs}
\newglossarystyle{symbunitlong}{%
\setglossarystyle{long3col}% base this style on the list style
\renewenvironment{theglossary}{% Change the table type --> 3 columns
\begin{longtable}{lp{0.6\glsdescwidth}>{\centering\arraybackslash}p{2cm}}}%
{\end{longtable}}%
%
\renewcommand*{\glossaryheader}{% Change the table header
\bfseries Sign & \bfseries Description & \bfseries Unit \\
\hline
\endhead}
\renewcommand*{\glossentry}[2]{% Change the displayed items
\glstarget{##1}{\glossentryname{##1}} %
& \glossentrydesc{##1}% Description
& \glsunit{##1} \tabularnewline
}
}
内容2.tex
% Table of Contents
%*******************************************************
\refstepcounter{dummy} % to refere to a chapter not numbered
\pdfbookmark[1]{\contentsname}{tableofcontents} % bookmark to the table of contents
\setcounter{tocdepth}{2} % <-- 2 includes up to subsections in the ToC
\setcounter{secnumdepth}{3} % <-- 3 numbers up to subsubsections
\manualmark
\markboth{\spacedlowsmallcaps{\contentsname}}{\spacedlowsmallcaps{\contentsname}}
\tableofcontents % makes the table of contents
\automark[section]{chapter}
\renewcommand{\chaptermark}[1]{\markboth{\spacedlowsmallcaps{#1}}{\spacedlowsmallcaps{#1}}}
\renewcommand{\sectionmark}[1]{\markright{\thesection\enspace \spacedlowsmallcaps{#1}}}
\cleardoublepage
% List of Figures
\phantomsection
\refstepcounter{dummy}
\addcontentsline{toc}{chapter}{\listfigurename}
% \pdfbookmark[1]{\listfigurename}{lof}
\listoffigures
%\cleardoublepage
%*******************************************************
% List of Tables
\phantomsection
\refstepcounter{dummy}
\addcontentsline{toc}{chapter}{\listtablename}
% \pdfbookmark[1]{\listtablename}{lot}
\listoftables
%\cleardoublepage
%*******************************************************
% List of Listings
\phantomsection
\refstepcounter{dummy}
\addcontentsline{toc}{chapter}{\lstlistlistingname}
%\pdfbookmark[1]{\lstlistlistingname}{lol}
\lstlistoflistings
%\cleardoublepage
%*******************************************************
% Acronyms
\phantomsection
\refstepcounter{dummy}
\addcontentsline{toc}{chapter}{List of Acronyms}
% \pdfbookmark[0]{Acronyms}{acronyms}
% \markboth{\spacedlowsmallcaps{Acronyms}}{\spacedlowsmallcaps{Acronyms}}
\printglossary[type=\acronymtype,style=long] % list of acronyms
%\cleardoublepage
%*******************************************************
% List of symbols
\phantomsection
\refstepcounter{dummy}
\addcontentsline{toc}{chapter}{List of Symbols}
\printglossary[type=symbolslist,style=symbunitlong] % list of symbols
%\cleardoublepage
%*******************************************************
% Glossary
\phantomsection
\refstepcounter{dummy}
\addcontentsline{toc}{chapter}{Glossary}
% \pdfbookmark[0]{Glossary}{glossary}
\markboth{\spacedlowsmallcaps{Glossary}}{\spacedlowsmallcaps{Glossary}}
\printglossary[type=main] % main glossary
% \cleardoublepage
词汇表-defs.tex
\newacronym{gcd}{GCD}{Greatest Common Divisor}
\newglossaryentry{latex}
{
name=latex,
description={Is a mark up language specially suited
for scientific document}
}
\newglossaryentry{other}
{
name=other,
description={example of description }
}
\newglossaryentry{height}{name=\ensuremath{h},
description={Height of tower},
unit={\si{m}},
type=symbolslist}
\newglossaryentry{velocity}{name=\ensuremath{V},
description={Velocity},
unit={\si{m/s}},
type=symbolslist}
我的问题是:
- 那是什么错误?为什么尽管有错误,但 PDF 看起来是正确的?
- 为什么词汇表名称以这种方式显示?(例如 lo@latex@name)
梅威瑟:
\documentclass[twoside]{scrreprt}
\usepackage{classicthesis}
\usepackage{hyperref}
\usepackage[nonumberlist,nopostdot,xindy]{glossaries}
\makeglossaries
\newglossaryentry{latex}
{
name=latex,
description={Is a mark up language specially suited
for scientific document}
}
\newglossaryentry{other}
{
name=other,
description={example of description }
}
\begin{document}
\printglossary
The \gls{latex} typesetting markup ... other glossary \gls{other}
\end{document}
答案1
总结:大多数(但不是全部)样式list
与 不兼容classicthesis
,因此需要切换样式。
问题是由于 的方式\item
被重新定义为而引起的classicthesis
。以下是精简的 MWE:
\documentclass[twoside]{scrreprt}
\usepackage{classicthesis}
\usepackage[nonumberlist,nopostdot,xindy]{glossaries}
\makeglossaries
\newglossaryentry{latex}
{
name=latex,
description={Is a mark up language specially suited
for scientific document}
}
\begin{document}
\begin{description}
\item[\glossentryname {latex}] sample
\end{description}
\end{document}
使用classicthesis
,会产生错误:
! Undefined control sequence.
<argument> \letcs {\glo@name
}{glo@\glsdetoklabel{latex}@name}\expandafter ...
l.23 \item[\glossentryname {latex}]
sample
如果没有classicthesis
,则不会出现错误。似乎classicthesis
试图扩展标签的参数。保护脆弱的命令可以解决问题:
\documentclass[twoside]{scrreprt}
\usepackage{classicthesis}
\usepackage[nonumberlist,nopostdot,xindy]{glossaries}
\makeglossaries
\newglossaryentry{latex}
{
name=latex,
description={Is a mark up language specially suited
for scientific document}
}
\begin{document}
\begin{description}
\item[\protect\glossentryname {latex}] sample
\end{description}
\end{document}
由于\item
嵌入在词汇表样式中,最简单的方法是使用不同的样式。例如:
\printglossary[style=index]
另一种方法是定义一种样式来保护 的可选参数中的所有命令\item
。例如:
\documentclass[twoside]{scrreprt}
\usepackage{classicthesis}
\usepackage[nonumberlist,nopostdot,xindy]{glossaries}
\makeglossaries
\newglossaryentry{latex}
{
name=latex,
description={Is a mark up language specially suited
for scientific document}
}
\newglossarystyle{plist}
{%
\setglossarystyle{list}%
\renewcommand*{\glossentry}[2]{%
\item[\protect\glsentryitem{##1}%
\protect\glstarget{##1}{\protect\glossentryname {##1}}]
\glossentrydesc{##1}\glspostdescription \space ##2%
}%
}
\begin{document}
\printglossary[style=plist]
\gls{latex}
\end{document}
我不太推荐这种方法,因为您不太可能想要收集\glsentrytarget
命令\glsentryitem
以供日后使用,因为它们特定于词汇表。(\glsentrytarget
提供超目标,它必须是唯一的,并且\glsentryitem
依赖于词汇表中重置和递增的计数器。)
回答您的第二个问题\glo@latex@name
是用于存储name
带有标签的条目的键值的内部命令latex
。您永远不需要明确使用它。(可以使用简单地获取此值\glsentryname{latex}
。)
编辑:从 v4.26 开始,glossaries
现在会检查是否classicthesis
已加载。如果已加载,则默认样式将从 切换为list
,index
这是最接近的匹配样式。
请注意,nolist
另一个答案中提到的选项只是阻止了自动加载glossary-list.sty
。它不会自动切换样式。例如,对于glossaries
v4.26 之前的版本:
\documentclass[twoside]{scrreprt}
\usepackage{classicthesis}
\usepackage[nolist]{glossaries}
\makeglossaries
\newglossaryentry{latex}
{
name=latex,
description={Is a mark up language specially suited
for scientific document}
}
\begin{document}
\printglossary
\gls{latex}
\end{document}
错误切换到:
! Package glossaries Error: Glossary style `list' undefined.
实际上,有一种样式glossary-list.sty
与 兼容classicthesis
,即listdotted
样式,与 一起使用时不可用nolist
。关键是选择一种与 兼容的样式classicthesis
。
classicthesis
在无法使用样式的情况下(例如)list
,index
样式是最接近的匹配。请注意,表格样式(例如)long
不允许在描述中分页,因此index
更适合较长的描述。但是,多段描述需要进行调整。
为了进行比较,这里有一个样式示例list
:
\documentclass{scrreprt}
\usepackage[style=list,nopostdot]{glossaries}
\makeglossaries
% sample entries provided by glossaries for testing:
\loadglsentries{example-glossaries-multipar}
\glsaddall
\begin{document}
\printglossary
\end{document}
这是index
经过调整后最接近的匹配样式(至少需要glossaries
v4.26):
\documentclass{scrreprt}
\usepackage[style=index,nopostdot]{glossaries}
\makeglossaries
% adjust "index" style to allow multi-paragraph descriptions:
\renewcommand{\glstreeitem}{%
\parindent0pt\par\hangindent40pt
\everypar{\parindent50pt\hangindent40pt}}
% sample entries provided by glossaries for testing:
\loadglsentries{example-glossaries-multipar}
\glsaddall
\begin{document}
\printglossary
\end{document}
这并不是完全匹配,但相当接近。
样式altlist
在下一行开始描述。以下是示例altlist
:
\documentclass{scrreprt}
\usepackage[style=altlist,nopostdot]{glossaries}
\makeglossaries
% sample entries provided by glossaries for testing:
\loadglsentries{example-glossaries-multipar}
\glsaddall
\begin{document}
\printglossary
\end{document}
最接近的非列表匹配再次是样式index
,但进行了另一项调整(再次需要至少 v4.26):
\documentclass{scrreprt}
\usepackage[style=index,nopostdot]{glossaries}
\makeglossaries
% adjust "index" style to allow multi-paragraph descriptions:
\renewcommand{\glstreeitem}{%
\parindent0pt\par\hangindent40pt
\everypar{\parindent50pt\hangindent40pt}}
\renewcommand{\glstreepredesc}{\par
\glstreeitem\parindent\hangindent}
% sample entries provided by glossaries for testing:
\loadglsentries{example-glossaries-multipar}
\glsaddall
\begin{document}
\printglossary
\end{document}
标签使用的字体的差异源于在环境中使用scrreprt
无衬线字体作为标签的类。由于样式不使用列表环境,因此不受影响。\item
description
index
有一个所有预定义样式的完整列表及示例以供比较。
答案2
我找不到 classicthesis.sty 重新定义与您报告的错误相关的任何内容的具体位置。我找到的是“手册”中的一条注释:如果您想使用词汇表包,请注意使用以下选项加载它:\usepackage[style=long,nolist]{glossaries}。不能把所有事情都归咎于 classicthesis,对吧?
答案3
classicthesis 喜欢在各种地方使用\spacedlowsmallcaps
(和类似的命令),它使用\MakeTextLowercase
和有时(取决于软件包选项)也使用来soul
更改字母间距。\MakeTextLowercase
和soul
命令对于它们的参数都有点挑剔。
在这种情况下,您会得到错误,因为 classicthesis 重新定义\descriptionlabel
为添加此 \spacedlowsmallcaps。您可以重新定义\descriptionlabel
以摆脱错误:
\documentclass[twoside]{scrreprt}
\usepackage{classicthesis}
\renewcommand{\descriptionlabel}[1]{\hspace*{\labelsep}\textls[80]{\scshape{#1}}}
\usepackage[nonumberlist,nopostdot,xindy]{glossaries}
\makeglossaries
\newglossaryentry{latex}
{
name=latex,
description={Is a mark up language specially suited
for scientific document}
}
\begin{document}
\begin{description}
\item[\glossentryname {latex}] sample
\end{description}
\end{document}