2

I can use glossaries, I mean compile and generate PDF of first example from http://mirrors.cqu.edu.cn/CTAN/macros/latex/contrib/glossaries/glossariesbegin.pdf:

\documentclass{article}
\usepackage{glossaries}
\newglossaryentry{ex}{name={sample},description={an example}}
\begin{document}
Here's my \gls{ex} term.
\end{document}

But I would like to use glossaries from the package I provide. I mean I would like to have doc.tex:

\documentclass{article}
\usepackage{doc}
\newglossaryentry{ex}{name={sample},description={an example}}
\begin{document}
Here's my \gls{ex} term.
\end{document}

and doc.sty:

\ProvidesPackage{doc}
\usepackage{glossaries}

That's what I got:

$ pdflatex doc.tex 
This is pdfTeX, Version 3.14159265-2.6-1.40.19 (TeX Live 2018) (preloaded format=pdflatex)
 restricted \write18 enabled.
entering extended mode
(./doc.tex
LaTeX2e <2018-04-01> patch level 2
Babel <3.18> and hyphenation patterns for 84 language(s) loaded.
(/usr/local/texlive/2018/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/local/texlive/2018/texmf-dist/tex/latex/base/size10.clo)) (./doc.sty)
(/usr/local/texlive/2018/texmf-dist/tex/latex/glossaries/base/glossaries.sty
(/usr/local/texlive/2018/texmf-dist/tex/latex/base/ifthen.sty)
(/usr/local/texlive/2018/texmf-dist/tex/latex/xkeyval/xkeyval.sty
(/usr/local/texlive/2018/texmf-dist/tex/generic/xkeyval/xkeyval.tex
(/usr/local/texlive/2018/texmf-dist/tex/generic/xkeyval/xkvutils.tex
(/usr/local/texlive/2018/texmf-dist/tex/generic/xkeyval/keyval.tex))))
(/usr/local/texlive/2018/texmf-dist/tex/latex/mfirstuc/mfirstuc.sty
(/usr/local/texlive/2018/texmf-dist/tex/latex/etoolbox/etoolbox.sty))
(/usr/local/texlive/2018/texmf-dist/tex/latex/textcase/textcase.sty)
(/usr/local/texlive/2018/texmf-dist/tex/latex/xfor/xfor.sty)
(/usr/local/texlive/2018/texmf-dist/tex/latex/datatool/datatool-base.sty
(/usr/local/texlive/2018/texmf-dist/tex/latex/amsmath/amsmath.sty
For additional information on amsmath, use the `?' option.
(/usr/local/texlive/2018/texmf-dist/tex/latex/amsmath/amstext.sty
(/usr/local/texlive/2018/texmf-dist/tex/latex/amsmath/amsgen.sty))
(/usr/local/texlive/2018/texmf-dist/tex/latex/amsmath/amsbsy.sty)
(/usr/local/texlive/2018/texmf-dist/tex/latex/amsmath/amsopn.sty))
(/usr/local/texlive/2018/texmf-dist/tex/latex/substr/substr.sty)
(/usr/local/texlive/2018/texmf-dist/tex/latex/datatool/datatool-fp.sty
(/usr/local/texlive/2018/texmf-dist/tex/latex/fp/fp.sty
`Fixed Point Package', Version 0.8, April 2, 1995 (C) Michael Mehlich
(/usr/local/texlive/2018/texmf-dist/tex/latex/fp/defpattern.sty)
(/usr/local/texlive/2018/texmf-dist/tex/latex/fp/fp-basic.sty)
(/usr/local/texlive/2018/texmf-dist/tex/latex/fp/fp-addons.sty)
(/usr/local/texlive/2018/texmf-dist/tex/latex/fp/fp-snap.sty)
(/usr/local/texlive/2018/texmf-dist/tex/latex/fp/fp-exp.sty)
(/usr/local/texlive/2018/texmf-dist/tex/latex/fp/fp-trigo.sty)
(/usr/local/texlive/2018/texmf-dist/tex/latex/fp/fp-pas.sty)
(/usr/local/texlive/2018/texmf-dist/tex/latex/fp/fp-random.sty)
(/usr/local/texlive/2018/texmf-dist/tex/latex/fp/fp-eqn.sty)
(/usr/local/texlive/2018/texmf-dist/tex/latex/fp/fp-upn.sty)
(/usr/local/texlive/2018/texmf-dist/tex/latex/fp/fp-eval.sty))))

! LaTeX Error: \PrintChanges undefined.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.64   \renewcommand{\PrintChanges}
                                   {%
? 

I actually found a reference to that PrintChanges in http://mirrors-wan.geekpie.club/CTAN/macros/latex/contrib/glossaries/glossaries-code.pdf page 5 but even so I don't know. What can I do?

1 Answer 1

8

Don't name your package "doc". doc.sty exists already (in latex/base) and glossaries contains special code when it detect that it has been used:

\@ifpackageloaded{doc}%
{%
  \@gls@docloadedtrue
}%
{%
  \@ifclassloaded{nlctdoc}{\@gls@docloadedtrue}{\@gls@docloadedfalse}%
}
\if@gls@docloaded
  \let\glsorg@theglossary\theglossary
  \let\glsorg@endtheglossary\endtheglossary
  \let\glsorg@PrintChanges\PrintChanges
  \renewcommand{\PrintChanges}{%
    \begingroup
      \let\theglossary\glsorg@theglossary
      \let\endtheglossary\glsorg@endtheglossary
      \glsorg@PrintChanges
    \endgroup
  }
\fi
1
  • In addition, one can check package existence on the command line via kpsewhich file.sty (don't do it from the folder where doc.sty already existed)
    – daleif
    Apr 2, 2019 at 8:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.