在使用 .bib 檔案的論文中使用「符號清單」時出錯?

在使用 .bib 檔案的論文中使用「符號清單」時出錯?

我希望使用一種有效的方法來建立術語表,並能夠對不同清單中不同「類型」的條目進行分類(縮寫、首字母縮寫、符號、術語表等)。

我關注了兩篇非常棒的帖子,我建議它們:

第一,展示如何使用符號的 .bib 檔案對不同條目進行分類。我按照方法4進行操作。第二篇文章展示如何遵循此方法產生包含符號、首字母縮寫、定義等的術語表。

我是 LaTex 的新手,但透過遵循這些方法我學到了很多東西(非常感謝 Nicola Talbot)。我已經快到了,但結果仍然有一些錯誤。我創建了測試文件來測試我想要實現的目標。

這是我正在測試的程式碼:

\documentclass{report}

\usepackage{amssymb}
\usepackage{siunitx}


\usepackage[record,abbreviations,acronyms,symbols,stylemods={tree},style=treegroup]{glossaries-extra}


% always set the abbreviation style before \GlsXtrLoadResources
\setabbreviationstyle{short-long-desc}
\setabbreviationstyle[acronym]{short-long}


% Assign group titles:
\glsxtrsetgrouptitle{latin}{Latin Symbols}
\glsxtrsetgrouptitle{greek}{Greek Symbols}

\GlsXtrLoadResources[
  src={no-interpret-preamble,glossary},% bib files
  sort={en-US},% sort according to this locale
  set-widest,% needed for 'alttree' styles
%  save-locations=false % use this command to pring only the acronyms you are using
  selection=all% select all entries in the .bib files
]


\GlsXtrLoadResources[
 src={symbols-greek},
 sort={letter-case}, % sort according Unicode value
 field-aliases={
   unitname=name,
   unitsymbol=symbol,
   measurement=description
 },
 symbol-sort-fallback=name,
 type=symbols,
 group=greek,
 set-widest,% needed for 'alttree' styles
 save-locations=false % pring only used symbols.
]

\GlsXtrLoadResources[
 src={symbols-latin},
  sort={letter-case},% sort according Unicode value
  symbol-sort-fallback=name,
  type=symbols,
  group=latin,
  set-widest,% needed for 'alttree' styles
  selection=all% select all entries in the .bib files
]




\begin{document}

\section*{Examples}
In this section, I will use the following greek symbols: \gls{alpha}, \gls{alphalin} and \gls{delta}.

One acronym is for example \glstext{ad} and one abbreviation is given by \glstext{html}.



\printunsrtglossary[type=acronyms,style=alttree,title={List of Acronyms}]
\printunsrtglossary[type=abbreviations,style=alttree,title={List of Abbreviations}]
\printunsrtglossary[style=alttree,title={Glossary}] % By not specifing the type, I pring only the entries
\printunsrtglossary[type=symbols,style=alttreegroup,title={List of Symbols}]
\end{document}

你可以找到該文件no-interpret-preamble.bib這裡。文件glossary.bibsymbols-latin.bib看起來symbols-greek.bib像這樣(靈感來自 Nicola Talbot 的作品):

詞彙表.bib:

% glossary.bib

% This file is public domain. See the "Examples" chapter
% in the bib2gls user manual for a more detailed description
% of this file.

% Encoding: UTF-8

@preamble{"\providecommand{\abbrvtag}[1]{#1}"}
@string{markuplang="\abbrvtag{m}arkup \abbrvtag{l}anguage"}

@entry{TeX,
  name={{}\TeX},
  description={a format for describing complex type and page layout
    often used for mathematics, technical, and academic publications},
  identifier={markuplanguage}
}

@entry{LaTeX,
  name={{}\LaTeX},
  description={a format of \glstext{TeX} designed to separate
   content from style},
  identifier={markuplanguage}
}

@entry{markdown,
  name={markdown},
  description={a lightweight markup language with plain text
    formatting syntax},
  identifier={markuplanguage}
}


@acronym{ad,
  short={AD},
  long={Affinity Diagram},
  description={Tool that gathers large amounts of language data and organizes them into groupings based on their natural relationships},
  identifier={acronym}
}

@acronym{dom,
  short={DOM},
  long={Document Object Model},
  description={Cross-platform and language-independent application programming interface},
  identifier={acronym}
}


@acronym{spa,
  short={SPA},
  long={Single Page Application},
  description={Web applicaiton of web site that interacts with the user by dynanically rewriting the current page},
  identifier={acronym}
}


@acronym{svp,
  short={SVG},
  long={Scalable Vector Graphics},
  description={{}\glstext{xml}-based vector image format for two-dimensional graphics with support for interactivity and animation},
  identifier={acronym}
}

