
我想知道在創建術語表條目期間手動配置的任何字段是否可以在巨集或新命令中手動/有意訪問 - 可能採用以下形式:
\newcommand{\expectedFirst}[1]{???}
在哪裡 ? ?將是一個使用 gls 標籤 #1 來獲取預定義字段的定義,例如短、名稱、標籤、長、描述、firstplural 等。
\newcommand{\expectedField}[2]{???}
其中 #1 是標籤字串,#2 表示我想要提取或使其可存取的欄位。
我瀏覽了 .dtx 詞彙表文件,但沒有找到任何看起來像我可以在外部複製的變數創建的巨集定義。看起來確實有趣且可能有用的是追蹤布林值的存在,用於追蹤該術語是否已被呼叫。這個布林值將是我有興趣在自訂巨集中進行比較的另一個變數。
微量元素:
\documentclass{article}
\usepackage[utf8]{inputenc}
\setlength\parindent{0pt}
%=========================================================================================================================================
% PACKAGES REQUIRED FOR GLOSSARIES
%=========================================================================================================================================
% Glossaries must be loaded before amsmath as per details in the following forum answer
% http://tex.stackexchange.com/questions/85696/what-causes-this-strange-interaction-between--and-amsmath
\usepackage[nogroupskip,toc,acronym]{glossaries} % must come after href
\usepackage{scrwfile}%http://www.dickimaw-books.com/cgi-bin/faq.cgi?action=view&categorylabel=glossaries#glsnewwriteexceeded
\makeglossaries
\newglossaryentry{ICPMS}{ type={acronym}, sort={inductively coupled plasma mass spectrometry}, name={ICPMS}, short={ICPMS}, long={inductively coupled plasma mass spectrometry}, first={inductively coupled plasma mass spectrometry (ICPMS)}, description={inductively coupled plasma mass spectrometry} }
\begin{document}
\begin{itemize}
\item \gls{ICPMS}
\item \gls{ICPMS}
%\item \expectedFirst{ICPMS}
\end{itemize}
\end{document}
答案1
透過更仔細地檢查文件以及從原始問題中的評論中獲得的靈感,我發現該glossaries
包可以使用格式類似於\glsentryshort{}
和 的命令來存取某些欄位\glsentrylong{}
。最重要的是,使用這些命令不會人為地觸發計數器,從而阻止適當的首次使用評估。
微量元素:
\documentclass{article}
\usepackage[utf8]{inputenc}
\setlength\parindent{0pt}
%=========================================================================================================================================
% PACKAGES REQUIRED FOR GLOSSARIES
%=========================================================================================================================================
% Glossaries must be loaded before amsmath as per details in the following forum answer
% http://tex.stackexchange.com/questions/85696/what-causes-this-strange-interaction-between--and-amsmath
\usepackage[nogroupskip,toc,acronym]{glossaries} % must come after href
\usepackage{scrwfile}%http://www.dickimaw-books.com/cgi-bin/faq.cgi?action=view&categorylabel=glossaries#glsnewwriteexceeded
\makeglossaries
\newglossaryentry{ICPMS}{ type={acronym}, sort={inductively coupled plasma mass spectrometry}, name={ICPMS}, short={ICPMS}, long={inductively coupled plasma mass spectrometry}, first={inductively coupled plasma mass spectrometry (ICPMS)}, description={inductively coupled plasma mass spectrometry} }
\begin{document}
\begin{itemize}
\item \glsentrylong{ICPMS}
\item \glsentryshort{ICPMS}
\item \glsentryfull{ICPMS}
\item \gls{ICPMS}
\item \gls{ICPMS}
\end{itemize}
\end{document}