westernmagic / latex-makefile

A Makefile for LaTeX - drop it in, type make, and magic happens.
1 stars 1 forks source link

Support acronym option for glossaries #5

Closed westernmagic closed 7 years ago

westernmagic commented 7 years ago

Originally reported as No acronym support (acn->acr) for the glossaries package #158

@dudebout Would you still have your old patch? Id be interested in it, as I am trying to accomplish the same

dudebout commented 7 years ago

I found the following patch which includes a couple of changes made by Chris Monson after 2.2.1-alpha9 as well as my change. Hope this helps.

--- Makefile    2012-06-25 03:30:54.000000000 -0400
+++ Makefile.me 2016-09-26 11:17:28.568788355 -0400
@@ -43,8 +43,13 @@
 -include Variables.ini
 -include $(HOME)/.latex-makefile/Variables.ini
 #
-# This can be pdflatex or latex - you can change this by adding the following line to your Makefile.ini:
+# This can be pdflatex or latex - you can change this by adding the following
+# line to your Makefile.ini or Variables.ini file:
 # BUILD_STRATEGY := latex
+# Note that for LuaLaTeX, you would leave this alone - the addition of lua
+# scripting has no impact on the build strategy, which is still pdflatex (as
+# opposed to a latex -> dvips -> ps2pdf strategy).  Instead, you would change
+# the PDFLATEX variable to point to lualatex.  See below.
 BUILD_STRATEGY     ?= pdflatex
 # This can be used to pass extra options to latex.
 LATEX_OPTS     ?=
@@ -91,6 +96,10 @@
 # to allow everything to be cleaned.
 #neverclean        ?= *.pdf
 #
+# A space-separated list of extra files to clean - you can specify this in the
+# .ini files. Make sure you escape them properly, if that's needed!
+#cleanextra        ?=
+#
 # Alternatively (recommended), you can add those lines to a Makefile.ini file
 # and it will get picked up automatically without your having to edit this
 # Makefile.
@@ -117,6 +126,10 @@
 #
 #
 # CHANGES:
+# Chris Monson (2012-11-23):
+# * Issue 166: Added clean-extra target and cleanextra user variable.
+# Chris Monson (2012-08-02):
+# * Added comments about LuaLaTeX.
 # Chris Monson (2012-06-25):
 # * Bumped version to 2.2.1-alpha9
 # * Built with Holger Dell's changes to fix multiple unnecessary compilations.
@@ -748,6 +761,7 @@
 EPSTOPDF   ?= epstopdf
 MAKEINDEX  ?= makeindex
 XINDY      ?= xindy
+MAKEGLOSSARIES ?= makeglossaries
 KPSEWHICH  ?= kpsewhich
 GS     ?= gs
 # = OPTIONAL PROGRAMS =
@@ -1533,7 +1547,8 @@
 # Extensions generated by LaTeX invocation that can be removed when complete
 rm_ext     := \
    log *.log aux $(pre_pdf_extensions) pdf blg bbl out nav snm toc lof lot lol pfg \
-   fls vrb idx ind ilg glg glo gls lox nls nlo nlg brf mtc* mlf* mlt* maf brf ist fmt
+   fls vrb idx ind ilg glg glo gls lox nls nlo nlg brf mtc* mlf* mlt* maf brf ist \
+   fmt acn acr alg
 backup_patterns    := *~ *.bak *.backup body.tmp head.tmp

 graph_stem := _graph
@@ -1909,6 +1924,7 @@
 $(SED) \
 -e 's/^No file \(.*\.ind\)\.$$/TARGETS=\1/' \
 -e 's/^No file \(.*\.[gn]ls\)\.$$/TARGETS=\1/' \
+-e 's/^No file \(.*\.acr\)\.$$/TARGETS=\1/' \
 -e 's/[[:space:]]/\\&/g' \
 -e '/^TARGETS=/{' \
 -e '  h' \
@@ -1940,6 +1956,7 @@
 $(SED) \
 -e '/^\\bibdata/!d' \
 -e 's/\\bibdata{\([^}]*\)}/\1,/' \
+-e 's/[^,]\{1,\}-blx//' \
 -e 's/,\{2,\}/,/g' \
 -e 's/[[:space:]]/\\&/g' \
 -e 's/,/.bib /g' \
@@ -2331,6 +2348,11 @@
 -e '/(.*error.*)/s//$(C_ERROR)&$(C_RESET)/' \
 -e 'd'

+# Colorize makeglossaries output.
+color_makeglossaries := \
+$(SED) \
+-e 's/.*/$(C_WARNING)&$(C_RESET)/'
+
 # Make beamer output big enough to print on a full page.  Landscape doesn't
 # seem to work correctly.
 enlarge_beamer = $(PSNUP) -l -1 -W128mm -H96mm -pletter
@@ -2395,6 +2417,17 @@
 [ "$$success" = "1" ] && $(sh_true) || $(sh_false);
 endef

+# $(call run-makeglossaries,<input>,<output>,<log>)
+define run-makeglossaries
+success=1; \
+if ! $(MAKEGLOSSARIES) -q $1 2>&1 | $(color_makeglossaries) || $(EGREP) -q '^makeglossaries:' $3; then \
+   $(RM) -f '$2'; \
+   success=0; \
+   $(call transcript,makeglossaries,$1); \
+fi; \
+[ "$$success" = "1" ] && $(sh_true) || $(sh_false);
+endef
+
 # This runs the given script to generate output, and it uses MAKE_RESTARTS to
 # ensure that it never runs it more than once for a particular root make
 # invocation.
@@ -3003,6 +3036,11 @@
    $(QUIET)$(call echo-build,$<,$@)
    $(QUIET)$(call run-makeindex,$<,$@,$*.nlg,nomencl.ist)

+# Create the acronym file from a .acn file
+%.acr: %.acn %.tex
+   $(QUIET)$(call echo-build,$<,$@)
+   $(QUIET)$(call run-makeglossaries,$*,$@,$*.alg)
+
 # Precompile the format file
 %.fmt: %.tex
    $(QUIET)$(call echo-build,$<,$@)
@@ -3432,8 +3470,11 @@
 .PHONY: clean-nographics
 clean-nographics: clean-tex clean-deps clean-backups clean-auxiliary ;

+.PHONY: clean-extra
+   $(QUIET)$(call clean-files,$(clean-extra))
+
 .PHONY: clean
-clean: clean-generated clean-tex clean-graphics clean-deps clean-backups clean-auxiliary ;
+clean: clean-generated clean-tex clean-graphics clean-deps clean-backups clean-auxiliary clean-extra ;

 #
 # HELP TARGETS
@@ -3502,12 +3543,14 @@
 #          neverclean := *.pdf *.ps
 #          onlysources.tex := main.tex
 #          LATEX_COLOR_WARNING := 'bold red uline'
+#          PDFLATEX := lualatex
 #
 #          And this would override the neverclean setting to ensure that pdf
 #          and ps files always remain behind, set the makefile to treat all
 #          .tex files that are not "main.tex" as includes (and therefore not
 #          default targets).  It also changes the LaTeX warning output to be
-#          red, bold, and underlined.
+#          red, bold, and underlined.  Finally, it specifies that you want to
+#          allow Lua scripting by invoking lualatex instead of pdflatex.
 #
 #          There are numerous variables in this file that can be overridden in
 #          this way.  Search for '?=' to find them all.