@abbreviation{xml,
  short={XML},
  long={e\abbrvtag{x}tensible }#markuplang,
  description={a markup language that defines a set of rules for
    encoding documents},
  identifier={markuplanguage}
}

@abbreviation{html,
  short={HTML},
  long={\abbrvtag{h}yper\abbrvtag{t}ext }#markuplang,
  description={the standard markup language for creating web pages},
  identifier={markuplanguage}
}

@abbreviation{mathml,
  short={MathML},
  long={\abbrvtag{m\NoCaseChange{ath}}ematical }#markuplang,
  description={markup language for describing mathematical notation},
  identifier={markuplanguage}
}

@abbreviation{xhtml,
  short={XHTML},
  long={e\abbrvtag{x}tensible \abbrvtag{h}yper\abbrvtag{t}ext }
    # markuplang,
  description={{}\glstext{xml} version of \glstext{html}},
  identifier={markuplanguage}
}

符號-希臘文.bib:

% symbols-greek.bib

% Put here all greek symbols
% Encoding: UTF-8

@symbol{alpha,
 name={\ensuremath{\alpha}},
 description={angular acceleration},
 indentifier={mathgreek}
}
@symbol{alphalin,
 name={\ensuremath{\alpha_{L}}},
 description={linear coefficient of thermal expansion},
 indentifier={mathgreek}
}
@symbol{delta,
 name={\ensuremath{\delta}},
 description={Kronecker delta},
 indentifier={mathgreek}
}
@symbol{lambda,
 name={\ensuremath{\lambda}},
 description={Lagrange multiplier},
 indentifier={mathgreek}
}
@symbol{chi,
 name={\ensuremath{\chi}},
 description={chromatic number},
 indentifier={mathgreek}
}
@symbol{rho,
 name={\ensuremath{\rho}},
 description={density},
 indentifier={mathgreek}
}
@symbol{zeta,
 name={\ensuremath{\zeta}},
 description={Riemann zeta function},
 indentifier={mathgreek}
}

符號-拉丁文.bib:

% symbols-latin.bib

% Put here all latin symbols
% Encoding: UTF-8

@symbol{x,
 name={\ensuremath{x}},
 description={position},
 indentifier={mathlatin}
}
@symbol{v,
 name={\ensuremath{v}},
 description={velocity},
 indentifier={mathlatin}
}
@symbol{a,
 name={\ensuremath{a}},
 description={acceleration},
 indentifier={mathlatin}
}
@symbol{t,
 name={\ensuremath{t}},
 description={time},
 indentifier={mathlatin}
}
@symbol{E,
 name={\ensuremath{E}},
 description={Young's modulus},
 indentifier={mathlatin}
}
@symbol{F,
 name={\ensuremath{F}},
 description={force},
 indentifier={mathlatin}
}
@symbol{Tm,
 name={\ensuremath{T_{m}}},
 description={melting point temperature},
 indentifier={mathlatin}
}
@symbol{KIC,
 name={\ensuremath{K_{IC}}},
 description={stress intensity factor},
 indentifier={mathlatin}
}
@symbol{Z,
 name={\ensuremath{Z}},
 description={atomic number},
 indentifier={mathlatin}
}

然而,所獲得的結果並不令人滿意。

我究竟做錯了什麼?為什麼我無法獲得縮寫列表?如何使縮寫列表易於閱讀?

我將非常感謝你的幫助。我快到了...

答案1

您應該在文字記錄中找到一些警告:

Package glossaries-extra Warning: Glossary type `acronyms' doesn't exist on input line 65.
Package glossaries-extra Warning: No entries defined in glossary `acronyms' on input line 65.

縮寫術語表的標籤不是,acronym所以acronyms您需要:

\printunsrtglossary[type=acronym,style=alttree,title={List of Acronyms}]

或者

\printunsrtglossary[type=\acronymtype,style=alttree,title={List of Acronyms}]

set-widest選項嘗試確定哪個條目具有最寬的名稱,但bib2gls不知道name縮寫詞/首字母縮寫詞(因為它無法訪問文檔中設置的樣式資訊),因此它假設該名稱只是縮寫形式默認情況下,因此在執行測量時不會考慮長格式。但是,該alttree樣式不適合帶有描述的縮寫,因為最終只有很少的空間用於描述。最好使用運行樣式(例如tree)或在描述之前添加中斷的樣式(例如altlist)。

例如:

\printunsrtglossary[type=abbreviations,style=altlist,title={List of Abbreviations}]

順便說一句,最好不要使用\glstext縮寫。如果您只想顯示簡短形式(無論是否使用了縮寫),請與其中使用樣式一起\gls一種short-nolong\glsfmtshort\gls\glstext


1 樣式中存在一個錯誤short-nolong-desc,已在glossaries-extrav1.39 中修復。

相關內容