To do that I recommend glossaries-extra
with bib2gls
. For example, if you have this three documents:
MyDoc1.tex
\documentclass{article}
\usepackage[record,index,postdot]{glossaries-extra}
\usepackage{glossary-bookindex}
\setglossarystyle{bookindex}
%number of columns
\renewcommand{\glsxtrbookindexcols}{2}
%names for glossaries, there can be more than one
\newglossary{symbols}{lds}{lsi}{Symbols List}
\newglossary{index}{ing}{ige}{General Index}
%setting external documents and prefixes
\newcommand{\setfileprefix}[2]{\csdef{prefix@#1}{#2}}
\newcommand{\usefileprefix}[1]{\csuse{prefix@#1}}
\setfileprefix{MyDoc2.pdf}{II-}
\setfileprefix{MyDoc3.pdf}{III-}
\renewcommand*\glsxtrdisplaysupploc[5]{%
\setentrycounter[#1]{#2}%
\usefileprefix{#4}\glsxtrmultisupplocation{#5}{#4}{#3}%
}
%style of symbols list
\newglossarystyle{listsimb}{%
\glossarystyle{super}%
\renewenvironment{theglossary}%
{\tablehead{}\tabletail{}%
\begin{supertabular}{@{}lp{20cm}}}%
{\end{supertabular}}%
\renewcommand{\glsgroupskip}{}%
\renewcommand*{\glossaryentryfield}[5]{%
\glsentryitem{##1}\glstarget{##1}{##2} & ##3\glspostdescription\space ##5\\[2pt]}%
}
%font
\renewcommand*{\glsnamefont}[1]{\textmd{#1}}
%loading supplemental files
\GlsXtrLoadResources[
src=index,
type=index,
supplemental-locations={MyDoc2, MyDoc3},% you can have more than one!
supplemental-category={supplemental},
supplemental-selection={all}
]
%and you can define all kinds of glossaries
\GlsXtrLoadResources[
src=symbols,
type=symbols,
supplemental-locations={MyDoc2, MyDoc3},
supplemental-category={supplemental},
supplemental-selection={all}
]
\begin{document}
A test \gls{ind1} and another time with different output \glsuseri{ind1}. Finally a constant \gls{symb1}.
\printunsrtglossary[type=index, style=bookindex]
\printunsrtglossary[type=symbols, style=listsimb]
\end{document}
MyDoc2.tex
\documentclass{article}
\usepackage[record,index,postdot]{glossaries-extra}
\usepackage{glossary-bookindex}
\setglossarystyle{bookindex}
%number of columns
\renewcommand{\glsxtrbookindexcols}{2}
%names for glossaries, there can be more than one
\newglossary{symbols}{lds}{lsi}{Symbols List}
\newglossary{index}{ing}{ige}{General Index}
%setting external documents and prefixes
\newcommand{\setfileprefix}[2]{\csdef{prefix@#1}{#2}}
\newcommand{\usefileprefix}[1]{\csuse{prefix@#1}}
\setfileprefix{MyDoc1.pdf}{I-}
\setfileprefix{MyDoc3.pdf}{III-}
\renewcommand*\glsxtrdisplaysupploc[5]{%
\setentrycounter[#1]{#2}%
\usefileprefix{#4}\glsxtrmultisupplocation{#5}{#4}{#3}%
}
%style of symbols list
\newglossarystyle{listsimb}{%
\glossarystyle{super}%
\renewenvironment{theglossary}%
{\tablehead{}\tabletail{}%
\begin{supertabular}{@{}lp{20cm}}}%
{\end{supertabular}}%
\renewcommand{\glsgroupskip}{}%
\renewcommand*{\glossaryentryfield}[5]{%
\glsentryitem{##1}\glstarget{##1}{##2} & ##3\glspostdescription\space ##5\\[2pt]}%
}
%font
\renewcommand*{\glsnamefont}[1]{\textmd{#1}}
%loading supplemental files
\GlsXtrLoadResources[
src=index,
type=index,
supplemental-locations={MyDoc1, MyDoc3},% you can have more than one!
supplemental-category={supplemental},
supplemental-selection={all}
]
%and you can define all kinds of glossaries
\GlsXtrLoadResources[
src=symbols,
type=symbols,
supplemental-locations={MyDoc1, MyDoc3},
supplemental-category={supplemental},
supplemental-selection={all}
]
\begin{document}
A test in this document \gls{ind2} and a constant \gls{symb1}.
\printunsrtglossary[type=index, style=bookindex]
\printunsrtglossary[type=symbols, style=listsimb]
\end{document}
and MyDoc3.tex
\documentclass{article}
\usepackage[record,index,postdot]{glossaries-extra}
\usepackage{glossary-bookindex}
\setglossarystyle{bookindex}
%number of columns
\renewcommand{\glsxtrbookindexcols}{2}
%names for glossaries, there can be more than one
\newglossary{symbols}{lds}{lsi}{Symbols List}
\newglossary{index}{ing}{ige}{General Index}
%setting external documents and prefixes
\newcommand{\setfileprefix}[2]{\csdef{prefix@#1}{#2}}
\newcommand{\usefileprefix}[1]{\csuse{prefix@#1}}
\setfileprefix{MyDoc1.pdf}{II-}
\setfileprefix{MyDoc2.pdf}{III-}
\renewcommand*\glsxtrdisplaysupploc[5]{%
\setentrycounter[#1]{#2}%
\usefileprefix{#4}\glsxtrmultisupplocation{#5}{#4}{#3}%
}
%style of symbols list
\newglossarystyle{listsimb}{%
\glossarystyle{super}%
\renewenvironment{theglossary}%
{\tablehead{}\tabletail{}%
\begin{supertabular}{@{}lp{20cm}}}%
{\end{supertabular}}%
\renewcommand{\glsgroupskip}{}%
\renewcommand*{\glossaryentryfield}[5]{%
\glsentryitem{##1}\glstarget{##1}{##2} & ##3\glspostdescription\space ##5\\[2pt]}%
}
%font
\renewcommand*{\glsnamefont}[1]{\textmd{#1}}
%loading supplemental files
\GlsXtrLoadResources[
src=index,
type=index,
supplemental-locations={MyDoc1, MyDoc2},% you can have more than one!
supplemental-category={supplemental},
supplemental-selection={all}
]
%and you can define all kinds of glossaries
\GlsXtrLoadResources[
src=symbols,
type=symbols,
supplemental-locations={MyDoc1, MyDoc2},
supplemental-category={supplemental},
supplemental-selection={all}
]
\begin{document}
A test \gls{ind2} and \gls{symb2}.
\printunsrtglossary[type=index, style=bookindex]
\printunsrtglossary[type=symbols, style=listsimb]
\end{document}
You will also need files for index and symbols in this example
index.bib
@index{ind1, %id
name = {Something}, %as is going to appear in the index
user1 = {some-thing} %if you want something different in the text
}
@index{ind2,
name = {another thing},
parent = {ind1}
}
And symbols.bib
@entry{symb1,
name = {\ensuremath{c}},
description = {an important constant},
sort = {constant}
}
@entry{symb2,
name = {\ensuremath{\binom{n}{k}}},
description = {binomial coeficient},
sort = {binomial}
}
All of them can have a sort
key, but in the index
case it is correct.
Then, compile with the following chain:
pdflatex MyDoc1
pdflatex MyDoc2
pdflatex MyDoc3
bib2gls MyDoc1
bib2gls MyDoc2
bib2gls MyDoc3
pdflatex MyDoc1
pdflatex MyDoc2
pdflatex MyDoc3
and you will get the following in the different files
