You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

为何我的LaTeX代码无法输出两个术语表?

问题:使用glossaries包无法生成符号术语表

现象

编译后仅能输出缩写术语表,符号术语表完全不显示;makeindex日志显示已处理符号相关文件,但PDF中无对应内容。

代码示例

\documentclass{article}

% Language setting
% Replace `english' with e.g. `spanish' to change the document language
\usepackage[english]{babel}

% Set page size and margins
% Replace `letterpaper' with `a4paper' for UK/EU standard size
\usepackage[letterpaper,top=2cm,bottom=2cm,left=3cm,right=3cm,marginparwidth=1.75cm]{geometry}

% Useful packages
%Creat Glossary
\usepackage{glossaries}

% Define acronym glossary
\newglossary[alg]{acronym}{acr}{acn}{List of Acronyms}
% Define symbol glossary
\newglossary[sym]{symbol}{sym}{sbl}{List of Symbols}
\makeglossaries

\newglossaryentry{ABC}{
    type=acronym,
    name={ABC},
    description={some description}}

\newglossaryentry{s_l}{
    type=symbol,
    name={\ensuremath{s_l}},
    description={some description}}

\newglossaryentry{s}{
    type=symbol,
    name={\ensuremath{s}},
    description={some description}}


\begin{document}

\begin{equation}
k_{A,eff}=\frac{\gls{s_l}-\gls{s}}{s}
\label{Eq:stress CRC}
\end{equation}

Where \gls{s} \gls{s_l}t.

this is a text \gls{ABC}

% Print the acronym glossary
\printglossary[type=acronym]
% Print the symbol glossary
\printglossary[type=symbol]

\end{document}

编译输出

$k_{A,eff}=\frac{s_l - s}{s} \tag{1}$
Where s slt.
this is a text ABC

List of Acronyms
ABC some description. 1

makeindex日志

This is makeindex, version 2.17 [TeX Live 2023] (kpathsea + Thai support). Scanning style file ./output.ist...........................done (27 attributes redefined, 0 ignored). Scanning input file output.sbl....done (4 entries accepted, 0 rejected). Sorting entries....done (10 comparisons). Generating output file output.sym....done (8 lines written, 0 warnings). Output written in output.sym. Transcript written in output.sym.

问题原因与解决方案

问题出在\newglossary的参数顺序错误:该命令的正确语法为\newglossary{<标签>}{<gls文件扩展名>}{<ist文件扩展名>}{<标题>},你写反了中间两个参数的位置。

原符号术语表定义:

\newglossary[sym]{symbol}{sym}{sbl}{List of Symbols}

需修改为:

\newglossary[sym]{symbol}{sbl}{sym}{List of Symbols}

即交换中间的sym和sbl位置。

另外,方程中直接写的s应改为\gls{s},确保符号被正确索引。

修正后的完整代码:

\documentclass{article}

\usepackage[english]{babel}
\usepackage[letterpaper,top=2cm,bottom=2cm,left=3cm,right=3cm,marginparwidth=1.75cm]{geometry}

\usepackage{glossaries}

% 修正参数顺序
\newglossary[alg]{acronym}{acr}{acn}{List of Acronyms}
\newglossary[sym]{symbol}{sbl}{sym}{List of Symbols}
\makeglossaries

\newglossaryentry{ABC}{
    type=acronym,
    name={ABC},
    description={some description}}

\newglossaryentry{s_l}{
    type=symbol,
    name={\ensuremath{s_l}},
    description={some description}}

\newglossaryentry{s}{
    type=symbol,
    name={\ensuremath{s}},
    description={some description}}

\begin{document}

\begin{equation}
k_{A,eff}=\frac{\gls{s_l}-\gls{s}}{\gls{s}}
\label{Eq:stress CRC}
\end{equation}

Where \gls{s} \gls{s_l}.

this is a text \gls{ABC}

\printglossary[type=acronym]
\printglossary[type=symbol]

\end{document}

修改后重新编译(Overleaf会自动处理多轮编译流程),符号术语表即可正常显示。


内容的提问来源于stack exchange,提问作者bau6020

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.11 00:12:02