diff options
Diffstat (limited to 'Master/texmf-dist/doc/latex/glossaries')
16 files changed, 2849 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/glossaries/README b/Master/texmf-dist/doc/latex/glossaries/README new file mode 100644 index 00000000000..6ec00e14365 --- /dev/null +++ b/Master/texmf-dist/doc/latex/glossaries/README @@ -0,0 +1,40 @@ +LaTeX Package : glossaries v 1.0 + +Last Modified : 16 May 2007 + +Author : Nicola Talbot + +This package is provided to assist generating glossaries. +The package supports acronyms and multiple glossaries. +New entries are defined to have a name and description (and +optionally an associated symbol.) Plural forms can also be +specified. New glossary styles can be defined, and preambles +and postambles can be specified. There is provision for loading +a database of terms, only terms used in the text will be added +to the relevant glossary. + +*This package replaces the glossary package which is now obsolete.* + +The package is supplied using the TeX Directory Structure (TDS). +Files in texmf directory should go in the corresponding +$LOCALTEXMF directories. Files in texmf/bin should go in the +relevant binary directory, which should be somewhere on your +operating system's PATH. + +*Remember to refresh TeX's database* + +This package comes with a LaTeX2HTML style file glossaries.perl. +This is located in latex2html/styles and should be placed in +the relevant LaTeX2HTML styles directory, but note that +glossaries.perl only supplies a sub-set of the commands provided +by glossary.sty, so some commands may not be implemented, or +may be implemented in a different way. + +The package and documentation source code is also supplied as a +dtx and ins file located in texmf/source. + +This material is subject to the LaTeX Project Public License. +See http://www.ctan.org/tex-archive/help/Catalogue/licenses.lppl.html for the details of that license. + +http://theoval.cmp.uea.ac.uk/~nlct/ + diff --git a/Master/texmf-dist/doc/latex/glossaries/doc/database1.tex b/Master/texmf-dist/doc/latex/glossaries/doc/database1.tex new file mode 100644 index 00000000000..8a78ad6d785 --- /dev/null +++ b/Master/texmf-dist/doc/latex/glossaries/doc/database1.tex @@ -0,0 +1,24 @@ +% This is a sample database of glossary entries +% Only those entries used in the document with \glslink, \gls, +% \glspl, and uppercase variants will have entries in the +% glossary. Note that the type key is not used, as the +% glossary type can be specified in \loadglsentries + +\newglossaryentry{array}{name=array, +description={A list of values identified by a numeric value}} + +\newglossaryentry{binary}{name=binary, +description={Pertaining to numbers represented in base 2}} + +\newglossaryentry{comment}{name=comment, +description={A remark that doesn't affect the meaning of the +code}} + +\newglossaryentry{global}{name=global, +description={Something that maintains its state when it leaves +the current group}} + +\newglossaryentry{local}{name=local, +description={Something that only maintains its state until +it leaves the group in which it was defined/changed}} + diff --git a/Master/texmf-dist/doc/latex/glossaries/doc/database2.tex b/Master/texmf-dist/doc/latex/glossaries/doc/database2.tex new file mode 100644 index 00000000000..032b2d2b586 --- /dev/null +++ b/Master/texmf-dist/doc/latex/glossaries/doc/database2.tex @@ -0,0 +1,22 @@ +% This is a sample database of glossary entries +% Only those entries used in the document with \glslink, \gls, +% \glspl, and uppercase variants will have entries in the +% glossary. Note that the type key is not used, as the +% glossary type can be specified in \loadglsentries + +% Don't need to worry about makeindex special characters +\newglossaryentry{quote}{name={"}, +description={the double quote symbol}} + +\newglossaryentry{at}{name={@}, +description={the ``at'' symbol}} + +\newglossaryentry{excl}{name={!}, +description={the exclamation mark symbol}} + +\newglossaryentry{bar}{name={$|$}, +description={the vertical bar symbol}} + +\newglossaryentry{hash}{name={\#}, +description={the hash symbol}} + diff --git a/Master/texmf-dist/doc/latex/glossaries/doc/glossaries.pdf b/Master/texmf-dist/doc/latex/glossaries/doc/glossaries.pdf Binary files differnew file mode 100644 index 00000000000..3660f84f9c5 --- /dev/null +++ b/Master/texmf-dist/doc/latex/glossaries/doc/glossaries.pdf diff --git a/Master/texmf-dist/doc/latex/glossaries/doc/sample.tex b/Master/texmf-dist/doc/latex/glossaries/doc/sample.tex new file mode 100644 index 00000000000..516cb248421 --- /dev/null +++ b/Master/texmf-dist/doc/latex/glossaries/doc/sample.tex @@ -0,0 +1,68 @@ +\documentclass[a4paper]{report} + +\usepackage[plainpages=false,colorlinks]{hyperref} +\usepackage[style=altlist]{glossaries} + +\makeglossaries + +\newglossaryentry{glossary}{name=glossary, +description={1) list of technical words, 2) collection of +glosses}, +plural={glossaries}} + +\newglossaryentry{Perl}{name=\texttt{Perl}, +sort=Perl, % need a sort key because name contains a command +description=A scripting language} + +\newglossaryentry{pagelist}{name=page list, +% description value has to be enclosed in braces +% because it contains commas +description={a list of individual pages or page ranges +(e.g.\ 1,2,4,7-9)}} + +\newglossaryentry{mtrx}{name=matrix, +description={rectangular array of quantities}, +% plural is not simply obtained by appending an s, so specify +plural=matrices} + +\begin{document} + +\title{Sample Document Using glossary Package} +\author{Nicola Talbot} +\pagenumbering{alph}% prevent duplicate page link names if using PDF +\maketitle + +\pagenumbering{roman} +\tableofcontents + +\chapter{Introduction} +\pagenumbering{arabic} + +A \gls{glossary} is a very useful addition to any +technical document, although a \gls{glossary} can +also simply be a collection of glosses, which is +another thing entirely. Some documents have +multiple \glspl{glossary}. + +Once you have run your document through \LaTeX, you +will then need to run the \texttt{.glo} file through +\texttt{makeindex}. You will need to set the output +file so that it creates a \texttt{.gls} file instead +of an \texttt{.ind} file, and change the name of +the log file so that it doesn't overwrite the index +log file (if you have an index for your document). +Rather than having to remember all the command line +switches, you can call the \gls{Perl} script +\texttt{makeglossaries} which provides a convenient +wrapper. + +If a comma appears within the name or description, grouping +must be used, e.g.\ in the description of \gls{pagelist}. + +Plurals are assumed to have the letter s appended, but if +this is not the case, as in \glspl{mtrx}, then you need +to specify the plural when you define the entry. + +\printglossaries + +\end{document} diff --git a/Master/texmf-dist/doc/latex/glossaries/doc/sample4col.tex b/Master/texmf-dist/doc/latex/glossaries/doc/sample4col.tex new file mode 100644 index 00000000000..67b78bc4575 --- /dev/null +++ b/Master/texmf-dist/doc/latex/glossaries/doc/sample4col.tex @@ -0,0 +1,24 @@ +\documentclass[a4paper]{article} + +\usepackage[style=long4colheader]{glossaries} + +\makeglossaries + +\newglossaryentry{w}{name={$w$}, +sort=w, +description={width}, +symbol=m} + +\newglossaryentry{M}{name={$M$}, +sort=M, +description={mass}, +symbol={kg}} + +\begin{document} + +\printglossaries + +The width, \gls{w}, is measured in meters. The mass, \gls{M} is +measured in kilograms. + +\end{document} diff --git a/Master/texmf-dist/doc/latex/glossaries/doc/sampleAcr.tex b/Master/texmf-dist/doc/latex/glossaries/doc/sampleAcr.tex new file mode 100644 index 00000000000..02531ff49a0 --- /dev/null +++ b/Master/texmf-dist/doc/latex/glossaries/doc/sampleAcr.tex @@ -0,0 +1,47 @@ +\documentclass[a4paper]{report} + +\usepackage[colorlinks,plainpages=false]{hyperref} +\usepackage[style=long,toc]{glossaries} + +\makeglossaries + +\newacronym{svm}% label +{svm}% abbreviation +{support vector machine}% long form + +\newacronym{ksvm}{ksvm}{kernel support vector machine} + +\newacronym{rna}{rna}{ribonukleins\"aure} + +\begin{document} +\tableofcontents + +\chapter{Support Vector Machines} + +\Glspl{svm} are used widely in the area of pattern recognition. + +This is the text produced without a link: \glsentrytext{svm}. +This is the text produced on first use without a link: +\glsentryfirst{svm}. This is the entry's description without +a link: \glsentrydesc{svm}. + +This is the entry in uppercase: \GLS{svm}. + +\chapter{Kernel Support Vector Machines} + +The \gls{ksvm} is \ifglsused{svm}{an}{a} \gls{svm} that uses +the so called ``kernel trick''. Plural: \glspl{ksvm}. + +\glsresetall +Possessive: \gls{ksvm}['s]. +Make the glossary entry number bold for this +one \gls[format=hyperbf]{svm}. + +\chapter{Another chapter} + +You don't need to worry about makeindex's special characters: +\gls{rna}. + +\printglossary[title={Acronyms}] + +\end{document} diff --git a/Master/texmf-dist/doc/latex/glossaries/doc/sampleAcrDesc.tex b/Master/texmf-dist/doc/latex/glossaries/doc/sampleAcrDesc.tex new file mode 100644 index 00000000000..4a54c674943 --- /dev/null +++ b/Master/texmf-dist/doc/latex/glossaries/doc/sampleAcrDesc.tex @@ -0,0 +1,65 @@ +\documentclass[a4paper]{report} + +\usepackage[colorlinks,plainpages=false]{hyperref} + +\usepackage[style=altlist, % use altlist style + toc, % add the glossary to the table of contents + sanitize={description=false}% don't sanitize description + ]{glossaries} + +\makeglossaries + +\newglossaryentry{svm}{ +% how the entry name should appear in the glossary +name={Support vector machine (SVM)}, +% how the description should appear in the glossary +% since I have used sanitize={description=false} +% I have to protect fragile commands +description={Statistical pattern recognition +technique~\protect\cite{svm}}, +% how the entry should appear in the document text +text={svm}, +% how the entry should appear the first time it is +% used in the document text +first={support vector machine (svm)}} + +\newglossaryentry{ksvm}{ +name={Kernel support vector machine (KSVM)}, +description={Statistical pattern recognition technique +using the ``kernel trick'' (see also SVM)}, +text={ksvm}, +first={kernel support vector machine}} + +\begin{document} +\tableofcontents + +\chapter{Support Vector Machines} + +The \gls{svm} is used widely in the area of pattern recognition. +% plural form with initial letter in uppercase: +\Glspl{svm} are \ldots + +This is the text produced without a link: \glsentrytext{svm}. +This is the text produced on first use without a link: +\glsentryfirst{svm}. This is the entry's description without +a link: \glsentrydesc{svm}. + +This is the entry in uppercase: \GLS{svm}. + +\chapter{Kernel Support Vector Machines} + +The \gls{ksvm} is \ifglsused{svm}{an}{a} \gls{svm} that uses +the so called ``kernel trick''. + +\glsresetall +Possessive: \gls{ksvm}['s]. +Make the glossary entry number bold for this +one \gls[format=hyperbf]{svm}. + +\begin{thebibliography}{1} +\bibitem{svm} \ldots +\end{thebibliography} + +\printglossary[title={Acronyms}] + +\end{document} diff --git a/Master/texmf-dist/doc/latex/glossaries/doc/sampleDB.tex b/Master/texmf-dist/doc/latex/glossaries/doc/sampleDB.tex new file mode 100644 index 00000000000..7d58e32e2af --- /dev/null +++ b/Master/texmf-dist/doc/latex/glossaries/doc/sampleDB.tex @@ -0,0 +1,19 @@ +\documentclass{article} + +\usepackage[colorlinks,plainpages=false]{hyperref} +\usepackage[nonumberlist]{glossaries} + +\newglossary[nlg]{symbols}{not}{ntn}{Symbols} + +\makeglossaries + +\loadglsentries{database1} +\loadglsentries[symbols]{database2} + +\begin{document} + +Adding all entries\glsaddall. + +\printglossaries + +\end{document} diff --git a/Master/texmf-dist/doc/latex/glossaries/doc/sampleEq.tex b/Master/texmf-dist/doc/latex/glossaries/doc/sampleEq.tex new file mode 100644 index 00000000000..4fb888c6cb9 --- /dev/null +++ b/Master/texmf-dist/doc/latex/glossaries/doc/sampleEq.tex @@ -0,0 +1,231 @@ +\documentclass[a4paper,12pt]{report} + +\usepackage{amsmath} +\usepackage[colorlinks]{hyperref} +\usepackage[style=long3colheader,counter=equation]{glossaries} + +\newcommand{\erf}{\operatorname{erf}} +\newcommand{\erfc}{\operatorname{erfc}} + +\makeglossaries + +% Change the glossary headings + +\renewcommand{\entryname}{Notation} +\renewcommand{\descriptionname}{Function Name} +\renewcommand{\pagelistname}{Number of Formula} + +% define glossary entries + +\newglossaryentry{Gamma}{name=\ensuremath{\Gamma(z)}, +description=Gamma function, +sort=Gamma} + +\newglossaryentry{gamma}{name={\ensuremath{\gamma(\alpha,x)}}, +description=Incomplete gamma function, +sort=gamma} + +\newglossaryentry{iGamma}{name={\ensuremath{\Gamma(\alpha,x)}}, +description=Incomplete gamma function, +sort=Gamma} + +\newglossaryentry{psi}{name=\ensuremath{\psi(x)}, +description=Psi function,sort=psi} + +\newglossaryentry{erf}{name=\ensuremath{\erf(x)}, +description=Error function,sort=erf} + +\newglossaryentry{erfc}{name=\ensuremath{\erfc}, +description=Complementary error function,sort=erfc} + +\newglossaryentry{B}{name={\ensuremath{B(x,y)}}, +description=Beta function,sort=B} + +\newglossaryentry{Bx}{name={\ensuremath{B_x(p,q)}}, +description=Incomplete beta function,sort=Bx} + +\newglossaryentry{Tn}{name=\ensuremath{T_n(x)}, +description=Chebyshev's polynomials of the first kind,sort=Tn} + +\newglossaryentry{Un}{name=\ensuremath{U_n(x)}, +description=Chebyshev's polynomials of the second kind,sort=Un} + +\newglossaryentry{Hn}{name=\ensuremath{H_n(x)}, +description=Hermite polynomials,sort=Hn} + +\newglossaryentry{Ln}{name=\ensuremath{L_n^\alpha(x)}, +description=Laguerre polynomials,sort=Lna} + +\newglossaryentry{Znu}{name=\ensuremath{Z_\nu(z)}, +description=Bessel functions,sort=Z} + +\newglossaryentry{Phi}{name={\ensuremath{\Phi(\alpha,\gamma;z)}}, +description=confluent hypergeometric function,sort=Pagz} + +\newglossaryentry{knu}{name=\ensuremath{k_\nu(x)}, +description=Bateman's function,sort=kv} + +\newglossaryentry{Dp}{name=\ensuremath{D_p(z)}, +description=Parabolic cylinder functions,sort=Dp} + +\newglossaryentry{F}{name={\ensuremath{F(\phi,k)}}, +description=Elliptical integral of the first kind,sort=Fpk} + +\newglossaryentry{C}{name=\ensuremath{C}, +description=Euler's constant,sort=C} + +\newglossaryentry{G}{name=\ensuremath{G}, +description=Catalan's constant,sort=G} + +\begin{document} +\title{A Sample Document Using glossary.sty} +\author{Nicola Talbot} +\maketitle + +\begin{abstract} +This is a sample document illustrating the use of the \textsf{glossaries} +package. The functions here have been taken from ``Tables of +Integrals, Series, and Products'' by I.S.~Gradshteyn and I.M~Ryzhik. +The glossary is a list of special functions, so +the equation number has been used rather than the page number. This +can be done using the \texttt{counter=equation} package +option. +\end{abstract} + +\printglossary[title={Index of Special Functions and Notations}] + +\chapter{Gamma Functions} + +\begin{equation} +\gls{Gamma} = \int_{0}^{\infty}e^{-t}t^{z-1}\,dt +\end{equation} + +\verb|\ensuremath| is only required here if using +hyperlinks. +\begin{equation} +\glslink{Gamma}{\ensuremath{\Gamma(x+1)}} = x\Gamma(x) +\end{equation} + +\begin{equation} +\gls{gamma} = \int_0^x e^{-t}t^{\alpha-1}\,dt +\end{equation} + +\begin{equation} +\gls{iGamma} = \int_x^\infty e^{-t}t^{\alpha-1}\,dt +\end{equation} + +\newpage + +\begin{equation} +\gls{Gamma} = \Gamma(\alpha, x) + \gamma(\alpha, x) +\end{equation} + +\begin{equation} +\gls{psi} = \frac{d}{dx}\ln\Gamma(x) +\end{equation} + +\chapter{Error Functions} + +\begin{equation} +\gls{erf} = \frac{2}{\surd\pi}\int_0^x e^{-t^2}\,dt +\end{equation} + +\begin{equation} +\gls{erfc} = 1 - \erf(x) +\end{equation} + +\chapter{Beta Function} + +\begin{equation} +\gls{B} = 2\int_0^1 t^{x-1}(1-t^2)^{y-1}\,dt +\end{equation} +Alternatively: +\begin{equation} +\gls{B} = 2\int_0^{\frac\pi2}\sin^{2x-1}\phi\cos^{2y-1}\phi\,d\phi +\end{equation} + +\begin{equation} +\gls{B} = \frac{\Gamma(x)\Gamma(y)}{\Gamma(x+y)} = B(y,x) +\end{equation} + +\begin{equation} +\gls{Bx} = \int_0^x t^{p-1}(1-t)^{q-1}\,dt +\end{equation} + +\chapter{Polynomials} + +\section{Chebyshev's polynomials} + +\begin{equation} +\gls{Tn} = \cos(n\arccos x) +\end{equation} + +\begin{equation} +\gls{Un} = \frac{\sin[(n+1)\arccos x]}{\sin[\arccos x]} +\end{equation} + +\section{Hermite polynomials} + +\begin{equation} +\gls{Hn} = (-1)^n e^{x^2} \frac{d^n}{dx^n}(e^{-x^2}) +\end{equation} + +\section{Laguerre polynomials} + +\begin{equation} +L_n^{\alpha} (x) = \frac{1}{n!}e^x x^{-\alpha} +\frac{d^n}{dx^n}(e^{-x}x^{n+\alpha}) +\end{equation} + +\chapter{Bessel Functions} + +Bessel functions $Z_\nu$ are solutions of +\begin{equation} +\frac{d^2\glslink{Znu}{Z_\nu}}{dz^2} ++ \frac{1}{z}\,\frac{dZ_\nu}{dz} + +\left( 1-\frac{\nu^2}{z^2}Z_\nu = 0 \right) +\end{equation} + +\chapter{Confluent hypergeometric function} + +\begin{equation} +\gls{Phi} = 1 + \frac{\alpha}{\gamma}\,\frac{z}{1!} ++ \frac{\alpha(\alpha+1)}{\gamma(\gamma+1)}\,\frac{z^2}{2!} ++\frac{\alpha(\alpha+1)(\alpha+2)}{\gamma(\gamma+1)(\gamma+2)}\, +\frac{z^3}{3!} + \cdots +\end{equation} + +\begin{equation} +\gls{knu} = \frac{2}{\pi}\int_0^{\pi/2} +\cos(x \tan\theta - \nu\theta)\,d\theta +\end{equation} + +\chapter{Parabolic cylinder functions} + +\begin{equation} +\gls{Dp} = 2^{\frac{p}{2}}e^{-\frac{z^2}{4}} +\left\{ +\frac{\surd\pi}{\Gamma\left(\frac{1-p}{2}\right)} +\Phi\left(-\frac{p}{2},\frac{1}{2};\frac{z^2}{2}\right) +-\frac{\sqrt{2\pi}z}{\Gamma\left(-\frac{p}{2}\right)} +\Phi\left(\frac{1-p}{2},\frac{3}{2};\frac{z^2}{2}\right) +\right\} +\end{equation} + +\chapter{Elliptical Integral of the First Kind} + +\begin{equation} +\gls{F} = \int_0^\phi \frac{d\alpha}{\sqrt{1-k^2\sin^2\alpha}} +\end{equation} + +\chapter{Constants} + +\begin{equation} +\gls{C} = 0.577\,215\,664\,901\ldots +\end{equation} + +\begin{equation} +\gls{G} = 0.915\,965\,594\ldots +\end{equation} + +\end{document} diff --git a/Master/texmf-dist/doc/latex/glossaries/doc/sampleEqPg.tex b/Master/texmf-dist/doc/latex/glossaries/doc/sampleEqPg.tex new file mode 100644 index 00000000000..19531e3897e --- /dev/null +++ b/Master/texmf-dist/doc/latex/glossaries/doc/sampleEqPg.tex @@ -0,0 +1,267 @@ +\documentclass[a4paper,12pt]{report} + +\usepackage{amsmath} +\usepackage[colorlinks]{hyperref} +\usepackage[style=long3colheader,toc, + counter=equation]{glossaries} + +\newcommand{\erf}{\operatorname{erf}} +\newcommand{\erfc}{\operatorname{erfc}} + +\renewcommand{\glossaryname}{Index of Special Functions and Notations} + +\renewcommand{\glossarypreamble}{Numbers in italic indicate the equation number, +numbers in bold indicate page numbers where the main definition occurs.\par} + +% set the glossary number style to italic +% hyperit is used instead of textit because +% the hyperref package is being used. +\renewcommand{\glsnumberformat}[1]{\hyperit{#1}} + +% 1st column heading +\renewcommand{\entryname}{Notation} + +% 2nd column heading +\renewcommand{\descriptionname}{Function Name} + +% 3rd column heading +\renewcommand{\pagelistname}{} + +% Redefine header row so that it +% adds a blank row after the title row +\renewcommand{\glossaryheader}{\bfseries\entryname & +\bfseries\descriptionname&\bfseries\pagelistname\\ +& & \\\endhead} + +% Define glossary entries + +\newglossaryentry{Gamma}{name=\ensuremath{\Gamma(z)}, +description=Gamma function,sort=Gamma} + +\newglossaryentry{gamma}{name=\ensuremath{\gamma(\alpha,x)}, +description=Incomplete gamma function,sort=gamma} + +\newglossaryentry{iGamma}{name=\ensuremath{\Gamma(\alpha,x)}, +description=Incomplete gamma function,sort=Gamma} + +\newglossaryentry{psi}{name=\ensuremath{\psi(x)}, +description=Psi function,sort=psi} + +\newglossaryentry{erf}{name=\ensuremath{\erf(x)}, +description=Error function,sort=erf} + +\newglossaryentry{erfc}{name=\ensuremath{\erfc(x)}, +description=Complementary error function,sort=erfc} + +\newglossaryentry{beta}{name=\ensuremath{B(x,y)}, +description=Beta function,sort=B} + +\newglossaryentry{Bx}{name=\ensuremath{B_x(p,q)}, +description=Incomplete beta function,sort=Bx} + +\newglossaryentry{Tn}{name=\ensuremath{T_n(x)}, +description=Chebyshev's polynomials of the first kind, +sort=Tn} + +\newglossaryentry{Un}{name=\ensuremath{U_n(x)}, +description=Chebyshev's polynomials of the second kind, +sort=Un} + +\newglossaryentry{Hn}{name=\ensuremath{H_n(x)}, +description=Hermite polynomials,sort=Hn} + +\newglossaryentry{Lna}{name=\ensuremath{L_n^\alpha(x)}, +description=Laguerre polynomials,sort=Lna} + +\newglossaryentry{Znu}{name=\ensuremath{Z_\nu(z)}, +description=Bessel functions,sort=Z} + +\newglossaryentry{Pagz}{name=\ensuremath{\Phi(\alpha,\gamma;z)}, +description=confluent hypergeometric function,sort=Pagz} + +\newglossaryentry{kv}{name=\ensuremath{k_\nu(x)}, +description=Bateman's function,sort=kv} + +\newglossaryentry{Dp}{name=\ensuremath{D_p(z)}, +description=Parabolic cylinder functions,sort=Dp} + +\newglossaryentry{Fpk}{name=\ensuremath{F(\phi,k)}, +description=Elliptical integral of the first kind,sort=Fpk} + +\newglossaryentry{C}{name=\ensuremath{C}, +description=Euler's constant,sort=C} + +\newglossaryentry{G}{name=\ensuremath{G}, +description=Catalan's constant,sort=G} + +\makeglossaries + +\pagestyle{headings} + +\begin{document} + +\title{Sample Document Using Interchangable Numbering} +\author{Nicola Talbot} +\maketitle + +\begin{abstract} +This is a sample document illustrating the use of the \textsf{glossaries} +package. The functions here have been taken from ``Tables of +Integrals, Series, and Products'' by I.S.~Gradshteyn and I.M~Ryzhik. + +The glossary lists both page numbers and equation numbers. +Since the majority of the entries use the equation number, +\texttt{counter=equation} was used as a package option. +Note that this example will only work where the +page number and equation number compositor is the same. So +it won't work if, say, the page numbers are of the form +2-4 and the equation numbers are of the form 4.6. +As most of the glossary entries should have an italic +format, it is easiest to set the default format to +italic. + +\end{abstract} + +\tableofcontents + +\printglossary[toctitle={Special Functions}] + +\chapter{Gamma Functions} + +The \glslink[format=hyperbf,counter=page]{Gamma}{gamma function} is +defined as +\begin{equation} +\gls{Gamma} = \int_{0}^{\infty}e^{-t}t^{z-1}\,dt +\end{equation} + +\begin{equation} +\glslink{Gamma}{\ensuremath{\Gamma(x+1)}} = x\Gamma(x) +\end{equation} + +\begin{equation} +\gls{gamma} = \int_0^x e^{-t}t^{\alpha-1}\,dt +\end{equation} + +\begin{equation} +\gls{iGamma} = \int_x^\infty e^{-t}t^{\alpha-1}\,dt +\end{equation} + +\newpage + +\begin{equation} +\glslink{Gamma}{\ensuremath{\Gamma(\alpha)}} = +\Gamma(\alpha, x) + \gamma(\alpha, x) +\end{equation} + +\begin{equation} +\gls{psi} = \frac{d}{dx}\ln\Gamma(x) +\end{equation} + +\chapter{Error Functions} + +The \glslink[format=hyperbf,counter=page]{erf}{error function} is defined as: +\begin{equation} +\gls{erf} = \frac{2}{\surd\pi}\int_0^x e^{-t^2}\,dt +\end{equation} + +\begin{equation} +\gls{erfc} = 1 - \erf(x) +\end{equation} + +\chapter{Beta Function} + +\begin{equation} +\gls{beta} = 2\int_0^1 t^{x-1}(1-t^2)^{y-1}\,dt +\end{equation} +Alternatively: +\begin{equation} +\gls{beta} = 2\int_0^{\frac\pi2}\sin^{2x-1}\phi\cos^{2y-1}\phi\,d\phi +\end{equation} + +\begin{equation} +\gls{beta} = \frac{\Gamma(x)\Gamma(y)}{\Gamma(x+y)} = B(y,x) +\end{equation} + +\begin{equation} +\gls{Bx} = \int_0^x t^{p-1}(1-t)^{q-1}\,dt +\end{equation} + +\chapter{Chebyshev's polynomials} + +\begin{equation} +\gls{Tn} = \cos(n\arccos x) +\end{equation} + +\begin{equation} +\gls{Un} = \frac{\sin[(n+1)\arccos x]}{\sin[\arccos x]} +\end{equation} + +\chapter{Hermite polynomials} + +\begin{equation} +\gls{Hn} = (-1)^n e^{x^2} \frac{d^n}{dx^n}(e^{-x^2}) +\end{equation} + +\chapter{Laguerre polynomials} + +\begin{equation} +\gls{Lna} = \frac{1}{n!}e^x x^{-\alpha} +\frac{d^n}{dx^n}(e^{-x}x^{n+\alpha}) +\end{equation} + +\chapter{Bessel Functions} + +Bessel functions $Z_\nu(z)$ are solutions of +\begin{equation} +\frac{d^2\glslink{Znu}{Z_\nu}}{dz^2} + \frac{1}{z}\,\frac{dZ_\nu}{dz} + +\left( +1-\frac{\nu^2}{z^2}Z_\nu = 0 +\right) +\end{equation} + +\chapter{Confluent hypergeometric function} + +\begin{equation} +\gls{Pagz} = 1 + \frac{\alpha}{\gamma}\,\frac{z}{1!} ++ \frac{\alpha(\alpha+1)}{\gamma(\gamma+1)}\,\frac{z^2}{2!} ++\frac{\alpha(\alpha+1)(\alpha+2)} + {\gamma(\gamma+1)(\gamma+2)} +\,\frac{z^3}{3!} ++ \cdots +\end{equation} + +\begin{equation} +\gls{kv} = \frac{2}{\pi}\int_0^{\pi/2} +\cos(x \tan\theta - \nu\theta)\,d\theta +\end{equation} + +\chapter{Parabolic cylinder functions} + +\begin{equation} +\gls{Dp} = 2^{\frac{p}{2}}e^{-\frac{z^2}{4}} +\left\{ +\frac{\surd\pi}{\Gamma\left(\frac{1-p}{2}\right)} +\Phi\left(-\frac{p}{2},\frac{1}{2};\frac{z^2}{2}\right) +-\frac{\sqrt{2\pi}z}{\Gamma\left(-\frac{p}{2}\right)} +\Phi\left(\frac{1-p}{2},\frac{3}{2};\frac{z^2}{2}\right) +\right\} +\end{equation} + +\chapter{Elliptical Integral of the First Kind} + +\begin{equation} +\gls{Fpk} = \int_0^\phi +\frac{d\alpha}{\sqrt{1-k^2\sin^2\alpha}} +\end{equation} + +\chapter{Constants} + +\begin{equation} +\gls{C} = 0.577\,215\,664\,901\ldots +\end{equation} + +\begin{equation} +\gls{G} = 0.915\,965\,594\ldots +\end{equation} + +\end{document} diff --git a/Master/texmf-dist/doc/latex/glossaries/doc/sampleNtn.tex b/Master/texmf-dist/doc/latex/glossaries/doc/sampleNtn.tex new file mode 100644 index 00000000000..04af87e3562 --- /dev/null +++ b/Master/texmf-dist/doc/latex/glossaries/doc/sampleNtn.tex @@ -0,0 +1,82 @@ +\documentclass{report} + +\usepackage[plainpages=false,colorlinks]{hyperref} +\usepackage{html} +\usepackage[toc]{glossaries} + +% Define a new glossary type called notation +\newglossary[nlg]{notation}{not}{ntn}{Notation} + +\makeglossaries + +% Notation definitions + +\newglossaryentry{not:set}{type=notation, % glossary type +name={$\mathcal{S}$}, +description={A set}, +sort={S}} + +\newglossaryentry{not:U}{type=notation, +name={$\mathcal{U}$}, +description={The universal set}, +sort=U} + +\newglossaryentry{not:card}{type=notation, +name={$|\mathcal{S}|$}, +description={cardinality of $\mathcal{S}$}, +sort=cardinality} + +\newglossaryentry{not:fact}{type=notation, +name={$!$}, +description={factorial}, +sort=factorial} + +% Main glossary definitions + +\newglossaryentry{gls:set}{name=set, +description={A collection of distinct objects}} + +\newglossaryentry{gls:card}{name=cardinality, +description={The number of elements in the specified set}} + +\begin{document} +\title{Sample Document using glossary Package} +\author{Nicola Talbot} +\pagenumbering{alph} +\maketitle + +\begin{abstract} +%stop hyperref complaining about duplicate page identifiers: +\pagenumbering{Alph} +This is a sample document illustrating the use of the +\textsf{glossaries} package. In this example, a new glossary type +called \texttt{notation} is defined, so that the document can have a +separate glossary of terms and index of notation. The index of notation +doesn't have associated numbers. +\end{abstract} + + +\pagenumbering{roman} +\tableofcontents + +\printglossaries + +\chapter{Introduction} +\pagenumbering{arabic} + +\glslink{gls:set}{Sets} +are denoted by a caligraphic font +e.g.\ \gls{not:set}. + +Let \gls[format=hyperit]{not:U} denote the universal set. + +The \gls{gls:card} of a set $\mathcal{S}$ is denoted +\gls{not:card}. + +\chapter{Another Chapter} + +Another mention of the universal set \gls{not:U}. + +The factorial symbol: \gls{not:fact}. + +\end{document} diff --git a/Master/texmf-dist/doc/latex/glossaries/doc/sampleSec.tex b/Master/texmf-dist/doc/latex/glossaries/doc/sampleSec.tex new file mode 100644 index 00000000000..ccefe8c19e1 --- /dev/null +++ b/Master/texmf-dist/doc/latex/glossaries/doc/sampleSec.tex @@ -0,0 +1,58 @@ +\documentclass{report} + +\usepackage[plainpages=false,colorlinks]{hyperref} +\usepackage[style=altlist,toc,counter=section]{glossaries} + +\makeglossaries + +\newglossaryentry{ident}{name=identity matrix, +description=diagonal matrix with 1s along the leading diagonal, +plural=identity matrices} + +\newglossaryentry{diag}{name=diagonal matrix, +description=matrix whose only non-zero entries are along +the leading diagonal, +plural=diagonal matrices} + +\newglossaryentry{sing}{name=singular matrix, +description=matrix with zero determinant, +plural=singular matrices} + +\begin{document} + +\pagenumbering{roman} +\tableofcontents + +\printglossaries + +\chapter{Introduction} +\pagenumbering{arabic} +This is a sample document illustrating the use of the +\textsf{glossaries} package. + +\chapter{Diagonal matrices} + +A \gls[format=hyperit]{diag} is a matrix where all elements not on the +leading diagonal are zero. This is the +primary definition, so an italic font is used for the page number. + +\newpage +\section{Identity matrix} +The \gls[format=hyperit]{ident} is a \gls{diag} whose leading +diagonal elements are all equal to 1. + +Here is another entry for a \gls{diag}. And this is the +plural: \glspl{ident}. + +This adds an entry into the glossary with a bold number, but +it doesn't create a hyperlink: \gls*[format=hyperbf]{ident}. + +\chapter{Singular Matrices} + +A \gls{sing} is a matrix with zero determinant. +\Glspl{sing} are non-invertible. Possessive: +a \gls{sing}['s] dimensions are not necessarily equal. + +Another \gls{ident} entry. + +\end{document} diff --git a/Master/texmf-dist/doc/latex/glossaries/latex2html/glossaries.perl b/Master/texmf-dist/doc/latex/glossaries/latex2html/glossaries.perl new file mode 100644 index 00000000000..67f04090aa1 --- /dev/null +++ b/Master/texmf-dist/doc/latex/glossaries/latex2html/glossaries.perl @@ -0,0 +1,1689 @@ +# File : glossaries.perl +# Author : Nicola Talbot +# Date : 16 May 2007 +# Version : 1.0 +# Description : LaTeX2HTML (limited!) implementation of glossaries +# package. Note that not all the glossaries.sty +# macros have been implemented. + +package main; + +# These are the only package options implemented. + +sub do_glossaries_style_altlist{ +} + +sub do_glossaries_toc{ +} + +sub do_glossaries_toc_true{ +} + +$GLSCURRENTFORMAT="textrm"; + +sub do_cmd_glossaryname{ + "Glossary$_[0]" +} + +$gls_mark{'main'} = "<tex2html_gls_main_mark>"; +$gls_file_mark{'main'} = "<tex2html_gls_main_file_mark>"; +$gls_title{'main'} = "\\glossaryname"; +$delimN{'main'} = ", "; +$glsnumformat{'main'} = $GLSCURRENTFORMAT; +@{$gls_entries{'main'}} = (); +$gls_displayfirst{'main'} = "glsdisplayfirst"; +$gls_display{'main'} = "glsdisplay"; + +%glsentry = (); + +$acronymtype = 'main'; + +sub do_glossaries_acronym{ + &do_glossaries_acronym_true +} + +sub do_glossaries_acronym_true{ + &make_newglossarytype("acronym", "\\acronymname"); + $acronymtype = 'acronym'; +} + +sub do_glossary_acronym_false{ + $acronymtype = 'main'; +} + +sub do_cmd_acronymname{ + join('', 'Acronyms', $_[0]); +} + +sub do_cmd_acronymtype{ + join('', $acronymtype, $_[0]); +} + +# modify set_depth_levels so that glossary is added + +sub replace_glossary_markers{ + foreach $type (keys %gls_mark) + { + if (defined &add_gls_hook) + {&add_gls_hook if (/$gls_mark{$type}/);} + else + {&add_gls($type) if (/$gls_mark{$type}/);} + + s/$gls_file_mark{$type}/$glsfile{$type}/g; + } +} + +# there must be a better way of doing this +# other than copying the orginal code and adding to it. +sub replace_general_markers { + if (defined &replace_infopage_hook) {&replace_infopage_hook if (/$info_page_mark/);} + else { &replace_infopage if (/$info_page_mark/); } + if (defined &add_idx_hook) {&add_idx_hook if (/$idx_mark/);} + else {&add_idx if (/$idx_mark/);} + &replace_glossary_markers; + + if ($segment_figure_captions) { +s/$lof_mark/$segment_figure_captions/o + } else { s/$lof_mark/$figure_captions/o } + if ($segment_table_captions) { +s/$lot_mark/$segment_table_captions/o + } else { s/$lot_mark/$table_captions/o } + &replace_morelinks(); + if (defined &replace_citations_hook) {&replace_citations_hook if /$bbl_mark/;} + else {&replace_bbl_marks if /$bbl_mark/;} + if (defined &add_toc_hook) {&add_toc_hook if (/$toc_mark/);} + else {&add_toc if (/$toc_mark/);} + if (defined &add_childs_hook) {&add_childs_hook if (/$childlinks_on_mark/);} + else {&add_childlinks if (/$childlinks_on_mark/);} + &remove_child_marks; + + if (defined &replace_cross_references_hook) {&replace_cross_references_hook;} + else {&replace_cross_ref_marks if /$cross_ref_mark||$cross_ref_visible_mark/;} + if (defined &replace_external_references_hook) {&replace_external_references_hook;} + else {&replace_external_ref_marks if /$external_ref_mark/;} + if (defined &replace_cite_references_hook) {&replace_cite_references_hook;} + else { &replace_cite_marks if /$cite_mark/; } + if (defined &replace_user_references) { + &replace_user_references if /$user_ref_mark/; } + +} + +sub add_gls{ + local($sidx_style, $eidx_style) =('<STRONG>','</STRONG>'); + if ($INDEX_STYLES) { +if ($INDEX_STYLES =~/,/) { +local(@styles) = split(/\s*,\s*/,$INDEX_STYLES); + $sidx_style = join('','<', join('><',@styles) ,'>'); + $eidx_style = join('','</', join('></',reverse(@styles)) ,'>'); +} else { + $sidx_style = join('','<', $INDEX_STYLES,'>'); + $eidx_style = join('','</', $INDEX_STYLES,'>'); +} + } + &add_real_gls +} + +sub gloskeysort{ + local($x, $y) = ($a, $b); + $x=~s/^(.*)###(\d+)$/\l\1/; + local($x_id) = $2; + $y=~s/^(.*)###(\d+)$/\l\1/; + local($y_id) = $2; + + local($n) = ($x cmp $y); + + if ($n == 0) + { + $n = ($x_id <=> $y_id); + } + + $n; +} + +sub add_real_gls{ + local($type) = @_; + print "\nDoing glossary '$type' ..."; + local($key, $str, @keys, $glossary, $level, $count, + @previous, @current, $id, $linktext, $delimN); + + @keys = keys %{$glossary{$type}}; + + @keys = sort gloskeysort @keys; + + $level = 0; + + $delimN = $delimN{$type}; + + foreach $key (@keys) + { + $current = $key; + $str = $current; + $str =~ s/\#\#\#\d+$//o; # Remove the unique id's + #$linktext = $cross_ref_visible_mark; + $id = ++$global{'max_id'}; + $linktext = "\\$glossary_format{$type}{$key}${OP}$id${CP}$glossary_linktext{$type}{$key}${OP}$id${CP}"; + $linktext = &translate_commands($linktext); + + local($entry) = $glossary_entry{$type}{$key}; + + $id = ++$global{'max_id'}; + local($name) = &translate_commands( + "\\glsnamefont $OP$id$CP$glsentry{$entry}{name}$OP$id$CP"); + + local($symbol) = ($glsentry{$entry}{'symbol'} ? + " $glsentry{$entry}{symbol}" : ''); + + $glossary .= + # If it's the same string don't start a new line + (&index_key_eq($current, $previous) ? + $delimN + . $glossary{$type}{$key} + . $linktext + . "</A>\n" + : "<DT>" + . $name + . "<DD>" + . $glsentry{$entry}{'description'} + . $symbol . '. ' + . $glossary{$type}{$key} + . $linktext. "</A>\n"); + $previous = $current; + } + $glossary = '<DD>'.$glossary unless ($glossary =~ /^\s*<D(T|D)>/); + + $glossary =~ s/(<A [^>]*>)(<D(T|D)>)/$2$1/g; + + $str = &translate_commands("\\glossarypostamble"); + s/$gls_mark{$type}/$preglossary\n<DL COMPACT>\n$glossary<\/DL>$str\n/s; +} + +sub set_depth_levels { + # Sets $outermost_level + local($level); + # scan the document body, not the preamble, for use of sectioning commands + my ($contents) = $_; + if ($contents =~ /\\begin\s*((?:$O|$OP)\d+(?:$C|$CP))document\1|\\startdocument/s) { +$contents = $'; + } + foreach $level ("part", "chapter", "section", "subsection", + "subsubsection", "paragraph") { +last if (($outermost_level) = $contents =~ /\\($level)$delimiter_rx/); +last if (($outermost_level) = $contents =~ /\\endsegment\s*\[\s*($level)\s*\]/s); +if ($contents =~ /\\segment\s*($O\d+$C)[^<]+\1\s*($O\d+$C)\s*($level)\s*\2/s) +{ $outermost_level = $3; last }; + } + $level = ($outermost_level ? $section_commands{$outermost_level} : + do {$outermost_level = 'section'; 3;}); + + if ($REL_DEPTH && $MAX_SPLIT_DEPTH) { +$MAX_SPLIT_DEPTH = $level + $MAX_SPLIT_DEPTH; + } elsif (!($MAX_SPLIT_DEPTH)) { $MAX_SPLIT_DEPTH = 1 }; + + %unnumbered_section_commands = ( + 'tableofcontents', $level +, 'listoffigures', $level +, 'listoftables', $level +, 'bibliography', $level +, 'textohtmlindex', $level +, 'textohtmlglossary', $level +, 'textohtmlglossaries', $level + , %unnumbered_section_commands + ); + + %section_commands = ( + %unnumbered_section_commands + , %section_commands + ); +} + +sub add_bbl_and_idx_dummy_commands { + local($id) = $global{'max_id'}; + + s/([\\]begin\s*$O\d+$C\s*thebibliography)/$bbl_cnt++; $1/eg; + ## if ($bbl_cnt == 1) { +s/([\\]begin\s*$O\d+$C\s*thebibliography)/$id++; "\\bibliography$O$id$C$O$id$C $1"/geo; + #} + $global{'max_id'} = $id; + s/([\\]begin\s*$O\d+$C\s*theindex)/\\textohtmlindex $1/o; + s/[\\]printindex/\\textohtmlindex /o; + &add_gls_dummy_commands; + &lib_add_bbl_and_idx_dummy_commands() if defined(&lib_add_bbl_and_idx_dummy_commands); +} + +sub add_gls_dummy_commands{ + s/[\\]printglossary/\\textohtmlglossary/sg; + s/[\\]printglossaries/\\textohtmlglossaries/sg; +} + +sub get_firstkeyval{ + local($key,$_) = @_; + local($value); + + s/\b$key\s*=$OP(\d+)$CP(.*)$OP\1$CP\s*(,|$)/$value=$2;','/es; + undef($value) if $`=~/\b$key\s*=/; + + unless (defined($value)) + { + s/(^|,)\s*$key\s*=\s*([^,]*)\s*(,|$)/,/s; + $value=$2; + } + + ($value,$_); +} + +# need to get the value of the last key of a given name +# in the event of multiple occurences. +sub get_keyval{ + local($key,$_) = @_; + local($value); + + while (/\b$key\s*=/) + { + ($value,$_) = &get_firstkeyval($key, $_); + } + + ($value,$_); +} + +# This is modified from do_cmd_textohtmlindex + +sub do_cmd_textohtmlglossary{ + local($_) = @_; + + local($keyval,$pat) = &get_next_optional_argument; + + local($type,$title,$toctitle,$style); + + ($type,$keyval) = &get_keyval('type', $keyval); + ($title,$keyval) = &get_keyval('title', $keyval); + ($toctitle,$keyval) = &get_keyval('toctitle', $keyval); + ($style,$keyval) = &get_keyval('style', $keyval); + + &make_textohtmlglossary($type,$toctitle,$title,$style).$_; +} + +sub make_textohtmlglossary{ + local($type,$toctitle,$title,$style) = @_; + + unless (defined($type)) {$type = 'main';} + + unless (defined $gls_mark{$type}) + { + &write_warnings("glossary type '$type' not implemented"); + } + + unless (defined($title) and $title) {$title = $gls_title{$type};} + unless (defined($toctitle) and $toctitle) {$toctitle = $title;} + + $toc_sec_title = $toctitle; + $glsfile{$type} = $CURRENT_FILE; + + $TITLE=&translate_commands($toctitle); + + if (%glossary_labels) { &make_glossary_labels(); } + + if (($SHORT_INDEX) && (%glossary_segment)) + { + &make_preglossary(); + } + else + { + $preglossary = &translate_commands("\\glossarypreamble"); + } + + local $idx_head = $section_headings{'textohtmlindex'}; + local($heading) = join('' + , &make_section_heading($title, $idx_head) + , $gls_mark{$type} ); + local($pre,$post) = &minimize_open_tags($heading); + join('',"<BR>\n" , $pre); +} + +sub do_cmd_textohtmlglossaries{ + local($_) = @_; + + foreach $type (keys %gls_mark) + { + $id = ++$global{'max_id'}; + $_ = &make_textohtmlglossary($type,$gls_title{'main'}).$_; + } + + $_; +} + +sub make_glossary_labels { + local($key, @keys); + @keys = keys %glossary_labels; + foreach $key (@keys) { + if (($ref_files{$key}) && !($ref_files{$key} eq "$glsfile{'main'}")) { + local($tmp) = $ref_files{$key}; + &write_warnings("\nmultiple label $key , target in $glsfile{'main'} masks $tmp "); + } + $ref_files{$key} .= $glsfile{'main'}; + } +} + +sub make_preglossary{ &make_real_preglossary } +sub make_real_preglossary{ + local($key, @keys, $head, $body); + $head = "<HR>\n<H4>Legend:</H4>\n<DL COMPACT>"; + @keys = keys %glossary_segment; + foreach $key (@keys) { + local($tmp) = "segment$key"; + $tmp = $ref_files{$tmp}; + $body .= "\n<DT>$key<DD>".&make_named_href('',$tmp,$glossary_segment{$key}); + } + $preglossary = join('', $head, $body, "\n</DL>") if ($body); +} + +sub do_cmd_glossary { &do_real_glossary(@_) } +sub do_real_glossary { + local($_) = @_; + local($type) = "main"; + local($anchor,$entry); + + local($type,$pat) = &get_next_optional_argument; + + $entry = &missing_braces unless + (s/$next_pair_pr_rx//o&&($entry=$2)); + + $anchor = &make_glossary_entry($entry,$anchor_invisible_mark,$type); + + join('', $anchor, $_); +} + +sub make_glossary_entry { &make_real_glossary_entry(@_) } +sub make_real_glossary_entry { + local($entry,$text,$type) = @_; + local($this_file) = $CURRENT_FILE; + $TITLE = $saved_title if (($saved_title)&&(!($TITLE)||($TITLE eq $default_title))); + + local($sort) = $glsentry{$entry}{'sort'}; + + # Save the reference + local($str) = "$sort###" . ++$global{'max_id'}; # Make unique + # concatenate multiple spaces into a single space + # otherwise keys won't sort properly + $str=~s/\s+/ /gs; + local($br_id) = ++$global{'max_id'}; + $glossary{$type}{$str} .= &make_half_href($this_file."#$br_id"); + $glossary_format{$type}{$str} = $GLSCURRENTFORMAT; + $glossary_entry{$type}{$str} = $entry; + $glossary_linktext{$type}{$str} = $TITLE; + "<A HREF=$gls_file_mark{$type}#tex2html$href_name NAME=\"$br_id\">$text<\/A>"; +} + +sub do_cmd_newglossary{ + local($_) = @_; + local($type,$out,$in,$opt,$pat,$title); + + ($opt,$pat) = &get_next_optional_argument; + + $type = &missing_braces unless + (s/$next_pair_pr_rx//o&&($type=$2)); + $in = &missing_braces unless + (s/$next_pair_pr_rx//o&&($in=$2)); + $out = &missing_braces unless + (s/$next_pair_pr_rx//o&&($out=$2)); + $title = &missing_braces unless + (s/$next_pair_pr_rx//o&&($title=$2)); + + ($opt,$pat) = &get_next_optional_argument; + + &make_newglossarytype($type, $title); + + $_; +} + +sub make_newglossarytype{ + local($type, $title) = @_; + + $gls_mark{$type} = "<tex2html_gls_${type}_mark>"; + $gls_file_mark{$type} = "<tex2html_gls_${type}_file_mark>"; + $gls_title{$type} = $title; + $delimN{$type} = ", "; + $glsnumformat{$type} = $GLSCURRENTFORMAT; + @{$gls_entries{$type}} = (); + $gls_displayfirst{$type} = "glsdisplayfirst"; + $gls_display{$type} = "glsdisplay"; +} + +sub do_cmd_glsdisplay{ + local($_) = @_; + local($text,$description,$symbol,$insert); + + $text = &missing_braces unless + (s/$next_pair_pr_rx/$text=$2;''/eo); + + $description = &missing_braces unless + (s/$next_pair_pr_rx/$description=$2;''/eo); + + $symbol = &missing_braces unless + (s/$next_pair_pr_rx/$symbol=$2;''/eo); + + $insert = &missing_braces unless + (s/$next_pair_pr_rx/$insert=$2;''/eo); + + "$text$insert" . $_; +} + +sub do_cmd_glsdisplayfirst{ + local($_) = @_; + local($text,$description,$symbol,$insert); + + $text = &missing_braces unless + (s/$next_pair_pr_rx/$text=$2;''/eo); + + $description = &missing_braces unless + (s/$next_pair_pr_rx/$description=$2;''/eo); + + $symbol = &missing_braces unless + (s/$next_pair_pr_rx/$symbol=$2;''/eo); + + $insert = &missing_braces unless + (s/$next_pair_pr_rx/$insert=$2;''/eo); + + "$text$insert" . $_; +} + +sub gls_get_displayfirst{ + local($type) = @_; + local($display)= $gls_displayfirst{$type}; + + if (not defined($display)) + { + &write_warnings("Glossary '$type' is not defined"); + $display=''; + } + elsif ($display eq '') + { + &write_warnings("glsdisplayfirst not set for glossary '$type'"); + } + else + { + $display = "\\$display "; + } + + $display; +} + +sub gls_get_display{ + local($type) = @_; + local($display)= $gls_display{$type}; + + if (not defined($display)) + { + &write_warnings("Glossary '$type' is not defined"); + $display = ''; + } + elsif ($display eq '') + { + &write_warnings("glsdisplay not set for glossary '$type'"); + } + else + { + $display = "\\$display "; + } + + $display; +} + +sub do_cmd_glsnamefont{ + local($_) = @_; + local($text); + + $text = &missing_braces unless + (s/$next_pair_pr_rx/$text=$2;''/eo); + + "<B>$text</B>$_"; +} + +sub do_cmd_newacronym{ + local($_) = @_; + local($label,$abbrev,$long,$opt); + + ($opt,$pat) = &get_next_optional_argument; + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + $abbrv = &missing_braces unless + (s/$next_pair_pr_rx/$abbrv=$2;''/eo); + $long = &missing_braces unless + (s/$next_pair_pr_rx/$long=$2;''/eo); + + local($cmd) = "\\newglossaryentry"; + local($id); + $id = ++$global{'max_id'}; + $cmd .= "$OP$id$CP$label$OP$id$CP"; + $id = ++$global{'max_id'}; + local($entry) = "type=$OP$id$CP\\acronymtype$OP$id$CP,"; + $id = ++$global{'max_id'}; + $entry .= "name=$OP$id$CP$abbrv$OP$id$CP,"; + $id = ++$global{'max_id'}; + $entry .= "description=$OP$id$CP$long$OP$id$CP,"; + $id = ++$global{'max_id'}; + $entry .= "text=$OP$id$CP$abbrv$OP$id$CP,"; + $id = ++$global{'max_id'}; + $entry .= "first=$OP$id$CP$long ($abbrv)$OP$id$CP,"; + $id = ++$global{'max_id'}; + $entry .= "plural=$OP$id$CP${abbrv}s$OP$id$CP,"; + $id = ++$global{'max_id'}; + $entry .= "firstplural=$OP$id$CP${long}s (${abbrv}s)$OP$id$CP"; + + $id = ++$global{'max_id'}; + $cmd .= "$OP$id$CP$entry,$opt$OP$id$CP"; + + &translate_commands($cmd).$_; +} + +sub gls_entry_init{ + local($label, $type, $name, $desc) = @_; + + %{$glsentry{$label}} = + ( type => $type, + name => $name, + 'sort' => $name, + description => $description, + text => $name, + first => $name, + plural => "${name}s", + firstplural => "${name}s", + symbol => '', + flag => 0 + ); +} + +sub gls_get_type{ + local($label) = @_; + local($type) = ''; + + if (&gls_entry_defined($label)) + { + $type = $glsentry{$label}{'type'}; + } + else + { + &write_warnings("gls_get_type: glossary entry '$label' has not been defined"); + } + + $type; +} + +sub gls_set_type{ + local($label, $type) = @_; + + if (&gls_entry_defined($label)) + { + $glsentry{$label}{'type'} = $type; + } + else + { + &write_warnings("gls_set_type: glossary entry '$label' has not been defined"); + } +} + +sub gls_get_name{ + local($label) = @_; + local($name) = ''; + + if (&gls_entry_defined($label)) + { + $name = $glsentry{$label}{'name'}; + } + else + { + &write_warnings("gls_get_name: glossary entry '$label' has not been defined"); + } + + $name; +} + +sub gls_set_name{ + local($label, $name) = @_; + + if (&gls_entry_defined($label)) + { + $glsentry{$label}{'name'} = $name; + } + else + { + &write_warnings("gls_set_name: glossary entry '$label' has not been defined"); + } +} + +sub gls_get_description{ + local($label) = @_; + local($description) = ''; + + if (&gls_entry_defined($label)) + { + $description = $glsentry{$label}{'description'}; + } + else + { + &write_warnings("gls_get_description: glossary entry '$label' has not been defined"); + } + + $description; +} + +sub gls_set_description{ + local($label, $description) = @_; + + if (&gls_entry_defined($label)) + { + $glsentry{$label}{'description'} = $description; + } + else + { + &write_warnings("gls_set_description: glossary entry '$label' has not been defined"); + } +} + +sub gls_get_symbol{ + local($label) = @_; + local($symbol) = ''; + + if (&gls_entry_defined($label)) + { + $symbol = $glsentry{$label}{'symbol'}; + } + else + { + &write_warnings("gls_get_symbol: glossary entry '$label' has not been defined"); + } + + $symbol; +} + +sub gls_set_symbol{ + local($label, $symbol) = @_; + + if (&gls_entry_defined($label)) + { + $glsentry{$label}{'symbol'} = $symbol; + } + else + { + &write_warnings("gls_set_symbol: glossary entry '$label' has not been defined"); + } +} + +sub gls_get_sort{ + local($label) = @_; + local($sort) = ''; + + if (&gls_entry_defined($label)) + { + $sort = $glsentry{$label}{'sort'}; + } + else + { + &write_warnings("gls_get_sort: glossary entry '$label' has not been defined"); + } + + $sort; +} + +sub gls_set_sort{ + local($label, $sort) = @_; + + if (&gls_entry_defined($label)) + { + $glsentry{$label}{'sort'} = $sort; + } + else + { + &write_warnings("gls_set_sort: glossary entry '$label' has not been defined"); + } +} + +sub gls_get_text{ + local($label) = @_; + local($text) = ''; + + if (&gls_entry_defined($label)) + { + $text = $glsentry{$label}{'text'}; + } + else + { + &write_warnings("gls_get_text: glossary entry '$label' has not been defined"); + } + + $text; +} + +sub gls_set_text{ + local($label, $text) = @_; + + if (&gls_entry_defined($label)) + { + $glsentry{$label}{'text'} = $text; + } + else + { + &write_warnings("gls_set_text: glossary entry '$label' has not been defined"); + } +} + +sub gls_get_plural{ + local($label) = @_; + local($plural) = ''; + + if (&gls_entry_defined($label)) + { + $plural = $glsentry{$label}{'plural'}; + } + else + { + &write_warnings("gls_get_plural: glossary entry '$label' has not been defined"); + } + + $plural; +} + +sub gls_set_plural{ + local($label, $plural) = @_; + + if (&gls_entry_defined($label)) + { + $glsentry{$label}{'plural'} = $plural; + } + else + { + &write_warnings("gls_set_plural: glossary entry '$label' has not been defined"); + } +} + +sub gls_get_firstplural{ + local($label) = @_; + local($firstplural) = ''; + + if (&gls_entry_defined($label)) + { + $firstplural = $glsentry{$label}{'firstplural'}; + } + else + { + &write_warnings("gls_get_firstplural: glossary entry '$label' has not been defined"); + } + + $firstplural; +} + +sub gls_set_firstplural{ + local($label, $firstplural) = @_; + + if (&gls_entry_defined($label)) + { + $glsentry{$label}{'firstplural'} = $firstplural; + } + else + { + &write_warnings("gls_set_firstplural: glossary entry '$label' has not been defined"); + } +} + +sub gls_get_first{ + local($label) = @_; + local($first) = ''; + + if (&gls_entry_defined($label)) + { + $first = $glsentry{$label}{'first'}; + } + else + { + &write_warnings("gls_get_first: glossary entry '$label' has not been defined"); + } + + $first; +} + +sub gls_set_first{ + local($label, $first) = @_; + + if (&gls_entry_defined($label)) + { + $glsentry{$label}{'first'} = $first; + } + else + { + &write_warnings("gls_set_first: glossary entry '$label' has not been defined"); + } +} + +sub gls_used{ + local($label) = @_; + local($flag) = 0; + + if (&gls_entry_defined($label)) + { + $flag = $glsentry{$label}{'flag'}; + } + else + { + &write_warnings("gls_used: glossary entry '$label' has not been defined"); + } + + $flag; +} + +sub gls_entry_defined{ + local($label) = @_; + + defined(%{$glsentry{$label}}); +} + +sub do_cmd_newglossaryentry{ + local($_) = @_; + local($label,$name,$description,$symbol,$sort,$text,$first, + $plural,$firstplural,$type,$keyval); + + $label = &missing_braces unless + s/$next_pair_pr_rx/$label=$2;''/eo; + + $keyval = &missing_braces unless + s/$next_pair_pr_rx/$keyval=$2;''/eo; + + ($name,$keyval) = &get_keyval('name', $keyval); + ($description,$keyval) = &get_keyval('description', $keyval); + ($symbol,$keyval) = &get_keyval('symbol', $keyval); + ($sort,$keyval) = &get_keyval('sort', $keyval); + ($text,$keyval) = &get_keyval('text', $keyval); + ($first,$keyval) = &get_keyval('first', $keyval); + ($firstplural,$keyval) = &get_keyval('firstplural', $keyval); + ($plural,$keyval) = &get_keyval('plural', $keyval); + ($type,$keyval) = &get_keyval('type', $keyval); + + if (defined($type)) + { + $type = &translate_commands($type); + } + else + { + $type = 'main'; + } + + &gls_entry_init($label, $type, $name, $description); + + &gls_set_symbol($label, defined($symbol)?$symbol:''); + + $sort = "$name $description" unless (defined($sort) and $sort); + + &gls_set_sort($label, $sort); + + $text = $name unless (defined($text) and $text); + + &gls_set_text($label, $text); + + $first = $text unless (defined($first) and $first); + + &gls_set_first($label, $first); + + $plural = "${text}s" unless (defined($plural) and $plural); + + &gls_set_plural($label, $plural); + + $firstplural = "${first}s" unless (defined($firstplural) and $firstplural); + + &gls_set_firstplural($label, $firstplural); + + push @{$gls_entries{$type}}, $label; + + $_; +} + +sub reset_entry{ + local($label) = @_; + + $glsentry{$label}{'flag'} = 0; +} + +sub unset_entry{ + local($label) = @_; + + $glsentry{$label}{'flag'} = 1; +} + +sub do_cmd_glsreset{ + local($_) = @_; + local($label); + + $label = &missing_braces unless + s/$next_pair_pr_rx/$label=$2;''/eo; + + &reset_entry($label); + + $_; +} + +sub do_cmd_glsunset{ + local($_) = @_; + local($label); + + $label = &missing_braces unless + s/$next_pair_pr_rx/$label=$2;''/eo; + + &unset_entry($label); + + $_; +} + +sub do_cmd_ifglsused{ + local($_) = @_; + local($label,$true,$false); + + $label = &missing_braces unless + s/$next_pair_pr_rx/$label=$2;''/eo; + + $true = &missing_braces unless + s/$next_pair_pr_rx/$true=$2;''/eo; + + $false = &missing_braces unless + s/$next_pair_pr_rx/$false=$2;''/eo; + + (&gls_used($label) ? $true : $false) . $_; +} + +sub do_cmd_ifglsentryexists{ + local($_) = @_; + local($label,$true,$false); + + $label = &missing_braces unless + s/$next_pair_pr_rx/$label=$2;''/eo; + + $true = &missing_braces unless + s/$next_pair_pr_rx/$true=$2;''/eo; + + $false = &missing_braces unless + s/$next_pair_pr_rx/$false=$2;''/eo; + + (&gls_entry_defined($label) ? $true : $false) . $_; +} + +sub gls_add_entry{ + local($type, $label, $format, $text) = @_; + + local($oldfmt) = $GLSCURRENTFORMAT; + + if (defined($format) and $format) + { + $GLSCURRENTFORMAT=$format; + } + + $id = ++$global{'max_id'}; + + local($str) = &make_real_glossary_entry($label,$text,$type); + $GLSCURRENTFORMAT = $oldfmt; + + $str; +} + +sub do_cmd_glsadd{ + local($_) = @_; + local($optarg,$pat,$label,$str,$id,$type,$format); + ($optarg,$pat) = &get_next_optional_argument; + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + $type = &gls_get_type($label); + + if (defined $type) + { + ($format,$optarg) = &get_keyval('format', $optarg); + $format='' unless(defined($format)); + + &gls_add_entry($type,$label,$format,""); + } + else + { + &write_warnings("gls_add: glossary entry '$label' undefined"); + $str = ''; + } + + $str . $_; +} + +sub do_cmd_glsaddall{ + local($_) = @_; + local($optarg,$pat) = &get_next_optional_argument; + + local($format,$types); + + ($type,$optarg) = &get_keyval('types', $optarg); + + ($format,$optarg) = &get_keyval('format', $optarg); + $format='' unless(defined($format)); + + local(@types) = keys(%gls_mark); + + if (defined($types)) + { + @types = split /,/, $types; + } + + foreach $type (@types) + { + # strip leasing and trailing spaces + $type=~s/^\s*([^\s]+)\s*$/\1/; + + foreach $label (@{$gls_entries{$type}}) + { + &gls_add_entry($type,$label,$format,""); + } + } + + $_; +} + +sub do_cmd_glsresetall{ + local($_) = @_; + local($types,$pat) = &get_next_optional_argument; + + local(@types) = keys(%gls_mark); + + if (defined($types) and $types) + { + @types = split /,/, $types; + } + + foreach $type (@types) + { + # strip leasing and trailing spaces + $type=~s/^\s*([^\s]+)\s*$/\1/; + + foreach $label (@{$gls_entries{$type}}) + { + &reset_entry($label); + } + } + + $_; +} + +sub do_cmd_glsunsetall{ + local($_) = @_; + local($types,$pat) = &get_next_optional_argument; + + local(@types) = keys(%gls_mark); + + if (defined($types) and $types) + { + @types = split /,/, $types; + } + + foreach $type (@types) + { + # strip leasing and trailing spaces + $type=~s/^\s*([^\s]+)\s*$/\1/; + + foreach $label (@{$gls_entries{$type}}) + { + &reset_entry($label); + } + } + + $_; +} + +sub make_glslink{ + local($type,$label,$format,$text) = @_; + local($str) = ''; + + if (defined $type) + { + $str = &gls_add_entry($type,$label,$format,$text); + } + else + { + &write_warnings("glossary '$type' undefined"); + } + + $str; +} + +sub do_cmd_glslink{ + local($_) = @_; + local($optarg,$pat,$label,$text,$type,$format,$str); + + ($optarg,$pat) = &get_next_optional_argument; + + ($format,$optarg) = &get_keyval('format', $optarg); + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + $text = &missing_braces unless + (s/$next_pair_pr_rx/$text=$2;''/eo); + + local ($space) = ''; + if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';} + ($optarg,$pat) = &get_next_optional_argument; + + $type = &gls_get_type($label); + + &make_glslink($type, $label, $format, $text).$space . $_; +} + +sub do_cmd_glsentrydesc{ + local($_) = @_; + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + &gls_get_description($label).$_; +} + +sub do_cmd_Glsentrydesc{ + local($_) = @_; + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + ucfirst(&gls_get_description($label)).$_; +} + +sub do_cmd_glsentrytext{ + local($_) = @_; + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + &gls_get_text($label).$_; +} + +sub do_cmd_Glsentrytext{ + local($_) = @_; + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + ucfirst(&gls_get_text($label)).$_; +} + +sub do_cmd_glsentryname{ + local($_) = @_; + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + &gls_get_name($label).$_; +} + +sub do_cmd_Glsentryname{ + local($_) = @_; + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + ucfirst(&gls_get_name($label)).$_; +} + +sub do_cmd_glsentryfirst{ + local($_) = @_; + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + &gls_get_first($label).$_; +} + +sub do_cmd_Glsentryfirst{ + local($_) = @_; + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + ucfirst(&gls_get_first($label)).$_; +} + +sub do_cmd_glsentryplural{ + local($_) = @_; + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + &gls_get_plural($label).$_; +} + +sub do_cmd_Glsentryplural{ + local($_) = @_; + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + ucfirst(&gls_get_plural($label)).$_; +} + +sub do_cmd_glsentryfirstplural{ + local($_) = @_; + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + local($text)=$glsentry{$label}{'firstplural'}; + + unless (defined($text)) + { + &write_warnings("glossary entry '$label' has not been defined"); + $text = ''; + } + + "$text$_"; + &gls_get_firstplural($label).$_; +} + +sub do_cmd_Glsentryfirstplural{ + local($_) = @_; + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + ucfirst(&gls_get_firstplural($label)).$_; +} + +sub do_cmd_glsentrysymbol{ + local($_) = @_; + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + &gls_get_symbol($label).$_; +} + +sub do_cmd_Glsentrysymbol{ + local($_) = @_; + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + ucfirst(&gls_get_symbol($label)).$_; +} + +sub do_cmd_gls{ + local($_) = @_; + local($optarg,$pat,$label,$text, $format, $insert); + + ($optarg,$pat) = &get_next_optional_argument; + + ($format,$optarg) = &get_keyval('format', $optarg); + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + local ($space) = ''; + if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';} + + $insert = ''; + ($insert,$pat) = &get_next_optional_argument; + + local($display) = ''; + + local($type) = &gls_get_type($label); + + if (&gls_used($label)) + { + # entry has already been used + + $text = &gls_get_text($label); + $display = &gls_get_display($type);; + } + else + { + # entry hasn't been used + + $text = &gls_get_first($label); + $display = &gls_get_displayfirst($type); + + &unset_entry($label); + } + + local($args) = ''; + + local($id) = ++$global{'max_id'}; + $args .= "$OP$id$CP$text$OP$id$CP"; + + $id = ++$global{'max_id'}; + $args .= "$OP$id$CP$glsentry{$label}{description}$OP$id$CP"; + + $id = ++$global{'max_id'}; + $args .= "$OP$id$CP$glsentry{$label}{symbol}$OP$id$CP"; + + $id = ++$global{'max_id'}; + $args .= "$OP$id$CP$insert$OP$id$CP"; + + local($link_text) = &translate_commands("$display$args"); + + &make_glslink($type, $label, $format, $link_text) .$space . $_; +} + +sub do_cmd_glspl{ + local($_) = @_; + local($optarg,$pat,$label,$text, $format, $insert); + + ($optarg,$pat) = &get_next_optional_argument; + + ($format,$optarg) = &get_keyval('format', $optarg); + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + local ($space) = ''; + if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';} + + $insert = ''; + ($insert,$pat) = &get_next_optional_argument; + + local($display) = ''; + + local($type) = $glsentry{$label}{'type'}; + + if (&gls_used($label)) + { + # entry has already been used + + $text = &gls_get_plural($label); + $display = &gls_get_display($type);; + } + else + { + # entry hasn't been used + + $text = &gls_get_firstplural($label); + $display = &gls_get_displayfirst($type); + + &unset_entry($label); + } + + local($args) = ''; + + local($id) = ++$global{'max_id'}; + $args .= "$OP$id$CP$text$OP$id$CP"; + + $id = ++$global{'max_id'}; + $args .= "$OP$id$CP$glsentry{$label}{description}$OP$id$CP"; + + $id = ++$global{'max_id'}; + $args .= "$OP$id$CP$glsentry{$label}{symbol}$OP$id$CP"; + + $id = ++$global{'max_id'}; + $args .= "$OP$id$CP$insert$OP$id$CP"; + + local($link_text) = &translate_commands("$display$args"); + + &make_glslink($type, $label, $format, $link_text) . $space . $_; +} + +sub do_cmd_Gls{ + local($_) = @_; + local($optarg,$pat,$label,$text, $format, $insert); + + ($optarg,$pat) = &get_next_optional_argument; + + ($format,$optarg) = &get_keyval('format', $optarg); + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + local ($space) = ''; + if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';} + + $insert = ''; + ($insert,$pat) = &get_next_optional_argument; + + local($display) = ''; + + local($type) = $glsentry{$label}{'type'}; + + if (&gls_used($label)) + { + # entry has already been used + + $text = &gls_get_text($label); + $display = &gls_get_display($type);; + } + else + { + # entry hasn't been used + + $text = &gls_get_first($label); + $display = &gls_get_displayfirst($type); + + &unset_entry($label); + } + + local($args) = ''; + + local($id) = ++$global{'max_id'}; + $args .= "$OP$id$CP$text$OP$id$CP"; + + $id = ++$global{'max_id'}; + $args .= "$OP$id$CP$glsentry{$label}{description}$OP$id$CP"; + + $id = ++$global{'max_id'}; + $args .= "$OP$id$CP$glsentry{$label}{symbol}$OP$id$CP"; + + $id = ++$global{'max_id'}; + $args .= "$OP$id$CP$insert$OP$id$CP"; + + local($link_text) = &translate_commands("$display$args"); + + &make_glslink($type, $label, $format, ucfirst($link_text)). $space . $_; +} + +sub do_cmd_Glspl{ + local($_) = @_; + local($optarg,$pat,$label,$text, $format, $insert); + + ($optarg,$pat) = &get_next_optional_argument; + + ($format,$optarg) = &get_keyval('format', $optarg); + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + local ($space) = ''; + if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';} + + $insert = ''; + ($insert,$pat) = &get_next_optional_argument; + + local($display) = ''; + + local($type) = $glsentry{$label}{'type'}; + + if (&gls_used($label)) + { + # entry has already been used + + $text = &gls_get_plural($label); + $display = &gls_get_display($type);; + } + else + { + # entry hasn't been used + + $text = &gls_get_firstplural($label); + $display = &gls_get_displayfirst($type); + + &unset_entry($label); + } + + local($args) = ''; + + local($id) = ++$global{'max_id'}; + $args .= "$OP$id$CP$text$OP$id$CP"; + + $id = ++$global{'max_id'}; + $args .= "$OP$id$CP$glsentry{$label}{description}$OP$id$CP"; + + $id = ++$global{'max_id'}; + $args .= "$OP$id$CP$glsentry{$label}{symbol}$OP$id$CP"; + + $id = ++$global{'max_id'}; + $args .= "$OP$id$CP$insert$OP$id$CP"; + + local($link_text) = &translate_commands("$display$args"); + + &make_glslink($type, $label, $format, ucfirst($link_text)).$space . $_; +} + +sub do_cmd_GLS{ + local($_) = @_; + local($optarg,$pat,$label,$text, $format, $insert); + + ($optarg,$pat) = &get_next_optional_argument; + + ($format,$optarg) = &get_keyval('format', $optarg); + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + local ($space) = ''; + if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';} + + $insert = ''; + ($insert,$pat) = &get_next_optional_argument; + + local($display) = ''; + + local($type) = $glsentry{$label}{'type'}; + + if (&gls_used($label)) + { + # entry has already been used + + $text = &gls_get_text($label); + $display = &gls_get_display($type);; + } + else + { + # entry hasn't been used + + $text = &gls_get_first($label); + $display = &gls_get_displayfirst($type); + + &unset_entry($label); + } + + local($args) = ''; + + local($id) = ++$global{'max_id'}; + $args .= "$OP$id$CP$text$OP$id$CP"; + + $id = ++$global{'max_id'}; + $args .= "$OP$id$CP$glsentry{$label}{description}$OP$id$CP"; + + $id = ++$global{'max_id'}; + $args .= "$OP$id$CP$glsentry{$label}{symbol}$OP$id$CP"; + + $id = ++$global{'max_id'}; + $args .= "$OP$id$CP$insert$OP$id$CP"; + + local($link_text) = &translate_commands("$display$args"); + + &make_glslink($type, $label, $format, uc($link_text)).$space . $_; +} + +sub do_cmd_GLSpl{ + local($_) = @_; + local($optarg,$pat,$label,$text, $format, $insert); + + ($optarg,$pat) = &get_next_optional_argument; + + ($format,$optarg) = &get_keyval('format', $optarg); + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + local ($space) = ''; + if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';} + + $insert = ''; + ($insert,$pat) = &get_next_optional_argument; + + local($display) = ''; + + local($type) = $glsentry{$label}{'type'}; + + if (&gls_used($label)) + { + # entry has already been used + + $text = &gls_get_plural($label); + $display = &gls_get_display($type);; + } + else + { + # entry hasn't been used + + $text = &gls_get_firstplural($label); + $display = &gls_get_displayfirst($type); + + &unset_entry($label); + } + + local($args) = ''; + + local($id) = ++$global{'max_id'}; + $args .= "$OP$id$CP$text$OP$id$CP"; + + $id = ++$global{'max_id'}; + $args .= "$OP$id$CP$glsentry{$label}{description}$OP$id$CP"; + + $id = ++$global{'max_id'}; + $args .= "$OP$id$CP$glsentry{$label}{symbol}$OP$id$CP"; + + $id = ++$global{'max_id'}; + $args .= "$OP$id$CP$insert$OP$id$CP"; + + local($link_text) = &translate_commands("$display$args"); + + &make_glslink($type, $label, $format, uc($link_text)).$space . $_; +} + +sub do_cmd_glossarypreamble{ + local($_) = @_; + $_[0]; +} + +sub do_cmd_glossarypostamble{ + local($_) = @_; + $_[0]; +} + +sub do_cmd_glsnumformat{ + local($_) = @_; + + $_; +} + +sub do_cmd_hyperit{ + join('', "\\textit ", $_[0]); +} + +sub do_cmd_hyperrm{ + join('', "\\textrm ", $_[0]); +} + +sub do_cmd_hypertt{ + join('', "\\texttt ", $_[0]); +} + +sub do_cmd_hypersf{ + join('', "\\textsf ", $_[0]); +} + +sub do_cmd_hyperbf{ + join('', "\\textbf ", $_[0]); +} + +&ignore_commands( <<_IGNORED_CMDS_ ); +makeglossary +makeglossaries +_IGNORED_CMDS_ + +1; diff --git a/Master/texmf-dist/doc/latex/glossaries/scripts/makeglossaries b/Master/texmf-dist/doc/latex/glossaries/scripts/makeglossaries new file mode 100755 index 00000000000..8da802b1791 --- /dev/null +++ b/Master/texmf-dist/doc/latex/glossaries/scripts/makeglossaries @@ -0,0 +1,210 @@ +#!/usr/bin/perl + +# File : makeglossaries +# Author : Nicola Talbot +# Version : 1.0 (2007/05/10) +# Description: simple Perl script that calls makeindex. +# Intended for use with "glossaries.sty" (saves having to remember +# all the various switches) + +use Getopt::Std; + +if ($#ARGV < 0) +{ + die "Syntax : $0 [-ilqrcg] [-s sty] [-o gls] [-t log] [-p num] <filename>\n"; +} + +getopt('sotp'); +getopts('ilqrcg'); + +# define known extensions + + %exttype = ( + main => {in=>'glo', out=>'gls', 'log'=>'glg'}, + ); + +$ext = ''; + +if (length(@ARGV[0]) < 4) +{ + $name = @ARGV[0]; +} +elsif (substr(@ARGV[0],-4,1) eq ".") +{ + $name = substr(@ARGV[0],0,length(@ARGV[0])-4); + + $ext = substr(@ARGV[0],-3,3); +} +else +{ + $name = @ARGV[0]; +} + +$istfile = "$name.ist"; + +# check log file for other glossary types +# and for ist file name + +if (open AUXFILE, "$name.aux") +{ + while (<AUXFILE>) + { + if (m/\\\@newglossary\s*\{(.*)\}{(.*)}{(.*)}{(.*)}/ + and ($1 ne 'main')) + { + $exttype{$1}{'log'} = $2; + $exttype{$1}{'out'} = $3; + $exttype{$1}{'in'} = $4; + + if (!$opt_q) + { + print "added glossary type '$1' ($2,$3,$4)\n"; + } + } + + if (m/\\\@istfilename\s*{([^}]*)}/) + { + $istfile = $1; + } + } + + close AUXFILE; +} +else +{ + print "unable to open $name.aux\n"; +} + +# save all the general makeindex switches + +$mkidxopts = ''; + +if ($opt_i) +{ + $mkidxopts .= " -i"; +} + +if ($opt_l) +{ + $mkidxopts .= " -l"; +} + +if ($opt_q) +{ + $mkidxopts .= " -q"; +} + +if ($opt_r) +{ + $mkidxopts .= " -r"; +} + +if ($opt_c) +{ + $mkidxopts .= " -c"; +} + +if ($opt_g) +{ + $mkidxopts .= " -g"; +} + +unless ($opt_p eq "") +{ + $mkidxopts .= " -p $opt_p"; +} + +unless ($opt_s eq "") +{ + $istfile = $opt_s; +} + +if ($ext ne '') +{ + %thistype = %{$exttype{'main'}}; #default + + foreach $type (keys %exttype) + { + if ($exttype{$type}{'in'} eq $ext) + { + %thistype = %{$exttype{$type}}; + + last; + } + } + + if ($opt_o eq "") + { + $outfile = "$name.$thistype{out}"; + } + else + { + $outfile = $opt_o; + } + + if ($opt_t eq "") + { + $transcript = "$name.$thistype{'log'}"; + } + else + { + $transcript = $opt_t; + } + + &makeindex("$name.$ext",$outfile,$transcript,$istfile, + $mkidxopts,$opt_q); +} +else +{ + foreach $type (keys %exttype) + { + %thistype = %{$exttype{$type}}; + + $inputfile = "$name.$thistype{in}"; + + if (-r $inputfile) + { + if ($opt_o eq "") + { + $outfile = "$name.$thistype{out}"; + } + else + { + $outfile = $opt_o; + } + + if ($opt_t eq "") + { + $transcript = "$name.$thistype{'log'}"; + } + else + { + $transcript = $opt_t; + } + + &makeindex($inputfile,$outfile,$transcript, + $istfile,$mkidxopts,$opt_q); + } + elsif (!$opt_q) + { + print "no read access for '$inputfile'\n"; + } + } +} + +sub makeindex{ + local($in,$out,$trans,$ist,$rest,$quiet) = @_; + local($name,$cmdstr,$buffer,$n,$i,$j); + local(@stuff,@item); + + $cmdstr = "$rest -s $ist -t $trans -o $out $in"; + + unless ($quiet) + { + print "makeindex $cmdstr\n"; + } + + `makeindex $cmdstr`; +} + +1; diff --git a/Master/texmf-dist/doc/latex/glossaries/scripts/makeglossaries.bat b/Master/texmf-dist/doc/latex/glossaries/scripts/makeglossaries.bat new file mode 100755 index 00000000000..64a6a20750c --- /dev/null +++ b/Master/texmf-dist/doc/latex/glossaries/scripts/makeglossaries.bat @@ -0,0 +1,3 @@ +@rem = '-*- Perl -*-
+@echo off
+perl -S "%~dp0makeglossaries" %*
|