Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Glossaryfix #22

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions XSLT/6x9book-real-poetry.xslt
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
\bibliocommand

% Glossary
\printglossary
\printglossaries


% Indexes
Expand All @@ -136,7 +136,8 @@
<xsl:text>\documentclass[10pt,twoside]{memoir}
\usepackage{layouts}[2001/04/29]
\usepackage{modified-bringhurst} % Available from http://fletcherpenney.net/
\makeglossary
\usepackage{glossaries}
\makeglossaries
\makeindex
\makeindex[firstlines]

Expand Down
3 changes: 2 additions & 1 deletion XSLT/6x9book.xslt
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@
<xsl:template name="latex-document-class">
<xsl:text>\documentclass[10pt,twoside]{memoir}
\usepackage{layouts}[2001/04/29]
\makeglossary
\usepackage{glossaries}
\makeglossaries
\makeindex

\def\mychapterstyle{companion}
Expand Down
2 changes: 1 addition & 1 deletion XSLT/letterhead.xslt
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@
\bibliocommand

% Glossary
\printglossary
\printglossaries


% Index
Expand Down
5 changes: 3 additions & 2 deletions XSLT/manuscript-novel.xslt
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
\bibliocommand

% Glossary
% \printglossary
% \printglossaries


% Index
Expand All @@ -71,7 +71,8 @@
<xsl:text>\documentclass[10pt,oneside]{memoir}
\usepackage{layouts}[2001/04/29]
\usepackage{manuscript}
\makeglossary
\usepackage{glossaries}
\makeglossaries
\makeindex

\def\revision{}
Expand Down
4 changes: 2 additions & 2 deletions XSLT/memoir-natbib.xslt
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@
\usepackage{layouts}[2001/04/29]
\usepackage[round,sort&amp;compress]{natbib}
\setcitestyle{super,open={},close={},comma}

\makeglossary
\usepackage{glossaries}
\makeglossaries
\makeindex

\def\mychapterstyle{default}
Expand Down
3 changes: 2 additions & 1 deletion XSLT/memoir-twosided.xslt
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@
<xsl:template name="latex-document-class">
<xsl:text>\documentclass[10pt,twoside]{memoir}
\usepackage{layouts}[2001/04/29]
\makeglossary
\usepackage{glossaries}
\makeglossaries
\makeindex

\def\mychapterstyle{default}
Expand Down
36 changes: 27 additions & 9 deletions XSLT/memoir.xslt
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,9 @@
</xsl:template>

<xsl:template name="latex-footer">
<xsl:text>%
% Back Matter
%
<xsl:text>

% Back Matter
\backmatter
%\appendixpage

Expand All @@ -57,20 +56,22 @@
\bibliocommand

% Glossary
\printglossary

\printglossaries

% Index
\printindex

\end{document}

</xsl:text>
</xsl:template>

<xsl:template name="latex-document-class">
<xsl:text>\documentclass[10pt,oneside]{memoir}
\usepackage{layouts}[2001/04/29]
\makeglossary
\usepackage{glossaries}
\glstoctrue
\makeglossaries

\makeindex

\def\mychapterstyle{default}
Expand Down Expand Up @@ -407,14 +408,29 @@

<!-- Memoir handles glossaries differently -->

<!-- this is slightly messy, but it works: extracts glossary term, and insert it into a \glsadd{} command -->

