我按照这个答案,除了我的首字母缩略词列表和一般词汇表之外,还添加了一个单独的符号列表: 词汇表:如何自定义带有单位附加列的符号列表?
作为文本中第一次出现的内容,我希望看到绝对湿度(AH),而接下来出现的内容只有 AH,但是当我添加
first={Absolute Humidity (AH)}
到代码中,它只是忽略了它。添加 text={Absolute Humidity (AH)} 有效,但我的所有引用都在这个长变体中。我在 main.tex 中的以下代码中引用它
\documentclass[a4paper,10pt,twoside]{report}
\usepackage[acronym,nopostdot,toc,section=chapter]{glossaries}
\newglossary[slg]{symbolslist}{syi}{syg}{Symbolslist} % create symbolslist
% Glossary settings
\glsaddkey{unit}{\glsentrytext{\glslabel}}{\glsentryunit}{\GLsentryunit}{\glsunit}{\Glsunit}{\GLSunit}
\makeglossaries
\loadglsentries{glossary}
\newglossarystyle{symbunitlong}{%
\setglossarystyle{long3col}% base this style on the list style
\renewenvironment{theglossary}{% Change the table type --> 3 columns
\begin{longtable}{p{2cm}p{10.92cm}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
}
}
\begin{document}
In text reference of first appearance of the term \gls{AH}, second appearence \gls{AH}.
%Print the glossary
\glsaddall
%\printglossaries % print all in default values
\printglossary[type=\acronymtype, style=list, nonumberlist] % prints just the list of acronyms
\printglossary[type=symbolslist, style=symbunitlong] % list of symbols
\printglossary[style=altlist,nonumberlist ] % if no option is supplied the default glossary is printed.
\end{document}
我的 glossay.tex 文件如下所示
\newglossaryentry{AH}{type=symbolslist,
name={AH},
description={Absolute Humidity.},
unit={$g/m^3$}}
我该如何解决这个问题?
答案1
这是最简单的方法(鉴于AH
本质上是一种缩写):
\documentclass[a4paper,10pt,twoside]{report}
\usepackage[acronym,nopostdot,toc,section=chapter,acronymlists={acronym,symbolslist}]{glossaries}
\newglossary[slg]{symbolslist}{syi}{syg}{Symbolslist} % create symbolslist
% Glossary settings
\glsaddkey{unit}{\glsentrytext{\glslabel}}{\glsentryunit}{\GLsentryunit}{\glsunit}{\Glsunit}{\GLSunit}
\makeglossaries
\setacronymstyle{long-short}
\newglossarystyle{symbunitlong}{%
\setglossarystyle{long3col}% base this style on the list style
\renewenvironment{theglossary}{% Change the table type --> 3 columns
\begin{longtable}{p{2cm}p{10.92cm}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
}
}
\newacronym[type=symbolslist,unit={$g/m^3$}]{AH}{AH}{Absolute Humidity}
\begin{document}
In text reference of first appearance of the term \gls{AH}, second
appearence \gls{AH}.
%Print the glossary
\glsaddall
%\printglossaries % print all in default values
\printglossary[type=\acronymtype, style=list, nonumberlist] % prints just the list of acronyms
\printglossary[type=symbolslist, style=symbunitlong] % list of symbols
\printglossary[style=altlist,nonumberlist ] % if no option is supplied the default glossary is printed.
\end{document}