저는 상수 목록과 기호 목록이 모두 포함된 보고서를 작성하고 있습니다. 둘 다 다음을 사용하여 정의됩니다.용어집패키지. 문제는 두 번째 목록(이 경우 상수)에는 포함해야 하는 요소뿐만 아니라 첫 번째 목록의 요소(기호)도 포함되어 있다는 것입니다.
이 문제는 순서에 관계없이 발생합니다(교체하면 기호 목록에도 상수가 포함됩니다). 인쇄하는 사이에 일종의 용어집 재설정 명령을 호출해야 한다고 생각하는데 어디서도 찾을 수 없습니다. 이 문제의 원인을 아는 사람이 있나요?
Ubuntu 16.04와 함께 제공되는 TeXLive 전체 배포판을 사용합니다. 다음에 따른 용어집 패키지 버전 \listfiles
: Glossaries.sty 2017/01/19 v4.29
MWE를 준비했습니다. 단 하나의 용어집 스타일만 포함했지만 실제로는 상수 및 기호 목록에 대해 별도의 스타일을 사용했습니다. 이는 단지 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
}
이렇게 수정하면 원하는 결과가 나옵니다.