summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2007-09-16 00:15:29 +0000
committerKarl Berry <karl@freefriends.org>2007-09-16 00:15:29 +0000
commitb4f513643e9222ff96f871b92cbd9d94c8ec1096 (patch)
treef7dab4c89fab94386b4ad7ea5438c9eaf25e8977 /Master
parent11826a2e3ed54621c66e5c34ebe977a0ba45c8ae (diff)
glossaries 1.07 (14sep07)
git-svn-id: svn://tug.org/texlive/trunk@4949 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/latex/glossaries/README4
-rw-r--r--Master/texmf-dist/doc/latex/glossaries/doc/CHANGES (renamed from Master/texmf-dist/doc/latex/glossaries/CHANGES)12
l---------Master/texmf-dist/doc/latex/glossaries/doc/README1
-rw-r--r--Master/texmf-dist/doc/latex/glossaries/doc/glossaries.pdfbin472066 -> 475628 bytes
-rw-r--r--Master/texmf-dist/doc/latex/glossaries/doc/sample.tex4
-rw-r--r--Master/texmf-dist/doc/latex/glossaries/glossaries.perl (renamed from Master/texmf-dist/doc/latex/glossaries/latex2html/styles/glossaries.perl)50
-rw-r--r--Master/texmf-dist/doc/latex/glossaries/latex2html/glossaries.perl1713
-rwxr-xr-xMaster/texmf-dist/doc/latex/glossaries/perl/makeglossaries (renamed from Master/texmf-dist/doc/latex/glossaries/scripts/makeglossaries)19
-rwxr-xr-xMaster/texmf-dist/doc/latex/glossaries/perl/makeglossaries.bat (renamed from Master/texmf-dist/doc/latex/glossaries/scripts/makeglossaries.bat)0
-rw-r--r--Master/texmf-dist/source/latex/glossaries/glossaries.dtx1816
-rw-r--r--Master/texmf-dist/source/latex/glossaries/glossaries.ins35
-rw-r--r--Master/texmf-dist/tex/latex/glossaries/glossaries.sty37
-rw-r--r--Master/texmf-dist/tex/latex/glossaries/glossary-hypernav.sty26
-rw-r--r--Master/texmf-dist/tex/latex/glossaries/glossary-list.sty26
-rw-r--r--Master/texmf-dist/tex/latex/glossaries/glossary-long.sty26
-rw-r--r--Master/texmf-dist/tex/latex/glossaries/glossary-super.sty26
16 files changed, 3697 insertions, 98 deletions
diff --git a/Master/texmf-dist/doc/latex/glossaries/README b/Master/texmf-dist/doc/latex/glossaries/README
index 843f528baca..eb8924735a1 100644
--- a/Master/texmf-dist/doc/latex/glossaries/README
+++ b/Master/texmf-dist/doc/latex/glossaries/README
@@ -1,6 +1,6 @@
-LaTeX Package : glossaries v 1.04
+LaTeX Package : glossaries v 1.07
-Last Modified : 3 August 2007
+Last Modified : 13 September 2007
Author : Nicola Talbot
diff --git a/Master/texmf-dist/doc/latex/glossaries/CHANGES b/Master/texmf-dist/doc/latex/glossaries/doc/CHANGES
index 485ca845623..f9dce2cc0a9 100644
--- a/Master/texmf-dist/doc/latex/glossaries/CHANGES
+++ b/Master/texmf-dist/doc/latex/glossaries/doc/CHANGES
@@ -1,5 +1,17 @@
glossaries change log:
+v1.07 (13 Sep 2007):
+ * Fixed bug causing incorrect page number for entries in the
+ first paragraph of a page.
+
+v1.06 (21 Aug 2007):
+ * Changed the license text
+
+v1.05 (10 Aug 2007):
+ * Changed the default value of the sort key to just use the
+ name key
+ * Added \@mkboth to \glossarysection
+
v1.04 (3 Aug 2007):
* Added \glstextformat
diff --git a/Master/texmf-dist/doc/latex/glossaries/doc/README b/Master/texmf-dist/doc/latex/glossaries/doc/README
new file mode 120000
index 00000000000..59a23c461da
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/glossaries/doc/README
@@ -0,0 +1 @@
+../README \ No newline at end of file
diff --git a/Master/texmf-dist/doc/latex/glossaries/doc/glossaries.pdf b/Master/texmf-dist/doc/latex/glossaries/doc/glossaries.pdf
index 0404aa4144f..7adbe440f7e 100644
--- a/Master/texmf-dist/doc/latex/glossaries/doc/glossaries.pdf
+++ b/Master/texmf-dist/doc/latex/glossaries/doc/glossaries.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/glossaries/doc/sample.tex b/Master/texmf-dist/doc/latex/glossaries/doc/sample.tex
index 3110d9b8d17..1555f0c31d3 100644
--- a/Master/texmf-dist/doc/latex/glossaries/doc/sample.tex
+++ b/Master/texmf-dist/doc/latex/glossaries/doc/sample.tex
@@ -26,7 +26,7 @@ description={rectangular array of quantities},
plural=matrices}
\newcommand{\pardescription}{distinct section of piece of
-writing\par beginning on new usually indented line}
+writing.\par Beginning on new, usually indented, line}
\newglossaryentry{par}{name=paragraph,
description=\pardescription}
@@ -68,6 +68,8 @@ 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.
+\Glspl{par} can cause a problem in commands.
+
\printglossaries
\end{document}
diff --git a/Master/texmf-dist/doc/latex/glossaries/latex2html/styles/glossaries.perl b/Master/texmf-dist/doc/latex/glossaries/glossaries.perl
index d6f1b0fd6e8..22ad50f784c 100644
--- a/Master/texmf-dist/doc/latex/glossaries/latex2html/styles/glossaries.perl
+++ b/Master/texmf-dist/doc/latex/glossaries/glossaries.perl
@@ -1,10 +1,31 @@
-# File : glossaries.perl
-# Author : Nicola Talbot
-# Date : 14th June 2007
-# Version : 1.01
-# Description : LaTeX2HTML (limited!) implementation of glossaries
-# package. Note that not all the glossaries.sty
-# macros have been implemented.
+# File : glossaries.perl
+# Author : Nicola L.C. Talbot
+# Date : 14th June 2007
+# Last Modified : 21st Aug 2007
+# Version : 1.02
+# Description : LaTeX2HTML (limited!) implementation of glossaries
+# package. Note that not all the glossaries.sty
+# macros have been implemented.
+
+# This is a LaTeX2HTML style implementing the glossaries package, and
+# is distributed as part of that package.
+# Copyright 2007 Nicola L.C. Talbot
+# This work may be distributed and/or modified under the
+# conditions of the LaTeX Project Public License, either version 1.3
+# of this license of (at your option) any later version.
+# The latest version of this license is in
+# http://www.latex-project.org/lppl.txt
+# and version 1.3 or later is part of all distributions of LaTeX
+# version 2005/12/01 or later.
+#
+# This work has the LPPL maintenance status `maintained'.
+#
+# The Current Maintainer of this work is Nicola Talbot.
+
+# This work consists of the files glossaries.dtx and glossaries.ins
+# and the derived files glossaries.sty, glossary-hypernav.sty,
+# glossary-list.sty, glossary-long.sty, glossary-super.sty,
+# glossaries.perl. Also makeglossaries and makeglossaries.bat
package main;
@@ -34,7 +55,6 @@ $glsnumformat{'main'} = $GLSCURRENTFORMAT;
$gls_displayfirst{'main'} = "glsdisplayfirst";
$gls_display{'main'} = "glsdisplay";
-%glsentry = ();
$acronymtype = 'main';
@@ -183,7 +203,7 @@ sub add_real_gls{
: "<DT>"
. $name
. "<DD>"
- . $glsentry{$entry}{'description'}
+ . $glsentry{$entry}{'description'}
. $symbol . '. '
. $glossary{$type}{$key}
. $linktext. "</A>\n");
@@ -385,7 +405,7 @@ sub do_real_glossary {
local($type,$pat) = &get_next_optional_argument;
- $entry = &missing_braces unless
+ $entry = &missing_braces unless
(s/$next_pair_pr_rx//o&&($entry=$2));
$anchor = &make_glossary_entry($entry,$anchor_invisible_mark,$type);
@@ -420,13 +440,13 @@ sub do_cmd_newglossary{
($opt,$pat) = &get_next_optional_argument;
- $type = &missing_braces unless
+ $type = &missing_braces unless
(s/$next_pair_pr_rx//o&&($type=$2));
- $in = &missing_braces unless
+ $in = &missing_braces unless
(s/$next_pair_pr_rx//o&&($in=$2));
- $out = &missing_braces unless
+ $out = &missing_braces unless
(s/$next_pair_pr_rx//o&&($out=$2));
- $title = &missing_braces unless
+ $title = &missing_braces unless
(s/$next_pair_pr_rx//o&&($title=$2));
($opt,$pat) = &get_next_optional_argument;
@@ -580,7 +600,7 @@ sub do_cmd_newacronym{
sub gls_entry_init{
local($label, $type, $name, $desc) = @_;
- %{$glsentry{$label}} =
+ %{$glsentry{$label}} =
( type => $type,
name => $name,
'sort' => $name,
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..22ad50f784c
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/glossaries/latex2html/glossaries.perl
@@ -0,0 +1,1713 @@
+# File : glossaries.perl
+# Author : Nicola L.C. Talbot
+# Date : 14th June 2007
+# Last Modified : 21st Aug 2007
+# Version : 1.02
+# Description : LaTeX2HTML (limited!) implementation of glossaries
+# package. Note that not all the glossaries.sty
+# macros have been implemented.
+
+# This is a LaTeX2HTML style implementing the glossaries package, and
+# is distributed as part of that package.
+# Copyright 2007 Nicola L.C. Talbot
+# This work may be distributed and/or modified under the
+# conditions of the LaTeX Project Public License, either version 1.3
+# of this license of (at your option) any later version.
+# The latest version of this license is in
+# http://www.latex-project.org/lppl.txt
+# and version 1.3 or later is part of all distributions of LaTeX
+# version 2005/12/01 or later.
+#
+# This work has the LPPL maintenance status `maintained'.
+#
+# The Current Maintainer of this work is Nicola Talbot.
+
+# This work consists of the files glossaries.dtx and glossaries.ins
+# and the derived files glossaries.sty, glossary-hypernav.sty,
+# glossary-list.sty, glossary-long.sty, glossary-super.sty,
+# glossaries.perl. Also makeglossaries and makeglossaries.bat
+
+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";
+
+
+$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, $_);
+ last unless defined($value);
+ }
+
+ ($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);
+
+ # v1.01 removed following lines (\glslink doesn't have
+ # a final optional argument!
+ #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 . $_;
+ &make_glslink($type, $label, $format, $text) . $_;
+}
+
+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/perl/makeglossaries
index 8da802b1791..aaa0c1b36d0 100755
--- a/Master/texmf-dist/doc/latex/glossaries/scripts/makeglossaries
+++ b/Master/texmf-dist/doc/latex/glossaries/perl/makeglossaries
@@ -7,6 +7,25 @@
# Intended for use with "glossaries.sty" (saves having to remember
# all the various switches)
+# This file is distributed as part of the glossaries LaTeX package.
+# Copyright 2007 Nicola L.C. Talbot
+# This work may be distributed and/or modified under the
+# conditions of the LaTeX Project Public License, either version 1.3
+# of this license of (at your option) any later version.
+# The latest version of this license is in
+# http://www.latex-project.org/lppl.txt
+# and version 1.3 or later is part of all distributions of LaTeX
+# version 2005/12/01 or later.
+#
+# This work has the LPPL maintenance status `maintained'.
+#
+# The Current Maintainer of this work is Nicola Talbot.
+
+# This work consists of the files glossaries.dtx and glossaries.ins
+# and the derived files glossaries.sty, glossary-hypernav.sty,
+# glossary-list.sty, glossary-long.sty, glossary-super.sty,
+# glossaries.perl. Also makeglossaries and makeglossaries.
+
use Getopt::Std;
if ($#ARGV < 0)
diff --git a/Master/texmf-dist/doc/latex/glossaries/scripts/makeglossaries.bat b/Master/texmf-dist/doc/latex/glossaries/perl/makeglossaries.bat
index 64a6a20750c..64a6a20750c 100755
--- a/Master/texmf-dist/doc/latex/glossaries/scripts/makeglossaries.bat
+++ b/Master/texmf-dist/doc/latex/glossaries/perl/makeglossaries.bat
diff --git a/Master/texmf-dist/source/latex/glossaries/glossaries.dtx b/Master/texmf-dist/source/latex/glossaries/glossaries.dtx
index 1b3e061e121..a86c855cb85 100644
--- a/Master/texmf-dist/source/latex/glossaries/glossaries.dtx
+++ b/Master/texmf-dist/source/latex/glossaries/glossaries.dtx
@@ -1,14 +1,18 @@
%\iffalse
-% glossaries.dtx generated using makedtx version 0.93b (c) Nicola Talbot
+% glossaries.dtx generated using makedtx version 0.94b (c) Nicola Talbot
% Command line args:
+% -macrocode "glossaries\.perl"
% -src "glossaries.sty=>glossaries.sty"
% -src "(glossary-.+)\.(sty)\Z=>\1.\2"
-% -doc "manual.tex"
+% -src "glossaries\.perl=>glossaries.perl"
% -author "Nicola Talbot"
-% -codetitle "Documented Code"
% -dir "source"
+% -setambles "glossaries\.perl=>\nopreamble\nopostamble"
+% -comment "glossaries\.perl"
+% -doc "manual.tex"
+% -codetitle "Documented Code"
% glossaries
-% Created on 2007/8/3 17:26
+% Created on 2007/9/13 20:21
%\fi
%\iffalse
%<*package>
@@ -59,7 +63,7 @@
\makeatother
\RecordChanges
\PageIndex
-\CheckSum{2821}
+\CheckSum{2826}
\CodelineNumbered
\newcommand*{\termdef}[1]{\emph{#1}\iterm{#1}}
\newcommand*{\term}[1]{#1\iterm{#1}}
@@ -92,7 +96,7 @@
%\MakeShortVerb{"}
%\DeleteShortVerb{\|}
%
-% \title{glossaries.sty v 1.04: \LaTeXe\ Package to Assist Generating Glossaries}
+% \title{glossaries.sty v 1.07: \LaTeXe\ Package to Assist Generating Glossaries}
% \author{Nicola L.C. Talbot\\[10pt]
%School of Computing Sciences\\
%University of East Anglia\\
@@ -100,7 +104,7 @@
%NR4 7TJ. United Kingdom.\\
%\url{http://theoval.cmp.uea.ac.uk/~nlct/}}
%
-% \date{3rd August 2007}
+% \date{13th September 2007}
% \maketitle
%\tableofcontents
%
@@ -140,6 +144,19 @@
%There is a batch file called \texttt{makeglossaries.bat} which
%does this for Windows users.
%
+%If you don't have Perl installed, you will have to run
+%\appname{makeindex} for each glossary type you have defined.
+%For example, if you have used the \pkgopt{acronym} package option,
+%so you have both a main glossary as well as a list of acronyms, you
+%will need to do (assuming your document is called \texttt{myfile.tex}):
+%\begin{verbatim}
+%makeindex -s myfile.ist -t myfile.glg -o myfile.gls myfile.glo
+%makeindex -s myfile.ist -t myfile.alg -o myfile.acr myfile.acn
+%\end{verbatim}
+%This requires remembering all extensions for each of the glossaries
+%defined in your document, so where possible you should use
+%\appname{makeglossaries} instead to reduce the possibility of error.
+%
%This documentation is structured as follows: \autoref{sec:quick}
%is for people who want a few quick pointers of how to get started,
%without having to read through lengthy descriptions,
@@ -429,25 +446,25 @@
%to mark the beginning and ending of the range\footnote{This is new
%to version 1.01}. For example:
%\begin{verbatim}
-%\glsadd[format=(]{singmtx}
-%This is a very long section all about \glspl{singmtx}.
+% \glsadd[format=(]{singmtx}
+% This is a very long section all about \glspl{singmtx}.
%
-%% lots of text omitted
+% % lots of text omitted
%
-%\glsadd[format=)]{singmtx}
+% \glsadd[format=)]{singmtx}
%\end{verbatim}
%This is equivalent to \appname{makeindex}'s "|(" and "|)" formats.
%
%\item You can combine the range markers with a formatting command
%(again without the preceding backslash.) For example:
%\begin{verbatim}
-%This is the start of a very long section all
-%about \glspl[format=(hyperbf]{singmtx}.
+% This is the start of a very long section all
+% about \glspl[format=(hyperbf]{singmtx}.
%
-%% lots of text omitted
+% % lots of text omitted
%
-%This is the end a very long section all about
-%\glspl[format=)hyperbf]{singmtx}.
+% This is the end a very long section all about
+% \glspl[format=)hyperbf]{singmtx}.
%\end{verbatim}
%
%\item Only those terms that have actually been used in the
@@ -656,9 +673,10 @@
%\item[{\gloskey{symbol}}] This field is provided to allow the user to
%specify an associated symbol, but most glossary styles ignore
%this value. If omitted, the value is set to \cs{relax}.
-%\item[{\gloskey{sort}}] This value indicates how \appname{makeindex} should
-%sort this entry. If omitted, the value of the \gloskey{name} field
-%is used. This value is equivalent to \appname{makeindex}'s ``actual''
+%\item[{\gloskey{sort}}] This value indicates how \appname{makeindex}
+%should sort this entry. If omitted, the value is given by
+%the \gloskey{name} field.
+%This value is equivalent to \appname{makeindex}'s ``actual''
%character (which is usually the at-sign @.)
%\item[{\gloskey{type}}] This is the glossary type to which this entry
%belongs. If omitted, the default glossary is assumed.
@@ -931,6 +949,21 @@
%it will be "main". The acronyms can then be used in exactly
%the same way as any other glossary entry.
%
+%As you can see from the above, \cs{newacronym} sets the
+%description to the long form of the acronym. You may prefer to
+%have a description, and set the name to both the long and abbreviated
+%forms. For example, the following defines the acronym IDN:
+%\begin{verbatim}
+%\newacronym[name={identification number (IDN)},
+%description={A number uniquely identifying a particular
+%object}]{idn}{IDN}{identification number}
+%\end{verbatim}
+%Alternatively:
+%\begin{verbatim}
+%\newacronym[description={identification number --- a number uniquely
+%identifying a particular object}]{idn}{IDN}{identification number}
+%\end{verbatim}
+%
%\subsection{Glossary Styles}
%The \styname{glossaries} package comes with some pre-defined
%glossary styles. These are as follows:
@@ -1083,7 +1116,7 @@
% This package requires \LaTeXe.
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{glossaries}[2007/08/03 v1.04 (NLCT)]
+\ProvidesPackage{glossaries}[2007/09/13 v1.07 (NLCT)]
% \end{macrocode}
% Required packages:
% \begin{macrocode}
@@ -1511,12 +1544,14 @@ name=true]{%
% style.) If \icmdname{phantomsection}
% is defined, it uses \cs{\@p@glossarysection}, otherwise it
% uses \cs{@glossarysection}.
+%\changes{1.05}{2007 Aug 10}{added '@mkboth to 'glossarysection}
%\begin{macro}{\glossarysection}
% \begin{macrocode}
\newcommand*{\glossarysection}[2][\@gls@title]{%
\def\@gls@title{#2}%
\@ifundefined{phantomsection}{%
\@glossarysection{#1}{#2}}{\@p@glossarysection{#1}{#2}}%
+\@mkboth{\glossarytoctitle}{\glossarytoctitle}%
}
% \end{macrocode}
%\end{macro}
@@ -1532,7 +1567,7 @@ name=true]{%
%\begin{macro}{\@glossarysection}
% \begin{macrocode}
\newcommand*{\@glossarysection}[2]{%
-\csname\@@glossarysec\endcsname*{#2}
+\csname\@@glossarysec\endcsname*{#2}%
\@gls@toc{#1}{\@@glossarysec}}
% \end{macrocode}
%\end{macro}
@@ -1926,6 +1961,8 @@ counter as its value}}{%
% \end{macrocode}
% Set up defaults. If the \gloskey{name} or \gloskey{description}
% keys are omitted, an error will be generated.
+%\changes{1.05}{2007 Aug 10}{Changed the default value of the sort
+% key to just the value of the name key}%
% \begin{macrocode}
\def\@glo@name{\PackageError{glossaries}{name key required in
\string\newglossaryentry}{You haven't specified the entry name}}%
@@ -1937,7 +1974,7 @@ counter as its value}}{%
\def\@glo@plural{\@glo@text s}%
\def\@glo@first{\@glo@text}%
\def\@glo@firstplural{\@glo@plural}%
-\def\@glo@sort{\@glo@name\space\@glo@desc}%
+\def\@glo@sort{\@glo@name}%
\def\@glo@counter{\@gls@getcounter{\@glo@type}}%
% \end{macrocode}
% Extract key-val information from third parameter:
@@ -2252,6 +2289,7 @@ counter as its value}}{%
%\end{macro}
% Define the un-starred version:
%\begin{macro}{\@gls@link}
+%\changes{1.07}{2007 Sep 13}{fixed bug caused by \cs{theglsentrycounter} setting the page number too soon}
% \begin{macrocode}
\newcommand*{\@gls@link}[3][]{%
\glsdoifexists{#2}{%
@@ -2259,7 +2297,7 @@ counter as its value}}{%
\edef\@gls@counter{\csname glo@#2@counter\endcsname}%
\KV@glslink@hypertrue
\setkeys{glslink}{#1}%
-\edef\theglsentrycounter{\csname the\@gls@counter\endcsname}%
+\edef\theglsentrycounter{\expandafter\noexpand\csname the\@gls@counter\endcsname}%
\ifKV@glslink@hyper
\@glslink{glo:#2}{\glstextformat{#3}}%
\else
@@ -3036,13 +3074,14 @@ counter as its value}}{%
% the second argument is the entry label. Note that \meta{options}
% only has two keys: \gloskey[glsadd]{counter} and \gloskey[glsadd]{format} (the \gloskey[glsaddall]{types} key will be ignored).
%\begin{macro}{\glsadd}
+%\changes{1.07}{2007 Sep 13}{fixed bug caused by \cs{theglsentrycounter} setting the page number too soon}
% \begin{macrocode}
\newcommand*{\glsadd}[2][]{%
\glsdoifexists{#2}{%
\def\@glo@format{glsnumberformat}%
\edef\@glo@counter{\csname glo@#2@counter\endcsname}%
\setkeys{glossadd}{#1}%
-\edef\theglsentrycounter{\csname the\@glo@counter\endcsname}%
+\edef\theglsentrycounter{\expandafter\noexpand\csname the\@glo@counter\endcsname}%
\protected@edef\@glo@sort{\csname glo@#2@sort\endcsname}%
\@gls@checkmkidxchars\@glo@sort
\protected@edef\@@glo@name{\csname glo@#2@name\endcsname}%
@@ -4226,5 +4265,1734 @@ first={#4 (#3)},plural={#3s},firstplural={#4s (#3s)},#1}}
%</glossary-super.sty>
% \end{macrocode}
%\fi
+%\iffalse
+% \begin{macrocode}
+%<*glossaries.perl>
+% \end{macrocode}
+%\fi
+%\iffalse
+% \begin{macrocode}
+# File : glossaries.perl
+# Author : Nicola L.C. Talbot
+# Date : 14th June 2007
+# Last Modified : 21st Aug 2007
+# Version : 1.02
+# Description : LaTeX2HTML (limited!) implementation of glossaries
+# package. Note that not all the glossaries.sty
+# macros have been implemented.
+
+# This is a LaTeX2HTML style implementing the glossaries package, and
+# is distributed as part of that package.
+# Copyright 2007 Nicola L.C. Talbot
+# This work may be distributed and/or modified under the
+# conditions of the LaTeX Project Public License, either version 1.3
+# of this license of (at your option) any later version.
+# The latest version of this license is in
+# http://www.latex-project.org/lppl.txt
+# and version 1.3 or later is part of all distributions of LaTeX
+# version 2005/12/01 or later.
+#
+# This work has the LPPL maintenance status `maintained'.
+#
+# The Current Maintainer of this work is Nicola Talbot.
+
+# This work consists of the files glossaries.dtx and glossaries.ins
+# and the derived files glossaries.sty, glossary-hypernav.sty,
+# glossary-list.sty, glossary-long.sty, glossary-super.sty,
+# glossaries.perl. Also makeglossaries and makeglossaries.bat
+
+
+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, $_);
+ last unless defined($value);
+ }
+
+ ($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);
+
+ # v1.01 removed following lines (\glslink doesn't have
+ # a final optional argument!
+ #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 . $_;
+ &make_glslink($type, $label, $format, $text) . $_;
+}
+
+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;
+% \end{macrocode}
+%\fi
+%\iffalse
+% \begin{macrocode}
+%</glossaries.perl>
+% \end{macrocode}
+%\fi
%\Finale
\endinput
diff --git a/Master/texmf-dist/source/latex/glossaries/glossaries.ins b/Master/texmf-dist/source/latex/glossaries/glossaries.ins
index 1fc606b961b..c9bcf74cb43 100644
--- a/Master/texmf-dist/source/latex/glossaries/glossaries.ins
+++ b/Master/texmf-dist/source/latex/glossaries/glossaries.ins
@@ -1,27 +1,40 @@
-% glossaries.ins generated using makedtx version 0.93b 2007/8/3 17:26
+% glossaries.ins generated using makedtx version 0.94b 2007/9/13 20:21
\input docstrip
\preamble
-Copyright (C) 2007 Nicola Talbot, all rights reserved.
-If you modify this file, you must change its name first.
-You are NOT ALLOWED to distribute this file alone. You are NOT
-ALLOWED to take money for the distribution or use of either this
-file or a changed version, except for a nominal charge for copying
-etc.
+
+ glossaries.dtx
+ Copyright 2007 Nicola Talbot
+
+ This work may be distributed and/or modified under the
+ conditions of the LaTeX Project Public License, either version 1.3
+ of this license of (at your option) any later version.
+ The latest version of this license is in
+ http://www.latex-project.org/lppl.txt
+ and version 1.3 or later is part of all distributions of LaTeX
+ version 2005/12/01 or later.
+
+ This work has the LPPL maintenance status `maintained'.
+
+ The Current Maintainer of this work is Nicola Talbot.
+
+ This work consists of the files glossaries.dtx and glossaries.ins and the derived files glossaries.sty, glossary-hypernav.sty, glossary-list.sty, glossary-long.sty, glossary-super.sty, glossaries.perl.
+
\endpreamble
\askforoverwritefalse
\generate{\file{glossaries.sty}{\usepreamble\defaultpreamble
\usepostamble\defaultpostamble\from{glossaries.dtx}{glossaries.sty,package}}
-\file{glossary-long.sty}{\usepreamble\defaultpreamble
-\usepostamble\defaultpostamble\from{glossaries.dtx}{glossary-long.sty,package}}
-\file{glossary-super.sty}{\usepreamble\defaultpreamble
-\usepostamble\defaultpostamble\from{glossaries.dtx}{glossary-super.sty,package}}
\file{glossary-hypernav.sty}{\usepreamble\defaultpreamble
\usepostamble\defaultpostamble\from{glossaries.dtx}{glossary-hypernav.sty,package}}
\file{glossary-list.sty}{\usepreamble\defaultpreamble
\usepostamble\defaultpostamble\from{glossaries.dtx}{glossary-list.sty,package}}
+\file{glossary-long.sty}{\usepreamble\defaultpreamble
+\usepostamble\defaultpostamble\from{glossaries.dtx}{glossary-long.sty,package}}
+\file{glossary-super.sty}{\usepreamble\defaultpreamble
+\usepostamble\defaultpostamble\from{glossaries.dtx}{glossary-super.sty,package}}
+\file{glossaries.perl}{\nopreamble\nopostamble\from{glossaries.dtx}{glossaries.perl}}
}
\endbatchfile
diff --git a/Master/texmf-dist/tex/latex/glossaries/glossaries.sty b/Master/texmf-dist/tex/latex/glossaries/glossaries.sty
index 60c8a8cee5c..e44b70ea99b 100644
--- a/Master/texmf-dist/tex/latex/glossaries/glossaries.sty
+++ b/Master/texmf-dist/tex/latex/glossaries/glossaries.sty
@@ -5,12 +5,24 @@
%% The original source files were:
%%
%% glossaries.dtx (with options: `glossaries.sty,package')
-%% Copyright (C) 2007 Nicola Talbot, all rights reserved.
-%% If you modify this file, you must change its name first.
-%% You are NOT ALLOWED to distribute this file alone. You are NOT
-%% ALLOWED to take money for the distribution or use of either this
-%% file or a changed version, except for a nominal charge for copying
-%% etc.
+%%
+%% glossaries.dtx
+%% Copyright 2007 Nicola Talbot
+%%
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3
+%% of this license of (at your option) any later version.
+%% The latest version of this license is in
+%% http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+%%
+%% This work has the LPPL maintenance status `maintained'.
+%%
+%% The Current Maintainer of this work is Nicola Talbot.
+%%
+%% This work consists of the files glossaries.dtx and glossaries.ins and the derived files glossaries.sty, glossary-hypernav.sty, glossary-list.sty, glossary-long.sty, glossary-super.sty, glossaries.perl.
+%%
%% \CharacterTable
%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
@@ -26,10 +38,8 @@
%% Right bracket \] Circumflex \^ Underscore \_
%% Grave accent \` Left brace \{ Vertical bar \|
%% Right brace \} Tilde \~}
-%% lots of text omitted
-%% lots of text omitted
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{glossaries}[2007/08/03 v1.04 (NLCT)]
+\ProvidesPackage{glossaries}[2007/09/13 v1.07 (NLCT)]
\RequirePackage{ifthen}
\RequirePackage{xkeyval}[2006/11/18]
\RequirePackage{xspace}
@@ -111,9 +121,10 @@ name=true]{%
\def\@gls@title{#2}%
\@ifundefined{phantomsection}{%
\@glossarysection{#1}{#2}}{\@p@glossarysection{#1}{#2}}%
+\@mkboth{\glossarytoctitle}{\glossarytoctitle}%
}
\newcommand*{\@glossarysection}[2]{%
-\csname\@@glossarysec\endcsname*{#2}
+\csname\@@glossarysec\endcsname*{#2}%
\@gls@toc{#1}{\@@glossarysec}}
\newcommand*{\@p@glossarysection}[2]{%
\gls@doclearpage
@@ -215,7 +226,7 @@ counter as its value}}{%
\def\@glo@plural{\@glo@text s}%
\def\@glo@first{\@glo@text}%
\def\@glo@firstplural{\@glo@plural}%
-\def\@glo@sort{\@glo@name\space\@glo@desc}%
+\def\@glo@sort{\@glo@name}%
\def\@glo@counter{\@gls@getcounter{\@glo@type}}%
\setkeys{glossentry}{#2}%
\@ifundefined{glolist@\@glo@type}{\PackageError{glossaries}{%
@@ -300,7 +311,7 @@ counter as its value}}{%
\edef\@gls@counter{\csname glo@#2@counter\endcsname}%
\KV@glslink@hypertrue
\setkeys{glslink}{#1}%
-\edef\theglsentrycounter{\csname the\@gls@counter\endcsname}%
+\edef\theglsentrycounter{\expandafter\noexpand\csname the\@gls@counter\endcsname}%
\ifKV@glslink@hyper
\@glslink{glo:#2}{\glstextformat{#3}}%
\else
@@ -683,7 +694,7 @@ counter as its value}}{%
\def\@glo@format{glsnumberformat}%
\edef\@glo@counter{\csname glo@#2@counter\endcsname}%
\setkeys{glossadd}{#1}%
-\edef\theglsentrycounter{\csname the\@glo@counter\endcsname}%
+\edef\theglsentrycounter{\expandafter\noexpand\csname the\@glo@counter\endcsname}%
\protected@edef\@glo@sort{\csname glo@#2@sort\endcsname}%
\@gls@checkmkidxchars\@glo@sort
\protected@edef\@@glo@name{\csname glo@#2@name\endcsname}%
diff --git a/Master/texmf-dist/tex/latex/glossaries/glossary-hypernav.sty b/Master/texmf-dist/tex/latex/glossaries/glossary-hypernav.sty
index f41364cb2d7..8e7e9b6d670 100644
--- a/Master/texmf-dist/tex/latex/glossaries/glossary-hypernav.sty
+++ b/Master/texmf-dist/tex/latex/glossaries/glossary-hypernav.sty
@@ -5,12 +5,24 @@
%% The original source files were:
%%
%% glossaries.dtx (with options: `glossary-hypernav.sty,package')
-%% Copyright (C) 2007 Nicola Talbot, all rights reserved.
-%% If you modify this file, you must change its name first.
-%% You are NOT ALLOWED to distribute this file alone. You are NOT
-%% ALLOWED to take money for the distribution or use of either this
-%% file or a changed version, except for a nominal charge for copying
-%% etc.
+%%
+%% glossaries.dtx
+%% Copyright 2007 Nicola Talbot
+%%
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3
+%% of this license of (at your option) any later version.
+%% The latest version of this license is in
+%% http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+%%
+%% This work has the LPPL maintenance status `maintained'.
+%%
+%% The Current Maintainer of this work is Nicola Talbot.
+%%
+%% This work consists of the files glossaries.dtx and glossaries.ins and the derived files glossaries.sty, glossary-hypernav.sty, glossary-list.sty, glossary-long.sty, glossary-super.sty, glossaries.perl.
+%%
%% \CharacterTable
%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
@@ -26,8 +38,6 @@
%% Right bracket \] Circumflex \^ Underscore \_
%% Grave accent \` Left brace \{ Vertical bar \|
%% Right brace \} Tilde \~}
-%% lots of text omitted
-%% lots of text omitted
\ProvidesPackage{glossary-hypernav}[2007/07/04 v1.01 (NLCT)]
\@ifundefined{hyperlink}{%
\newcommand*{\glsnavhyperlink}[3][]{#3}}{%
diff --git a/Master/texmf-dist/tex/latex/glossaries/glossary-list.sty b/Master/texmf-dist/tex/latex/glossaries/glossary-list.sty
index eabec031330..09f70c677e2 100644
--- a/Master/texmf-dist/tex/latex/glossaries/glossary-list.sty
+++ b/Master/texmf-dist/tex/latex/glossaries/glossary-list.sty
@@ -5,12 +5,24 @@
%% The original source files were:
%%
%% glossaries.dtx (with options: `glossary-list.sty,package')
-%% Copyright (C) 2007 Nicola Talbot, all rights reserved.
-%% If you modify this file, you must change its name first.
-%% You are NOT ALLOWED to distribute this file alone. You are NOT
-%% ALLOWED to take money for the distribution or use of either this
-%% file or a changed version, except for a nominal charge for copying
-%% etc.
+%%
+%% glossaries.dtx
+%% Copyright 2007 Nicola Talbot
+%%
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3
+%% of this license of (at your option) any later version.
+%% The latest version of this license is in
+%% http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+%%
+%% This work has the LPPL maintenance status `maintained'.
+%%
+%% The Current Maintainer of this work is Nicola Talbot.
+%%
+%% This work consists of the files glossaries.dtx and glossaries.ins and the derived files glossaries.sty, glossary-hypernav.sty, glossary-list.sty, glossary-long.sty, glossary-super.sty, glossaries.perl.
+%%
%% \CharacterTable
%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
@@ -26,8 +38,6 @@
%% Right bracket \] Circumflex \^ Underscore \_
%% Grave accent \` Left brace \{ Vertical bar \|
%% Right brace \} Tilde \~}
-%% lots of text omitted
-%% lots of text omitted
\ProvidesPackage{glossary-list}[2007/07/04 v1.01 (NLCT)]
\newglossarystyle{list}{%
\renewenvironment{theglossary}{\begin{description}}{\end{description}}%
diff --git a/Master/texmf-dist/tex/latex/glossaries/glossary-long.sty b/Master/texmf-dist/tex/latex/glossaries/glossary-long.sty
index 9aca83bba07..b74e44fe426 100644
--- a/Master/texmf-dist/tex/latex/glossaries/glossary-long.sty
+++ b/Master/texmf-dist/tex/latex/glossaries/glossary-long.sty
@@ -5,12 +5,24 @@
%% The original source files were:
%%
%% glossaries.dtx (with options: `glossary-long.sty,package')
-%% Copyright (C) 2007 Nicola Talbot, all rights reserved.
-%% If you modify this file, you must change its name first.
-%% You are NOT ALLOWED to distribute this file alone. You are NOT
-%% ALLOWED to take money for the distribution or use of either this
-%% file or a changed version, except for a nominal charge for copying
-%% etc.
+%%
+%% glossaries.dtx
+%% Copyright 2007 Nicola Talbot
+%%
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3
+%% of this license of (at your option) any later version.
+%% The latest version of this license is in
+%% http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+%%
+%% This work has the LPPL maintenance status `maintained'.
+%%
+%% The Current Maintainer of this work is Nicola Talbot.
+%%
+%% This work consists of the files glossaries.dtx and glossaries.ins and the derived files glossaries.sty, glossary-hypernav.sty, glossary-list.sty, glossary-long.sty, glossary-super.sty, glossaries.perl.
+%%
%% \CharacterTable
%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
@@ -26,8 +38,6 @@
%% Right bracket \] Circumflex \^ Underscore \_
%% Grave accent \` Left brace \{ Vertical bar \|
%% Right brace \} Tilde \~}
-%% lots of text omitted
-%% lots of text omitted
\ProvidesPackage{glossary-long}[2007/07/04 v1.01 (NLCT)]
\RequirePackage{longtable}
\newlength\glsdescwidth
diff --git a/Master/texmf-dist/tex/latex/glossaries/glossary-super.sty b/Master/texmf-dist/tex/latex/glossaries/glossary-super.sty
index 382502d0dec..80deb72b175 100644
--- a/Master/texmf-dist/tex/latex/glossaries/glossary-super.sty
+++ b/Master/texmf-dist/tex/latex/glossaries/glossary-super.sty
@@ -5,12 +5,24 @@
%% The original source files were:
%%
%% glossaries.dtx (with options: `glossary-super.sty,package')
-%% Copyright (C) 2007 Nicola Talbot, all rights reserved.
-%% If you modify this file, you must change its name first.
-%% You are NOT ALLOWED to distribute this file alone. You are NOT
-%% ALLOWED to take money for the distribution or use of either this
-%% file or a changed version, except for a nominal charge for copying
-%% etc.
+%%
+%% glossaries.dtx
+%% Copyright 2007 Nicola Talbot
+%%
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3
+%% of this license of (at your option) any later version.
+%% The latest version of this license is in
+%% http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+%%
+%% This work has the LPPL maintenance status `maintained'.
+%%
+%% The Current Maintainer of this work is Nicola Talbot.
+%%
+%% This work consists of the files glossaries.dtx and glossaries.ins and the derived files glossaries.sty, glossary-hypernav.sty, glossary-list.sty, glossary-long.sty, glossary-super.sty, glossaries.perl.
+%%
%% \CharacterTable
%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
@@ -26,8 +38,6 @@
%% Right bracket \] Circumflex \^ Underscore \_
%% Grave accent \` Left brace \{ Vertical bar \|
%% Right brace \} Tilde \~}
-%% lots of text omitted
-%% lots of text omitted
\ProvidesPackage{glossary-super}[2007/07/04 v1.01 (NLCT)]
\RequirePackage{supertabular}
\newglossarystyle{super}{%