<xsl:template match="html:li" mode="glossary">
<xsl:param name="footnoteId"/>
<xsl:if test="parent::html:ol/parent::html:div/@class = 'footnotes'">
<xsl:if test="concat('#',@id) = $footnoteId">
<xsl:apply-templates select="html:span[@class='glossary sort']" mode="glossary"/>
<xsl:apply-templates select="html:span[@class='glossary name']" mode="glossary"/>
<xsl:text>{</xsl:text>
<xsl:variable name="glsname">
<xsl:apply-templates select="html:span[@class='glossary name']" mode="glossary"/>
</xsl:variable>
<xsl:text>,</xsl:text>
<xsl:text>description={</xsl:text>
<xsl:apply-templates select="html:p" mode="glossary"/>
<xsl:text>}} </xsl:text>
<xsl:variable name="glsbf">
<xsl:value-of select="substring-after($glsname,'{')"/>
</xsl:variable>
<xsl:variable name="glsclean">
<xsl:value-of select="substring-before($glsbf,'}')"/>
</xsl:variable>
<xsl:text>\glsadd{</xsl:text>
<xsl:value-of select="$glsclean"/>
<xsl:text>}</xsl:text>
</xsl:if>
</xsl:if>
Expand All @@ -424,8 +440,10 @@
<xsl:text>{</xsl:text>
<xsl:apply-templates select="node()"/>
<xsl:text>}</xsl:text>
<xsl:text>{</xsl:text>
<xsl:text>name=</xsl:text>
<xsl:apply-templates select="node()"/>
</xsl:template>

<xsl:template match="html:span[@class='glossary sort']" mode="glossary">
<xsl:text>(</xsl:text>
<xsl:apply-templates select="node()"/>
Expand Down
2 changes: 1 addition & 1 deletion XSLT/xhtml2latex.xslt
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@
</xsl:when>

<xsl:when test="@class = 'footnote glossary'">
<xsl:text>\glossary</xsl:text>
<xsl:text>\newglossaryentry</xsl:text>
<xsl:apply-templates select="/html:html/html:body/html:div[@class]/html:ol/html:li[@id]" mode="glossary">
<xsl:with-param name="footnoteId" select="@href"/>
</xsl:apply-templates>
Expand Down
8 changes: 4 additions & 4 deletions bin/MultiMarkdown/Support.pm
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,10 @@ sub ProcessMMD2PDF {
# These are not all necessary for simple files, but are included to try
# and be as thorough as possible... Sort of a poor man's latexmk.pl

my $tex_string = "; pdflatex mmd.tex; bibtex mmd; makeindex -t mmd.glg -o mmd.gls -s mmd.ist mmd.glo; makeindex -s `kpsewhich basic.gst` -o mmd.gls mmd.glo; pdflatex mmd.tex; pdflatex mmd.tex; pdflatex mmd.tex; pdflatex mmd.tex";
my $tex_string = "; pdflatex mmd.tex; bibtex mmd; makeglossaries mmd; pdflatex mmd.tex; pdflatex mmd.tex; pdflatex mmd.tex; pdflatex mmd.tex";

if ($^O =~ /MSWin/) {
$tex_string = "& pdflatex mmd.tex & bibtex mmd & makeindex -t mmd.glg -o mmd.gls -s mmd.ist mmd.glo & makeindex -s `kpsewhich basic.gst` -o mmd.gls mmd.glo & pdflatex mmd.tex & pdflatex mmd.tex & pdflatex mmd.tex & pdflatex mmd.tex";
$tex_string = "& pdflatex mmd.tex & bibtex mmd & makeglossaries mmd & pdflatex mmd.tex & pdflatex mmd.tex & pdflatex mmd.tex & pdflatex mmd.tex";
}
PDFEngine($MMDPath, $input_file, $tex_string, $text);

Expand All @@ -163,10 +163,10 @@ sub ProcessMMD2PDFXeLaTeX {
# These are not all necessary for simple files, but are included to try
# and be as thorough as possible... Sort of a poor man's latexmk.pl

my $tex_string = "; xelatex mmd.tex; bibtex mmd; makeindex -t mmd.glg -o mmd.gls -s mmd.ist mmd.glo; makeindex -s `kpsewhich basic.gst` -o mmd.gls mmd.glo; xelatex mmd.tex; xelatex mmd.tex; xelatex mmd.tex; xelatex mmd.tex";
my $tex_string = "; xelatex mmd.tex; bibtex mmd; makeglossaries mmd; xelatex mmd.tex; xelatex mmd.tex; xelatex mmd.tex; xelatex mmd.tex";

if ($^O =~ /MSWin/) {
$tex_string = "& xelatex mmd.tex & bibtex mmd & makeindex -t mmd.glg -o mmd.gls -s mmd.ist mmd.glo & makeindex -s `kpsewhich basic.gst` -o mmd.gls mmd.glo & xelatex mmd.tex & xelatex mmd.tex & xelatex mmd.tex & xelatex mmd.tex";
$tex_string = "& xelatex mmd.tex & bibtex mmd & makeglossaries mmd & xelatex mmd.tex & xelatex mmd.tex & xelatex mmd.tex & xelatex mmd.tex";
}
PDFEngine($MMDPath, $input_file, $tex_string, $text);
}
Expand Down