Estoy escribiendo un informe con una lista de constantes y una lista de símbolos, ambas definidas usando elglosariospaquete. El problema es que la segunda lista (en este caso constantes) no sólo contiene los elementos que debería contener, sino también los de la primera lista (los símbolos):
Este problema ocurre independientemente del orden (si se intercambian, la lista de símbolos también contendrá las constantes). Creo que tengo que ejecutar algún tipo de comando de restablecimiento del glosario entre imprimirlos, pero no puedo encontrarlo en ninguna parte. ¿Alguien sabe qué causa este problema?
Utilizo la distribución completa de TeXLive que viene con Ubuntu 16.04. Versión del paquete de glosarios según \listfiles
: glosaries.sty 2017/01/19 v4.29
Preparé un MWE. Tenga en cuenta que incluyo solo un estilo de glosario, mientras que en realidad tendría estilos separados para la lista de constantes y símbolos. Esto es sólo para mantener el MWE pequeño. El problema también ocurre con los estilos separados. Aquí está el archivo 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}
Y este es el archivo glspreamble.tex que define los estilos del glosario (normalmente este contendría un estilo separado para la lista de símbolos ya que no tienen un 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}
Respuesta1
Ha asignado una entrada en un glosario a un padre en otro glosario. Entonces romanletter
(en el symbol
glosario) tiene un hijo sym:t
en el symbol
glosario y un hijo con:g
en el constants
glosario. El hijo con:g
hace que su padre romanletter
se agregue a su propio glosario, pero esto también hace que sym:t
se agreguen todas las demás entradas secundarias del padre (en este caso).
Sospecho que en realidad esto es solo un error tipográfico y el padre con:g
debería serlo 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 corrección produce el resultado deseado.