Estou escrevendo um relatório com uma lista de constantes e uma lista de símbolos, ambas definidas usando oglossáriospacote. O problema é que a segunda lista (neste caso constantes) não contém apenas os elementos que deveria conter, mas também os da primeira lista (os símbolos):
Este problema ocorre independentemente da ordem (se eles forem trocados, a lista de símbolos também conterá as constantes). Acho que preciso chamar algum tipo de comando de redefinição de glossário entre imprimi-los, mas não consigo encontrá-lo em lugar nenhum. Alguém sabe o que causa esse problema?
Eu uso a distribuição completa do TeXLive que vem com o Ubuntu 16.04. Versão do pacote de glossários de acordo com \listfiles
: glossaries.sty 19/01/2017 v4.29
Eu preparei um MWE. Observe que incluo apenas um estilo de glossário, embora na realidade eu teria estilos separados para lista de constantes e símbolos. Isso é apenas para manter o MWE pequeno. O problema também ocorre com os estilos separados. Aqui está o arquivo 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}
E este é o arquivo glspreamble.tex que define os estilos do glossário (normalmente conteria um estilo separado para a lista de símbolos, pois eles não possuem valor)
% 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}
Responder1
Você atribuiu uma entrada em um glossário a um pai em outro glossário. Então romanletter
(no symbol
glossário) tem um filho sym:t
no symbol
glossário e um filho con:g
no constants
glossário. O filho con:g
faz com que seu pai romanletter
seja adicionado ao seu próprio glossário, mas isso também faz com que todas as outras entradas filho do pai ( sym:t
neste caso) sejam adicionadas.
Eu suspeito que isso seja apenas um erro de digitação e o pai de con:g
deveria ser 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
}
Esta correção produz o resultado desejado.