词汇表包,多个词汇表混合条目

词汇表包,多个词汇表混合条目

平均能量损失

\documentclass[11pt]{report} % use larger type; default would be 10pt

\usepackage{hyperref}
\hypersetup{
    colorlinks,
    citecolor=blue,
    filecolor=blue,
    linkcolor=blue,
    urlcolor=red
}

\usepackage[nopostdot,acronym,toc,section=chapter,style=indexgroup,nomain]{glossaries}

\newglossary[tld]{type1}{pref1}{ntn}{Title One}
\newglossary[tld]{type2}{pref2}{ntn}{Title Two}
\newglossary[tld]{type3}{pref3}{ntn}{Title Three}
\makeglossaries


\newglossaryentry{pref1:testone}{
                type=type1,
                name={Testing One},
                description={We are Testing One}
}


\newglossaryentry{pref1:testone2}{
                type=type1,
                name={Testing One Too},
                description={We are Testing One as well}
}


\newglossaryentry{pref2:testtwo}{
                type=type2,
                name={Testing Two},
                description={Now we are adding to Two}
}

\newglossaryentry{pref2:testtwo2}{
                type=type2,
                name={Testing Two Too},
                description={Now we are adding to Two too}
}

\newglossaryentry{pref3:testthree}{
                type=type3,
                name={Testing Three},
                description={Finally Three}
}

\newglossaryentry{pref3:testthree2}{
                type=type3,
                name={Testing Three Too},
                description={Finally Three Too}
}


\begin{document}

\gls{pref3:testthree2} and \hfill\\
\gls{pref2:testtwo}

\printglossary[type=type3]
\printglossary[type=type1]
\printglossary[type=type2] 

\end{document}

我按正确的顺序获得了三个词汇表,但是:

  1. 仅引用了 {pref3:testthree2}

  2. {pref3:testthree2} 被所有类型引用

生成PDF的命令是:PDFlatex + PDFlatex + makeglossaries + makeglossaries + PDFlatex + PDFlatex。

任何帮助将不胜感激!

答案1

问题在于您对每个词汇表使用了相同的文件扩展名。这意味着它们将被覆盖,makeindex并且每个词汇表都会读取相同的文件\printglossary

这是您编辑的 MWE:

\documentclass[11pt]{report}

\usepackage{hyperref}
\hypersetup{
    colorlinks,
    citecolor=blue,
    filecolor=blue,
    linkcolor=blue,
    urlcolor=red
}

\usepackage[nopostdot,acronym,toc,section=chapter,style=indexgroup,nomain]{glossaries}

\newglossary[tld]{type1}{pref1}{ntn1}{Title One}
\newglossary[tld]{type2}{pref2}{ntn2}{Title Two}
\newglossary[tld]{type3}{pref3}{ntn3}{Title Three}
\makeglossaries


\newglossaryentry{pref1:testone}{
                type=type1,
                name={Testing One},
                description={We are Testing One}
}


\newglossaryentry{pref1:testone2}{
                type=type1,
                name={Testing One Too},
                description={We are Testing One as well}
}


\newglossaryentry{pref2:testtwo}{
                type=type2,
                name={Testing Two},
                description={Now we are adding to Two}
}

\newglossaryentry{pref2:testtwo2}{
                type=type2,
                name={Testing Two Too},
                description={Now we are adding to Two too}
}

\newglossaryentry{pref3:testthree}{
                type=type3,
                name={Testing Three},
                description={Finally Three}
}

\newglossaryentry{pref3:testthree2}{
                type=type3,
                name={Testing Three Too},
                description={Finally Three Too}
}


\begin{document}

\gls{pref3:testthree2} and \hfill\\
\gls{pref2:testtwo}

\printglossary[type=type3]
\printglossary[type=type1]
\printglossary[type=type2] 

\end{document}

另一种方法是使用星号形式,\newglossary它从词汇表标签构建扩展。例如

\newglossary*{type1}{Title One}

相当于

\newglossary[type1-glg]{type1}{type1-gls}{type1-glo}{Title One}

如果您有大量词汇表,这将非常有用,因为您不必跟踪所有扩展名。由于词汇表标签必须是唯一的,这将确保词汇表文件扩展名不会相互冲突。

更新的 MWE:

\documentclass[11pt]{report}

\usepackage{hyperref}
\hypersetup{
    colorlinks,
    citecolor=blue,
    filecolor=blue,
    linkcolor=blue,
    urlcolor=red
}

\usepackage[nopostdot,acronym,toc,section=chapter,style=indexgroup,nomain]{glossaries}

\newglossary*{type1}{Title One}
\newglossary*{type2}{Title Two}
\newglossary*{type3}{Title Three}
\makeglossaries


\newglossaryentry{pref1:testone}{
                type=type1,
                name={Testing One},
                description={We are Testing One}
}


\newglossaryentry{pref1:testone2}{
                type=type1,
                name={Testing One Too},
                description={We are Testing One as well}
}


\newglossaryentry{pref2:testtwo}{
                type=type2,
                name={Testing Two},
                description={Now we are adding to Two}
}

\newglossaryentry{pref2:testtwo2}{
                type=type2,
                name={Testing Two Too},
                description={Now we are adding to Two too}
}

\newglossaryentry{pref3:testthree}{
                type=type3,
                name={Testing Three},
                description={Finally Three}
}

\newglossaryentry{pref3:testthree2}{
                type=type3,
                name={Testing Three Too},
                description={Finally Three Too}
}


\begin{document}

\gls{pref3:testthree2} and \hfill\\
\gls{pref2:testtwo}

\printglossary[type=type3]
\printglossary[type=type1]
\printglossary[type=type2] 

\end{document}

相关内容