为什么同时排版索引index和术语表glossaries,术语表printglossaries显示不出来?
\documentclass[UTF8]{ctexbook}
% ==================== 索引排版 ====================
\usepackage[xindy]{imakeidx}
%--------------------名称汉化--------------------
\renewcommand*{\see}[2]{{\kaishu 参见}#1}
\renewcommand*{\seealso}[2]{{\kaishu 又见}#1}
%--------------------制作名词索引--------------------
\makeindex[%
name=nouns, % 索引文件名(默认为 \jobname,即主文件名)
title={名词索引}, % 索引表标题(默认为 \indexname)
intoc=true, % 加入目录(默认为 false,不加入目录)
columns=2, % 分栏(默认为 1)
columnsep=1cm, % 栏间距(默认为 35pt)
columnseprule=true, % 分栏线(默认为 false)
program=makeindex, % 调用的索引程序(或用 xindy、texindy)
%options={-s NewBook.ist}, % 索引程序的选项(默认为空)
noautomatic=false % 不自动调用索引程序(默认为 false)
]
%--------------------制作人名索引--------------------
\makeindex[%
name=persons, % 索引文件名(默认为 \jobname,即主文件名)
title={人名索引}, % 索引表标题(默认为 \indexname)
intoc=true, % 加入目录(默认为 false,不加入目录)
columns=2, % 分栏(默认为 1)
columnsep=1cm, % 栏间距(默认为 35pt)
columnseprule=true, % 分栏线(默认为 false)
program=makeindex, % 调用的索引程序(或用 xindy、texindy)
%options={-s NewBook.ist}, % 索引程序的选项(默认为空)
noautomatic=false % 不自动调用索引程序(默认为 false)
]
\usepackage[toc]{glossaries}
\makeglossaries
%-------------------标题汉化-------------------
\renewcommand*{\glossaryname}{术语表}
\renewcommand*{\entryname}{术语}
\renewcommand*{\descriptionname}{释义}
\renewcommand*{\pagelistname}{页码}
\renewcommand*{\acronymname}{缩略语}
\renewcommand*{\glssymbolsgroupname}{符号表}
\begin{document}
\tableofcontents
\chapter{title}
% ==================== 20 条术语 ====================
% 1-5:基础排版
\newglossaryentry{sec}{
name=分节(Section),
description={将文档划分为章、节、小节等层级结构的基本单元}
}
\newglossaryentry{chap}{
name=章节(Chapter),
description={书籍或长文档中最高层级的划分单位}
}
\newglossaryentry{para}{
name=段落(Paragraph),
description={由若干句子组成、表达一个完整意思的文字单元}
}
\newglossaryentry{sent}{
name=句子(Sentence),
description={表达完整意思、带有标点符号的语言基本单位}
}
\newglossaryentry{word}{
name=词语(Word),
description={语言中能够独立运用的最小单位}
}
% 6-10:排版术语
\newglossaryentry{font}{
name=字体(Font),
description={具有特定样式、大小和粗细的文字显示形式}
}
\newglossaryentry{italic}{
name=斜体(Italic),
description={向右倾斜的字体样式,常用于强调或引用}
}
\newglossaryentry{bold}{
name=粗体(Bold),
description={笔画加粗的字体样式,用于标题或重点强调}
}
\newglossaryentry{serif}{
name=衬线(Serif),
description={笔画末端带有装饰性衬线的字体类型}
}
\newglossaryentry{sans}{
name=无衬线(Sans Serif),
description={笔画末端无装饰性衬线的字体类型}
}
% 11-15:文档结构
\newglossaryentry{toc}{
name=目录(Table of Contents),
description={列出文档各章节标题及其对应页码的索引}
}
\newglossaryentry{lof}{
name=图目录(List of Figures),
description={列出文档中所有插图标题及其页码的索引}
}
\newglossaryentry{lot}{
name=表目录(List of Tables),
description={列出文档中所有表格标题及其页码的索引}
}
\newglossaryentry{bib}{
name=参考文献(Bibliography),
description={列出文档中引用过的所有文献的清单}
}
\newglossaryentry{idx}{
name=索引(Index),
description={按字母顺序排列的关键词及其出现位置列表}
}
% 16-20:数学与符号
\newglossaryentry{set}{
name=集合(Set),
description={由若干互不相同的元素组成的整体}
}
\newglossaryentry{func}{
name=函数(Function),
description={从一个集合到另一个集合的映射关系}
}
\newglossaryentry{var}{
name=变量(Variable),
description={在运算过程中可以取不同数值的量}
}
\newglossaryentry{const}{
name=常量(Constant),
description={在运算过程中数值保持不变的量}
}
\newglossaryentry{term}{
name=术语(Terminology),
description={某一学科或专业领域中使用的专门用语}
}
\gls{term}是学术写作的基础。在撰写长篇文档时,合理的\gls{sec}和\gls{chap}结构至关重要。
\gls{sent}由\gls{word}组成,多个\gls{para}构成完整论述。排版中常用\gls{bold}和\gls{italic}进行强调,\gls{serif}与\gls{sans}则是两类基本字体。
\gls{toc}、\gls{lof}和\gls{lot}帮助读者快速定位内容,\gls{bib}和\gls{idx}则是学术规范的重要组成部分。
数学排版中,\gls{set}、\gls{func}、\gls{var}和\gls{const}是最基础的概念。
索引示例\index{LaTeX}\index{术语表}
\index[persons]{刘徽|see{九章算术}}
\index[nouns]{电话} % 主词条,有页码
\index[nouns]{Telephone|see{电话}} % 外文别名
\index[nouns]{德律风|see{电话}} % 旧称别名
\printglossaries
\printindex[nouns] % 输出名词索引
\printindex[persons] % 输出人名索引
\end{document}

我尝试了一下,正确的逐次编译命令可以是:
xelatex mwe.tex
makeglossaries mwe
makeindex -o nouns.ind nouns.idx
makeindex -o persons.ind persons.idx
xelatex mwe.tex
xelatex mwe.tex
注意这里的「makeglossaries mwe」这个命令是不会 自动 被「latexmk」接管的(可以通过latexmkrc来控制),可以找一个「最简单的makeglossaries」的例子试试,然后再看看texstudio要如何编译出「术语表」。
对于这类比较完整的书籍项目,可以考虑模仿「lshort-zh-cn」等项目(让ai辅助)写一个项目级别的latexmkrc文件,这样只要把默认recipe设置为latexmk则可以高枕无忧了...
另外我有一个小疑惑...
和两处
中的
program=makeindex是...何意味... 后端怎么又xindy又makeindex的...