私は定数のリストとシンボルのリストの両方を含むレポートを書いています。どちらも用語集パッケージ。問題は、2 番目のリスト (この場合は定数) に、含まれるべき要素だけでなく、最初のリストの要素 (シンボル) も含まれていることです。
この問題は順序に関係なく発生します (順序が逆になっている場合、シンボルのリストには定数も含まれます)。印刷の合間に何らかの用語集リセット コマンドを呼び出す必要があると思いますが、どこにも見つかりません。この問題の原因を知っている人はいますか?
私はUbuntu 16.04に付属するTeXLiveフルディストリビューションを使用しています。用語集パッケージのバージョンは\listfiles
glossaries.sty 2017/01/19 v4.29に従っています。
MWE を用意しました。用語集スタイルは 1 つしか含めていませんが、実際には定数とシンボルのリストには別のスタイルを用意します。これは MWE を小さくするためです。問題は、スタイルを分けることでも発生します。main.tex ファイルは次のとおりです。
\documentclass[12pt,a4paper]{article}
\usepackage{glossaries}
%%%%%%% Load the preamble that contains the glossary styles
\input{./Helpers/glspreamble}
%%%%%%% Define entries for the list of acronyms, constants and symbols
\newglossaryentry{con:g}
{
type=constants, % entry should be in the list of constants!
name={\ensuremath{g}}, % Put the symbol here in dollar signs
description={Local gravitational acceleration}, % A brief description of this entry (to appear in the glossary).
user1={\ensuremath{9.81}},
symbol={\ensuremath{\frac{m}{s^2}}}, % put the unit here
sort=g, % for correct sorting type the full name of the symbol here
parent=romanletter % for sorting purposes, use romanletter or greekletter
}
\newglossaryentry{sym:t}
{
type=symbol, % entry should be in the list of symbols!
name={\ensuremath{t}}, % Put the symbol here in dollar signs
description={Time}, % A brief description of this entry (to appear in the glossary).
user1={\ensuremath{-}},
symbol={\ensuremath{s}}, % put the unit here
sort=t, % for correct sorting type the full name of the symbol here
parent=romanletter % for sorting purposes, use romanletter or greekletter
}
\begin{document}
%%%%%%% Print the glossaries
\printnoidxglossary[type=symbol,nonumberlist,style=listoc]
%%%%%%% ----> What should I do here to reset the glossary entries?
\printnoidxglossary[type=constants,nonumberlist,style=listoc]
%%%%%%% Reference an element from every glossary
Reference symbol: \gls{sym:t} \gls{sym:t}\\
Reference constant: \gls{con:g} \gls{con:g}
\end{document}
これは用語集のスタイルを定義する glspreamble.tex ファイルです (通常、シンボルのリストには値がないため、シンボルのリスト用の別のスタイルが含まれます)
% Generate the glossary
% create a new glossary style for the list of constants
% Adapted from http://www.latex-community.org/forum/viewtopic.php?f=5&t=20797
\newglossarystyle{listoc}{%
% \glossarystyle{altlongragged4col}
\setlength{\glsdescwidth}{0.8\textwidth}
% allow line wrap in the description column
\renewenvironment{theglossary}%
{\begin{longtable}{lllp{\glsdescwidth}}}%
{\end{longtable}}%
\renewcommand{\glsgroupskip}{}% make nothing happen between groups
\renewcommand*{\glossaryheader}{%
\bfseries Symbol & \bfseries Value & \bfseries Unit & \bfseries Description \\\endhead}%
% No heading between groups:
\renewcommand*{\glsgroupheading}[1]{}%
% Main (level 0) entries displayed in a row optionally numbered:
\renewcommand*{\glossentry}[2]{%
\glsentryitem{##1}% Entry number if required
\glstarget{##1}{\glossentryname{##1}}% Name
& \glsentryuseri{##2}% Value
& \glossentrysymbol{##2}% Unit
& \glossentrydesc{##2}% Description
\tabularnewline % end of row
}%
% Similarly for sub-entries (no sub-entry numbers):
\renewcommand*{\subglossentry}[3]{%
% ignoring first argument (sub-level)
\glstarget{##2}{\glossentryname{##2}}% Name
& \glsentryuseri{##2}% Value
& \glossentrysymbol{##2}% Unit
& \glossentrydesc{##2}% Description
\tabularnewline % end of row
}%
% Nothing between groups:
\renewcommand*{\glsgroupskip}{}%
}
\newglossary[symbol-glg]{symbol}{symbol-gls}{symbol-glo}{List of Symbols}
\newglossary[constants-glg]{constants}{constants-gls}{constants-glo}{List of Constants}
\makenoidxglossaries
\newglossaryentry{romanletter}{type=symbol,name={},description={\nopostdesc},sort=a}
\newglossaryentry{greekletter}{type=symbol,name={},description={\nopostdesc},sort=b}
\newglossaryentry{romanletterc}{type=constants,name={},description={\nopostdesc},sort=a}
\newglossaryentry{greekletterc}{type=constants,name={},description={\nopostdesc},sort=b}
答え1
ある用語集のエントリを別の用語集の親に割り当てました。そのため、romanletter
(用語集の) 用語集にsymbol
子があり、用語集に子があります。子によって親が子の用語集に追加されますが、これにより、親の他のすべての子エントリ (この場合は) も追加されます。sym:t
symbol
con:g
constants
con:g
romanletter
sym:t
これは単なるタイプミスで、 の親はcon:g
実際には であるべきだと思いますromanletterc
。
\newglossaryentry{con:g}
{
type=constants,
name={\ensuremath{g}},
description={Local gravitational acceleration},
user1={\ensuremath{9.81}},
symbol={\ensuremath{\frac{m}{s^2}}},
sort=g,
parent=romanletterc % <--- correction
}
この修正により、望ましい結果が得られます。