Mehrere Glossare vermischen Einträge: Duplikate im zweiten Glossar

Mehrere Glossare vermischen Einträge: Duplikate im zweiten Glossar

Ich schreibe einen Bericht mit einer Liste von Konstanten und einer Liste von Symbolen, beide definiert mit demGlossarePaket. Das Problem besteht darin, dass die zweite Liste (in diesem Fall Konstanten) nicht nur die Elemente enthält, die sie enthalten sollte, sondern auch die aus der ersten Liste (die Symbole): Die Liste der Konstanten enthält jetzt sowohl die Konstanten als auch die Symbole

Dieses Problem tritt unabhängig von der Reihenfolge auf (wenn sie vertauscht sind, enthält die Symbolliste auch die Konstanten). Ich glaube, ich muss zwischen dem Drucken eine Art Glossar-Reset-Befehl aufrufen, kann ihn aber nirgends finden. Weiß jemand, was dieses Problem verursacht?

Ich verwende die TeXLive-full-Distribution, die mit Ubuntu 16.04 geliefert wird. Glossaries-Paketversion gemäß \listfiles: glossaries.sty 2017/01/19 v4.29

Ich habe ein MWE vorbereitet. Beachten Sie, dass ich nur einen Glossarstil einbinde, obwohl ich in Wirklichkeit separate Stile für Konstantenlisten und Symbole hätte. Dies dient nur dazu, das MWE klein zu halten. Das Problem tritt auch bei den separaten Stilen auf. Hier ist die Datei 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}

Und dies ist die Datei glspreamble.tex, die die Glossarstile definiert (normalerweise würde diese einen separaten Stil für die Liste der Symbole enthalten, da diese keinen Wert haben)

% 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}

Antwort1

Sie haben einen Eintrag in einem Glossar einem übergeordneten Eintrag in einem anderen Glossar zugewiesen. Daher hat romanletter(im Glossar) ein untergeordnetes Element im Glossar und ein untergeordnetes Element im Glossar. Das untergeordnete Element führt dazu, dass sein übergeordnetes Element seinem eigenen Glossar hinzugefügt wird, was jedoch auch dazu führt, dass alle anderen untergeordneten Einträge des übergeordneten Elements ( in diesem Fall) hinzugefügt werden.symbolsym:tsymbolcon:gconstantscon:gromanlettersym:t

Ich vermute, dass es sich hier nur um einen Tippfehler handelt und das übergeordnete Element con:geigentlich lauten sollte 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
}

Diese Korrektur führt zum gewünschten Ergebnis.

Bild des Dokuments

verwandte Informationen