diff options
author | Karl Berry <karl@freefriends.org> | 2014-10-11 22:30:33 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2014-10-11 22:30:33 +0000 |
commit | 4888499385c44655bec69496f0e01649d7636627 (patch) | |
tree | b4530c653b64a9b165768c4423d6bcf0dd192c31 /Master/texmf-dist | |
parent | 9406c7d3ffc09ac95d52d72e53d84e010a0a747d (diff) |
latex-make (11oct14)
git-svn-id: svn://tug.org/texlive/trunk@35357 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
21 files changed, 5970 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/support/latex-make/LaTeX.mk b/Master/texmf-dist/doc/support/latex-make/LaTeX.mk new file mode 100644 index 00000000000..eb11e60e83d --- /dev/null +++ b/Master/texmf-dist/doc/support/latex-make/LaTeX.mk @@ -0,0 +1,921 @@ + +####[ Check Software ]################################################ + +ifeq ($(filter else-if,$(.FEATURES)),) +$(error GNU Make 3.81 needed. Please, update your software.) + exit 1 +endif + +# Some people want to call our Makefile snippet with +# make -f LaTeX.mk +# This should not work as $(MAKE) is call recursively and will not read +# LaTeX.mk again. We cannot just add LaTeX.mk to MAKEFILES as LaTeX.mk +# should be read AFTER a standard Makefile (if any) that can define some +# variables (LU_MASTERS, ...) that LaTeX.mk must see. +# So I introduce an HACK here that try to workaround the situation. Keep in +# mind that this hack is not perfect and does not handle all cases +# (for example, "make -f my_latex_config.mk -f LaTeX.mk" will not recurse +# correctly) +ifeq ($(foreach m,$(MAKEFILES), $(m)) $(lastword $(MAKEFILE_LIST)),$(MAKEFILE_LIST)) +# We are the first file read after the ones from MAKEFILES +# So we assume we are read due to "-f LaTeX.mk" +LU_LaTeX.mk_NAME := $(lastword $(MAKEFILE_LIST)) +# Is this Makefile correctly read for recursive calls ? +ifeq ($(findstring -f $(LU_LaTeX.mk_NAME),$(MAKE)),) +$(info ********************************************************************************) +$(info Warning: $(LU_LaTeX.mk_NAME) called directly. I suppose that you run:) +$(info Warning: $(MAKE) -f $(LU_LaTeX.mk_NAME) $(MAKECMDGOALS)) +$(info Warning: or something similar that does not allow recursive invocation of make) +$(info Warning: ) +$(info Warning: Trying to enable a workaround. This ACK will be disabled in a future) +$(info Warning: release. Consider using another syntax, for example:) +$(info Warning: $(MAKE) -f $(LU_LaTeX.mk_NAME) MAKE="$(MAKE) -f $(LU_LaTeX.mk_NAME)" $(MAKECMDGOALS)) +$(info ********************************************************************************) +MAKE+= -f $(LU_LaTeX.mk_NAME) +endif +endif + +####[ Configuration ]################################################ + +# For global site options +-include LaTeX.mk.conf + +# list of messages categories to display +LU_SHOW ?= warning #info debug debug-vars + +# Select GNU/BSD/MACOSX utils (cp, rm, mv, ...) +LU_UTILS ?= GNU + +####[ End of configuration ]################################################ +# Modifying the remaining of this document may endanger you life!!! ;) + +#--------------------------------------------------------------------- +# Controling verbosity +ifdef VERB +MAK_VERB := $(VERB) +else +#MAK_VERB := verbose +#MAK_VERB := normal +MAK_VERB := quiet +#MAK_VERB := silent +endif + +#--------------------------------------------------------------------- +# MAK_VERB -> verbosity +ifeq ($(MAK_VERB),verbose) +COMMON_PREFIX = echo " ======> building " $@ "<======" ; \ + printf "%s $(@F) due to:$(foreach file,$?,\n * $(file))\n" $1; +# +COMMON_HIDE :=# +COMMON_CLEAN :=# +SHOW_LATEX:=true +else +ifeq ($(MAK_VERB),normal) +COMMON_PREFIX =# +COMMON_HIDE := @ +COMMON_CLEAN :=# +SHOW_LATEX:=true +else +ifeq ($(MAK_VERB),quiet) +COMMON_PREFIX = @ echo " ======> building " $@ "<======" ; +# echo "due to $?" ; +COMMON_HIDE := @ +COMMON_CLEAN :=# +SHOW_LATEX:= +else # silent +COMMON_PREFIX = @ +COMMON_HIDE := @ +COMMON_CLEAN := @ +SHOW_LATEX:= +endif +endif +endif + +#--------------------------------------------------------------------- +# Old LaTeX have limitations +_LU_PDFTEX_EXT ?= pdftex + +######################################################################### +# Utilities +LU_CP=$(LU_CP_$(LU_UTILS)) +LU_MV=$(LU_MV_$(LU_UTILS)) +LU_RM=$(LU_RM_$(LU_UTILS)) +LU_CP_GNU ?= cp -a -- +LU_MV_GNU ?= mv -- +LU_RM_GNU ?= rm -f -- +LU_CP_BSD ?= cp -p +LU_MV_BSD ?= mv +LU_RM_BSD ?= rm -f +LU_CP_MACOSX ?= /bin/cp -p +LU_MV_MACOSX ?= /bin/mv +LU_RM_MACOSX ?= /bin/rm -f + +lu-show=\ +$(if $(filter $(LU_SHOW),$(1)), \ + $(if $(2), \ + $(if $(filter-out $(2),$(MAKELEVEL)),,$(3)), \ + $(3))) +lu-show-infos=\ +$(if $(filter $(LU_SHOW),$(1)), \ + $(if $(2), \ + $(if $(filter-out $(2),$(MAKELEVEL)),,$(warning $(3))), \ + $(warning $(3)))) +lu-show-rules=$(call lu-show-infos,info,0,$(1)) +lu-show-flavors=$(call lu-show-infos,info,0,$(1)) +lu-show-var=$(call lu-show-infos,debug-vars,, * Set $(1)=$($(1))) +lu-show-read-var=$(eval $(call lu-show-infos,debug-vars,, Reading $(1) in $(2) ctx: $(3)))$(3) +lu-show-readone-var=$(eval $(call lu-show-infos,debug-vars,, Reading $(1) for $(2) [one value]: $(3)))$(3) +lu-show-set-var=$(call lu-show-infos,debug-vars,, * Setting $(1) for $(2) to value: $(3)) +lu-show-add-var=$(call lu-show-infos,debug-vars,, * Adding to $(1) for $(2) values: $(value 3)) +lu-show-add-var2=$(call lu-show-infos,warning,, * Adding to $(1) for $(2) values: $(value 3)) + +lu-save-file=$(call lu-show,debug,,echo "saving $1" ;) \ + if [ -f "$1" ];then $(LU_CP) "$1" "$2" ;else $(LU_RM) "$2" ;fi +lu-cmprestaure-file=\ + if cmp -s "$1" "$2"; then \ + $(LU_MV) "$2" "$1" ; \ + $(call lu-show,debug,,echo "$1" not modified ;) \ + else \ + $(call lu-show,debug,,echo "$1" modified ;) \ + if [ -f "$2" -o -f "$1" ]; then \ + $(RM) -- "$2" ; \ + $3 \ + fi ; \ + fi + +lu-clean=$(if $(strip $(1)),$(RM) $(1)) + +define lu-bug # description + $$(warning Internal error: $(1)) + $$(error You probably found a bug. Please, report it.) +endef + +######################################################################### +######################################################################### +######################################################################### +######################################################################### +################## ######################### +################## Variables ######################### +################## ######################### +######################################################################### +######################################################################### +######################################################################### +######################################################################### +######################################################################### +# +# _LU_FLAVORS_DEFINED : list of available flavors +# _LU_FLAV_*_'flavname' : per flavor variables +# where * can be : +# PROGNAME : variable name for programme (and .._OPTIONS for options) +# EXT : extension of created file +# TARGETNAME : global target +# DEPFLAVOR : flavor to depend upon +# CLEANFIGEXT : extensions to clean for fig figures +_LU_FLAVORS_DEFINED = $(_LU_FLAVORS_DEFINED_TEX) $(_LU_FLAVORS_DEFINED_DVI) + +# INDEXES_TYPES = GLOSS INDEX +# INDEXES_INDEX = name1 ... +# INDEXES_GLOSS = name2 ... +# INDEX_name1_SRC +# GLOSS_name2_SRC + +define _lu-getvalues# 1:VAR 2:CTX (no inheritage) +$(if $(filter-out undefined,$(origin LU_$2$1)),$(LU_$2$1),$($2$1) $(_LU_$2$1_MK) $(TD_$2$1)) +endef +define lu-define-addvar # 1:suffix_fnname 2:CTX 3:disp-debug 4:nb_args 5:inherited_ctx 6:ctx-build-depend + define lu-addtovar$1 # 1:VAR 2:... $4: value + _LU_$2$$1_MK+=$$($4) + $$(call lu-show-add-var,$$1,$3,$$(value $4)) + endef + define lu-def-addvar-inherited-ctx$1 # 1:VAR 2:... + $6 + _LU_$2$$1_INHERITED_CTX=$$(sort \ + $$(foreach ctx,$5,$$(ctx) $$(if $$(filter-out undefined,$$(origin \ + LU_$$(ctx)$$1)),,\ + $$(_LU_$$(ctx)$$1_INHERITED_CTX)))) + $$$$(call lu-show-var,_LU_$2$$1_INHERITED_CTX) + endef + define lu-getvalues$1# 1:VAR 2:... +$$(if $$(filter-out undefined,$$(origin _LU_$2$$1_INHERITED_CTX)),,$$(eval \ + $$(call lu-def-addvar-inherited-ctx$1,$$1,$$2,$$3,$$4,$$5,$$6)\ +))$$(call lu-show-read-var,$$1,$3,$$(foreach ctx,\ + $(if $2,$2,GLOBAL) $$(if $$(filter-out undefined,$$(origin LU_$2$$1)),,\ + $$(_LU_$2$$1_INHERITED_CTX))\ + ,$$(call _lu-getvalues,$$1,$$(filter-out GLOBAL,$$(ctx))))) + endef +endef + +# Global variable +# VAR (DEPENDS) +$(eval $(call lu-define-addvar,-global,,global,2)) + +# Per flavor variable +# FLAVOR_$2_VAR (FLAVOR_DVI_DEPENDS) +# 2: flavor name +# Inherit from VAR (DEPENDS) +$(eval $(call lu-define-addvar,-flavor,FLAVOR_$$2_,flavor $$2,3,\ + GLOBAL,\ + $$(eval $$(call lu-def-addvar-inherited-ctx-global,$$1)) \ +)) + +# Per master variable +# $2_VAR (source_DEPENDS) +# 2: master name +# Inherit from VAR (DEPENDS) +$(eval $(call lu-define-addvar,-master,$$2_,master $$2,3,\ + GLOBAL,\ + $$(eval $$(call lu-def-addvar-inherited-ctx-global,$$1)) \ +)) + +# Per target variable +# $2$(EXT of $3)_VAR (source.dvi_DEPENDS) +# 2: master name +# 3: flavor name +# Inherit from $2_VAR FLAVOR_$3_VAR (source_DEPENDS FLAVOR_DVI_DEPENDS) +$(eval $(call lu-define-addvar,,$$2$$(call lu-getvalue-flavor,EXT,$$3)_,target $$2$$(call lu-getvalue-flavor,EXT,$$3),4,\ + $$2_ FLAVOR_$$3_,\ + $$(eval $$(call lu-def-addvar-inherited-ctx-master,$$1,$$2)) \ + $$(eval $$(call lu-def-addvar-inherited-ctx-flavor,$$1,$$3)) \ +)) + +# Per index/glossary variable +# $(2)_$(3)_VAR (INDEX_source_DEPENDS) +# 2: type (INDEX, GLOSS, ...) +# 3: index name +# Inherit from VAR (DEPENDS) +$(eval $(call lu-define-addvar,-global-index,$$2_$$3_,index $$3[$$2],4,\ + GLOBAL,\ + $$(eval $$(call lu-def-addvar-inherited-ctx-global,$$1)) \ +)) + +# Per master and per index/glossary variable +# $(2)_$(3)_$(4)_VAR (source_INDEX_source_DEPENDS) +# 2: master name +# 3: type (INDEX, GLOSS, ...) +# 4: index name +# Inherit from $2_VAR $3_$4_VAR (source_DEPENDS INDEX_source_DEPENDS) +$(eval $(call lu-define-addvar,-master-index,$$2_$$3_$$4_,index $$2/$$4[$$3],5,\ + $$2_ $$3_$$4_,\ + $$(eval $$(call lu-def-addvar-inherited-ctx-master,$$1,$$2)) \ + $$(eval $$(call lu-def-addvar-inherited-ctx-global-index,$$1,$$3,$$4)) \ +)) + +# Per target and per index/glossary variable +# $(2)$(EXT of $3)_$(4)_$(5)_VAR (source.dvi_INDEX_source_DEPENDS) +# 2: master name +# 3: flavor name +# 4: type (INDEX, GLOSS, ...) +# 5: index name +# Inherit from $2$(EXT of $3)_VAR $(2)_$(3)_$(4)_VAR +# (source.dvi_DEPENDS source_INDEX_source_DEPENDS) +$(eval $(call lu-define-addvar,-index,$$2$$(call lu-getvalue-flavor,EXT,$$3)_$$4_$$5_,index $$2$$(call lu-getvalue-flavor,EXT,$$3)/$$5[$$4],6,\ + $$2$$(call lu-getvalue-flavor,EXT,$$3)_ $$2_$$4_$$5_,\ + $$(eval $$(call lu-def-addvar-inherited-ctx,$$1,$$2,$$3)) \ + $$(eval $$(call lu-def-addvar-inherited-ctx-master-index,$$1,$$2,$$4,$$5)) \ +)) + +define lu-setvar-global # 1:name 2:value + _LU_$(1) ?= $(2) + $$(eval $$(call lu-show-set-var,$(1),global,$(2))) +endef + +define lu-setvar-flavor # 1:name 2:flavor 3:value + _LU_FLAVOR_$(2)_$(1) ?= $(3) + $$(eval $$(call lu-show-set-var,$(1),flavor $(2),$(3))) +endef + +define lu-setvar-master # 1:name 2:master 3:value + _LU_$(2)_$(1) ?= $(3) + $$(eval $$(call lu-show-set-var,$(1),master $(2),$(3))) +endef + +define lu-setvar # 1:name 2:master 3:flavor 4:value + _LU_$(2)$$(call lu-getvalue-flavor,EXT,$(3))_$(1)=$(4) + $$(eval $$(call lu-show-set-var,$(1),master/flavor $(2)/$(3),$(4))) +endef + +define lu-getvalue # 1:name 2:master 3:flavor +$(call lu-show-readone-var,$(1),master/flavor $(2)/$(3),$(or \ + $(LU_$(2)$(call lu-getvalue-flavor,EXT,$(3))_$(1)), \ + $(TD_$(2)$(call lu-getvalue-flavor,EXT,$(3))_$(1)), \ + $(LU_$(2)_$(1)), \ + $($(2)_$(1)), \ + $(LU_FLAVOR_$(3)_$(1)), \ + $(LU_$(1)), \ + $($(1)), \ + $(_LU_$(2)$(call lu-getvalue-flavor,EXT,$(3))_$(1)), \ + $(_LU_$(2)_$(1)), \ + $(_LU_FLAVOR_$(3)_$(1)), \ + $(_LU_$(1))\ +)) +endef + +define lu-getvalue-flavor # 1:name 2:flavor +$(call lu-show-readone-var,$(1),flavor $(2),$(or \ + $(LU_FLAVOR_$(2)_$(1)), \ + $(LU_$(1)), \ + $($(1)), \ + $(_LU_FLAVOR_$(2)_$(1)), \ + $(_LU_$(1))\ +)) +endef + +define lu-getvalue-master # 1:name 2:master +$(call lu-show-readone-var,$(1),master $(2),$(or \ + $(LU_$(2)_$(1)), \ + $($(2)_$(1)), \ + $(LU_$(1)), \ + $($(1)), \ + $(_LU_$(2)_$(1)), \ + $(_LU_$(1))\ +)) +endef + +define lu-getvalue-index # 1:name 2:master 3:flavor 4:type 5:indexname +$(call lu-show-readone-var,$(1),master/flavor/index $(2)/$(3)/[$(4)]$(5),$(or \ + $(LU_$(2)$(call lu-getvalue-flavor,EXT,$(3))_$(4)_$(5)_$(1)), \ + $(LU_$(2)_$(4)_$(5)_$(1)), \ + $(TD_$(2)$(call lu-getvalue-flavor,EXT,$(3))_$(4)_$(5)_$(1)), \ + $($(2)_$(4)_$(5)_$(1)), \ + $(LU_$(4)_$(5)_$(1)), \ + $($(4)_$(5)_$(1)), \ + $(LU_$(2)$(call lu-getvalue-flavor,EXT,$(3))_$(4)_$(1)), \ + $(LU_$(2)_$(4)_$(1)), \ + $($(2)_$(4)_$(1)), \ + $(LU_$(4)_$(1)), \ + $($(4)_$(1)), \ + $(LU_$(2)_$(1)), \ + $($(2)_$(1)), \ + $(LU_FLAVOR_$(3)_$(1)), \ + $(LU_$(1)), \ + $($(1)), \ + $(_LU_$(2)$(call lu-getvalue-flavor,EXT,$(3))_$(4)_$(5)_$(1)), \ + $(_LU_$(2)_$(4)_$(5)_$(1)), \ + $(_LU_$(4)_$(5)_$(1)), \ + $(_LU_$(2)$(call lu-getvalue-flavor,EXT,$(3))_$(4)_$(1)), \ + $(_LU_$(2)_$(4)_$(1)), \ + $(_LU_FLAVOR_$(3)_$(4)_$(1)), \ + $(_LU_$(4)_$(1)), \ + $(_LU_$(2)$(call lu-getvalue-flavor,EXT,$(3))_$(1)), \ + $(_LU_$(2)_$(1)), \ + $(_LU_FLAVOR_$(3)_$(1)), \ + $(_LU_$(1))\ +)) +endef + +define lu-call-prog # 1:varname 2:master 3:flavor [4:index] +$(call lu-getvalue,$(1),$(2),$(3)) $(call lu-getvalues,$(1)_OPTIONS,$(2),$(3)) +endef + +define lu-call-prog-index # 1:varname 2:master 3:flavor 4:type 5:indexname +$(call lu-getvalue$(if $(4),-index),$(1),$(2),$(3),$(4),$(5)) \ + $(call lu-getvalues$(if $(4),-index),$(1)_OPTIONS,$(2),$(3),$(4),$(5)) +endef + +define lu-call-prog-flavor # 1:master 2:flavor +$(call lu-call-prog,$(call lu-getvalue,VARPROG,$(1),$(2)),$(1),$(2)) +endef + +######################################################################### +######################################################################### +######################################################################### +######################################################################### +################## ######################### +################## Global variables ######################### +################## ######################### +######################################################################### +######################################################################### +######################################################################### +######################################################################### +######################################################################### + +# Globals variables +$(eval $(call lu-setvar-global,LATEX,latex)) +$(eval $(call lu-setvar-global,PDFLATEX,pdflatex)) +$(eval $(call lu-setvar-global,DVIPS,dvips)) +$(eval $(call lu-setvar-global,DVIPDFM,dvipdfm)) +$(eval $(call lu-setvar-global,BIBTEX,bibtex)) +#$(eval $(call lu-setvar-global,MPOST,TEX="$(LATEX)" mpost)) +$(eval $(call lu-setvar-global,FIG2DEV,fig2dev)) +#$(eval $(call lu-setvar-global,SVG2DEV,svg2dev)) +$(eval $(call lu-setvar-global,EPSTOPDF,epstopdf)) +$(eval $(call lu-setvar-global,MAKEINDEX,makeindex)) + +# Look for local version, then texmfscript, then in PATH of our program +# At each location, we prefer with suffix than without +define _lu_which # VARNAME progname + ifeq ($(origin _LU_$(1)_DEFAULT), undefined) + _LU_$(1)_DEFAULT := $$(firstword $$(wildcard \ + $$(addprefix bin/,$(2) $$(basename $(2))) \ + $$(addprefix ./,$(2) $$(basename $(2))) \ + $$(shell kpsewhich -format texmfscripts $(2)) \ + $$(shell kpsewhich -format texmfscripts $$(basename $(2))) \ + $$(foreach dir,$$(subst :, ,$$(PATH)), \ + $$(dir)/$(2) $$(dir)/$$(basename $(2))) \ + ) $(2)) + export _LU_$(1)_DEFAULT + endif + $$(eval $$(call lu-setvar-global,$(1),$$(_LU_$(1)_DEFAULT))) +endef + +$(eval $(call _lu_which,GENSUBFIG,gensubfig.py)) +$(eval $(call _lu_which,FIGDEPTH,figdepth.py)) +$(eval $(call _lu_which,GENSUBSVG,gensubfig.py)) +$(eval $(call _lu_which,SVGDEPTH,svgdepth.py)) +$(eval $(call _lu_which,SVG2DEV,svg2dev.py)) +$(eval $(call _lu_which,LATEXFILTER,latexfilter.py)) + +# Rules to use to check if the build document (dvi or pdf) is up-to-date +# This can be overruled per document manually and/or automatically +#REBUILD_RULES ?= latex texdepends bibtopic bibtopic_undefined_references +$(eval $(call lu-addtovar-global,REBUILD_RULES,latex texdepends)) + +# Default maximum recursion level +$(eval $(call lu-setvar-global,MAX_REC,6)) + +######################################################################### +######################################################################### +######################################################################### +######################################################################### +################## ######################### +################## Flavors ######################### +################## ######################### +######################################################################### +######################################################################### +######################################################################### +######################################################################### +######################################################################### + +define lu-create-texflavor # 1:name 2:tex_prog 3:file_ext + # 4:master_cible 5:fig_extention_to_clean + _LU_FLAVORS_DEFINED_TEX += $(1) + $(eval $(call lu-setvar-flavor,VARPROG,$(1),$(2))) + $(eval $(call lu-setvar-flavor,EXT,$(1),$(3))) + $(eval $(call lu-setvar-flavor,TARGETNAME,$(1),$(4))) + $(eval $(call lu-addtovar-flavor,CLEANFIGEXT,$(1),$(5))) + $(eval $(call lu-addtovar-flavor,CLEANSVGEXT,$(1),$(5))) +endef + +define lu-create-dviflavor # 1:name 2:dvi_prog 3:file_ext + # 4:master_cible 5:tex_flavor_depend + $$(eval $$(call lu-define-flavor,$(5))) + _LU_FLAVORS_DEFINED_DVI += $(1) + $(eval $(call lu-setvar-flavor,VARPROG,$(1),$(2))) + $(eval $(call lu-setvar-flavor,EXT,$(1),$(3))) + $(eval $(call lu-setvar-flavor,TARGETNAME,$(1),$(4))) + $(eval $(call lu-setvar-flavor,DEPFLAVOR,$(1),$(5))) +endef + +define lu-create-flavor # 1:name 2:type 3..7:options + $$(if $$(filter $(1),$(_LU_FLAVORS_DEFINED)), \ + $$(call lu-show-flavors,Flavor $(1) already defined), \ + $$(call lu-show-flavors,Creating flavor $(1) ($(2))) \ + $$(eval $$(call lu-create-$(2)flavor,$(1),$(3),$(4),$(5),$(6),$(7)))) +endef + +define lu-define-flavor # 1:name + $$(eval $$(call lu-define-flavor-$(1))) +endef + +define lu-flavor-rules # 1:name + $$(call lu-show-flavors,Defining rules for flavor $(1)) + $$(if $$(call lu-getvalue-flavor,TARGETNAME,$(1)), \ + $$(call lu-getvalue-flavor,TARGETNAME,$(1)): \ + $$(call lu-getvalues-flavor,TARGETS,$(1))) + $$(if $$(call lu-getvalue-flavor,TARGETNAME,$(1)), \ + .PHONY: $$(call lu-getvalue-flavor,TARGETNAME,$(1))) +endef + +define lu-define-flavor-DVI # + $$(eval $$(call lu-create-flavor,DVI,tex,LATEX,.dvi,dvi,\ + .pstex_t .pstex)) +endef + +define lu-define-flavor-PDF # + $$(eval $$(call lu-create-flavor,PDF,tex,PDFLATEX,.pdf,pdf,\ + .pdftex_t .$$(_LU_PDFTEX_EXT))) +endef + +define lu-define-flavor-PS # + $$(eval $$(call lu-create-flavor,PS,dvi,DVIPS,.ps,ps,DVI)) +endef + +define lu-define-flavor-DVIPDF # + $$(eval $$(call lu-create-flavor,DVIPDF,dvi,DVIPDFM,.pdf,pdf,DVI)) +endef + +$(eval $(call lu-addtovar-global,FLAVORS,PDF PS)) + +######################################################################### +######################################################################### +######################################################################### +######################################################################### +################## ######################### +################## Masters ######################### +################## ######################### +######################################################################### +######################################################################### +######################################################################### +######################################################################### +######################################################################### + +define _lu-do-latex # 1:master 2:flavor 3:source.tex 4:ext(.dvi/.pdf) + exec 3>&1; \ + run() { \ + echo -n "Running:" 1>&3 ; \ + for arg; do \ + echo -n " '$$arg'" 1>&3 ; \ + done ; echo 1>&3 ; \ + "$$@" ; \ + }; \ + doit() { \ + $(RM) -v "$(1)$(4)_FAILED" \ + "$(1)$(4)_NEED_REBUILD" \ + "$(1)$(4).mk" ;\ + ( echo X | \ + run $(call lu-call-prog-flavor,$(1),$(2)) \ + --interaction errorstopmode \ + --jobname "$(1)" \ + '\RequirePackage[extension='"$(4)"']{texdepends}\input'"{$(3)}" || \ + touch "$(1)$(4)_FAILED" ; \ + if grep -sq '^! LaTeX Error:' "$(1).log" ; then \ + touch "$(1)$(4)_FAILED" ; \ + fi \ + ) | $(call lu-call-prog,LATEXFILTER,$(1),$(2)) ; \ + NO_TEXDEPENDS_FILE=0 ;\ + if [ ! -f "$(1)$(4).mk" ]; then \ + NO_TEXDEPENDS_FILE=1 ;\ + fi ;\ + sed -e 's,\\openout[0-9]* = `\(.*\)'"'.,TD_$(1)$(4)_OUTPUTS += \1,p;d" \ + "$(1).log" >> "$(1)$(4).mk" ;\ + if [ -f "$(1)$(4)_FAILED" ]; then \ + echo "*************************************" ;\ + echo "Building $(1)$(4) fails" ;\ + echo "*************************************" ;\ + echo "Here are the last lines of the log file" ;\ + echo "If this is not enought, try to" ;\ + echo "call 'make' with 'VERB=verbose' option" ;\ + echo "*************************************" ;\ + echo "==> Last lines in $(1).log <==" ; \ + sed -e '/^[?] X$$/,$$d' \ + -e '/^Here is how much of TeX'"'"'s memory you used:$$/,$$d' \ + < "$(1).log" | tail -n 20; \ + return 1; \ + fi; \ + if [ "$$NO_TEXDEPENDS_FILE" = 1 ]; then \ + echo "*************************************" ;\ + echo "texdepends does not seems be loaded" ;\ + echo "Either your (La)TeX installation is wrong or you found a bug." ;\ + echo "If so, please, report it (with the result of shell command 'kpsepath tex')";\ + echo "Aborting compilation" ;\ + echo "*************************************" ;\ + touch "$(1)$(4)_FAILED" ; \ + return 1 ;\ + fi ;\ + }; doit +endef + +.PHONY: clean-build-fig + +########################################################## +define lu-master-texflavor-index-vars # MASTER FLAVOR TYPE INDEX ext(.dvi/.pdf) + $$(call lu-show-rules,Setting flavor index vars for $(1)/$(2)/[$(3)]$(4)) + $$(eval $$(call lu-addtovar,DEPENDS,$(1),$(2), \ + $$(call lu-getvalue-index,TARGET,$(1),$(2),$(3),$(4)))) + $$(eval $$(call lu-addtovar,WATCHFILES,$(1),$(2), \ + $$(call lu-getvalue-index,SRC,$(1),$(2),$(3),$(4)))) +endef #################################################### +define lu-master-texflavor-index-rules # MASTER FLAVOR TYPE INDEX ext(.dvi/.pdf) + $$(call lu-show-rules,Setting flavor index rules for $(1)/$(2)/[$(3)]$(4)) + $$(if $$(_LU_DEF_IND_$$(call lu-getvalue-index,TARGET,$(1),$(2),$(3),$(4))), \ + $$(call lu-show-rules,=> Skipping: already defined in flavor $$(_LU_DEF_IND_$$(call lu-getvalue-index,TARGET,$(1),$(2),$(3),$(4)))), \ + $$(eval $$(call _lu-master-texflavor-index-rules\ + ,$(1),$(2),$(3),$(4),$(5),$$(call lu-getvalue-index,TARGET,$(1),$(2),$(3),$(4))))) +endef +define _lu-master-texflavor-index-rules # MASTER FLAVOR TYPE INDEX ext TARGET + $(6): \ + $$(call lu-getvalue-index,SRC,$(1),$(2),$(3),$(4)) \ + $$(wildcard $$(call lu-getvalue-index,STYLE,$(1),$(2),$(3),$(4))) + $$(COMMON_PREFIX)$$(call lu-call-prog-index,MAKEINDEX,$(1),$(2),$(3),$(4)) \ + $$(addprefix -s ,$$(call lu-getvalue-index,STYLE,$(1),$(2),$(3),$(4))) \ + -o $$@ $$< + _LU_DEF_IND_$(6)=$(2) + clean:: + $$(call lu-clean,$$(call lu-getvalue-index,TARGET,$(1),$(2),$(3),$(4)) \ + $$(addsuffix .ilg,$$(basename \ + $$(call lu-getvalue-index,SRC,$(1),$(2),$(3),$(4))))) +endef #################################################### +define lu-master-texflavor-index # MASTER FLAVOR INDEX ext(.dvi/.pdf) + $$(eval $$(call lu-master-texflavor-index-vars,$(1),$(2),$(3),$(4))) + $$(eval $$(call lu-master-texflavor-index-rules,$(1),$(2),$(3),$(4))) +endef +########################################################## + +########################################################## +define lu-master-texflavor-vars # MASTER FLAVOR ext(.dvi/.pdf) + $$(call lu-show-rules,Setting flavor vars for $(1)/$(2)) + -include $(1)$(3).mk + $$(eval $$(call lu-addtovar,DEPENDS,$(1),$(2), \ + $$(call lu-getvalues,FIGURES,$(1),$(2)) \ + $$(call lu-getvalues,BIBFILES,$(1),$(2)) \ + $$(wildcard $$(call lu-getvalues,INPUTS,$(1),$(2))) \ + $$(wildcard $$(call lu-getvalues,BIBSTYLES,$(1),$(2))) \ + $$(call lu-getvalues,BBLFILES,$(1),$(2))\ + )) + + $$(eval $$(call lu-addtovar-flavor,TARGETS,$(2),$(1)$(3))) + + $$(eval $$(call lu-addtovar,GPATH,$(1),$(2), \ + $$(subst },,$$(subst {,,$$(subst }{, ,\ + $$(call lu-getvalue,GRAPHICSPATH,$(1),$(2))))))) + + $$(if $$(sort $$(call lu-getvalues,SUBFIGS,$(1),$(2))), \ + $$(eval include $$(addsuffix .mk,$$(sort \ + $$(call lu-getvalues,SUBFIGS,$(1),$(2)))))) + + $$(eval $$(call lu-addtovar,WATCHFILES,$(1),$(2), \ + $$(filter %.aux, $$(call lu-getvalues,OUTPUTS,$(1),$(2))))) + + $$(foreach type,$$(call lu-getvalues,INDEXES,$(1),$(2)), \ + $$(foreach index,$$(call lu-getvalues,INDEXES_$$(type),$(1),$(2)), \ + $$(eval $$(call lu-master-texflavor-index-vars,$(1),$(2),$$(type),$$(index),$(3))))) +endef #################################################### +define lu-master-texflavor-rules # MASTER FLAVOR ext(.dvi/.pdf) + $$(call lu-show-rules,Defining flavor rules for $(1)/$(2)) + $$(call lu-getvalues,BBLFILES,$(1),$(2)): \ + $$(sort $$(call lu-getvalues,BIBFILES,$(1),$(2)) \ + $$(wildcard $$(call lu-getvalues,BIBSTYLES,$(1),$(2)))) + $(1)$(3): %$(3): \ + $$(call lu-getvalues,DEPENDS,$(1),$(2)) \ + $$(call lu-getvalues,REQUIRED,$(1),$(2)) \ + $$(if $$(wildcard $(1)$(3)_FAILED),LU_FORCE,) \ + $$(if $$(wildcard $(1)$(3)_NEED_REBUILD),LU_FORCE,) \ + $$(if $$(wildcard $(1)$(3)_NEED_REBUILD_IN_PROGRESS),LU_FORCE,) + $$(if $$(filter-out $$(LU_REC_LEVEL),$$(call lu-getvalue,MAX_REC,$(1),$(2))),, \ + $$(warning *********************************) \ + $$(warning *********************************) \ + $$(warning *********************************) \ + $$(warning Stopping generation of $$@) \ + $$(warning I got max recursion level $$(LU_$(1)_$(2)_MAX_REC)) \ + $$(warning Set LU_$(1)_$(2)_MAX_REC, LU_MAX_REC_$(1) or LU_MAX_REC if you need it) \ + $$(warning *********************************) \ + $$(warning *********************************) \ + $$(warning *********************************) \ + $$(error Aborting generation of $$@)) + $$(MAKE) LU_REC_MASTER="$(1)" LU_REC_FLAVOR="$(2)" LU_REC_TARGET="$$@"\ + LU_WATCH_FILES_SAVE + $$(COMMON_PREFIX)$$(call _lu-do-latex\ + ,$(1),$(2),$$(call lu-getvalue-master,MAIN,$(1)),$(3)) + $$(MAKE) LU_REC_MASTER="$(1)" LU_REC_FLAVOR="$(2)" LU_REC_TARGET="$$@"\ + LU_WATCH_FILES_RESTORE + $$(MAKE) LU_REC_MASTER="$(1)" LU_REC_FLAVOR="$(2)" LU_REC_TARGET="$$@"\ + $(1)$(3)_NEED_REBUILD +ifneq ($(LU_REC_TARGET),) + $(1)$(3)_NEED_REBUILD_IN_PROGRESS: + $$(COMMON_HIDE)touch $(1)$(3)_NEED_REBUILD_IN_PROGRESS + $$(addprefix LU_rebuild_,$$(call lu-getvalues,REBUILD_RULES,$(1),$(2))): \ + $(1)$(3)_NEED_REBUILD_IN_PROGRESS +.PHONY: $(1)$(3)_NEED_REBUILD + $(1)$(3)_NEED_REBUILD: \ + $(1)$(3)_NEED_REBUILD_IN_PROGRESS \ + $$(addprefix LU_rebuild_,$$(call lu-getvalues,REBUILD_RULES,$(1),$(2))) + $$(COMMON_HIDE)$(RM) $(1)$(3)_NEED_REBUILD_IN_PROGRESS + $$(COMMON_HIDE)if [ -f "$(1)$(3)_NEED_REBUILD" ];then\ + echo "********************************************" ;\ + echo "*********** New build needed ***************" ;\ + echo "********************************************" ;\ + cat "$(1)$(3)_NEED_REBUILD" ; \ + echo "********************************************" ;\ + fi + $$(MAKE) LU_REC_LEVEL=$$(shell expr $$(LU_REC_LEVEL) + 1) \ + $$(LU_REC_TARGET) +endif + clean-build-fig:: + $$(call lu-clean,$$(foreach fig, \ + $$(basename $$(wildcard $$(filter %.fig, \ + $$(call lu-getvalues,FIGURES,$(1),$(2))))), \ + $$(addprefix $$(fig),$$(call lu-getvalues-flavor,CLEANFIGEXT,$(2))))) + $$(call lu-clean,$$(foreach svg, \ + $$(basename $$(wildcard $$(filter %.svg, \ + $$(call lu-getvalues,FIGURES,$(1),$(2))))), \ + $$(addprefix $$(svg),$$(call lu-getvalues-flavor,CLEANSVGEXT,$(2))))) + clean:: clean-build-fig + $$(call lu-clean,$$(call lu-getvalues,OUTPUTS,$(1),$(2)) \ + $$(call lu-getvalues,BBLFILES,$(1),$(2)) \ + $$(addsuffix .mk,$$(call lu-getvalues,SUBFIGS,$(1),$(2))) \ + $$(patsubst %.bbl,%.blg,$$(call lu-getvalues,BBLFILES,$(1),$(2)))) + $$(call lu-clean,$$(wildcard $(1).log)) + distclean:: + $$(call lu-clean,$$(wildcard $(1)$(3) $(1)$(3)_FAILED \ + $(1)$(3)_NEED_REBUILD $(1)$(3)_NEED_REBUILD_IN_PROGRESS)) + $$(foreach type,$$(call lu-getvalues,INDEXES,$(1),$(2)), \ + $$(foreach index,$$(call lu-getvalues,INDEXES_$$(type),$(1),$(2)), \ + $$(eval $$(call lu-master-texflavor-index-rules,$(1),$(2),$$(type),$$(index),$(3))))) +endef #################################################### +define lu-master-texflavor # MASTER FLAVOR ext(.dvi/.pdf) + $$(eval $$(call lu-master-texflavor-vars,$(1),$(2),$(3))) + $$(eval $$(call lu-master-texflavor-rules,$(1),$(2),$(3))) +endef +########################################################## + +########################################################## +define lu-master-dviflavor-vars # MASTER FLAVOR ext(.ps) + $$(call lu-show-rules,Setting flavor vars for \ + $(1)/$(2)/$$(call lu-getvalue-flavor,DEPFLAVOR,$(2))) +# $$(eval $$(call lu-addvar,VARPROG,$(1),$(2))) +# $$(eval $$(call lu-addvar,$$(call lu-getvalue,VARPROG,$(1),$(2)),$(1),$(2))) + $$(eval $$(call lu-addtovar-flavor,TARGETS,$(2),$(1)$(3))) +endef #################################################### +define lu-master-dviflavor-rules # MASTER FLAVOR ext(.ps) + $$(call lu-show-rules,Defining flavor rules for \ + $(1)/$(2)/$$(call lu-getvalue-flavor,DEPFLAVOR,$(2))) + $(1)$(3): %$(3): %$$(call lu-getvalue-flavor,EXT,$$(call lu-getvalue-flavor,DEPFLAVOR,$(2))) + $$(call lu-call-prog-flavor,$(1),$(2)) -o $$@ $$< + distclean:: + $$(call lu-clean,$$(wildcard $(1)$(3))) +endef #################################################### +define lu-master-dviflavor # MASTER FLAVOR ext(.ps) + $$(eval $$(call lu-master-dviflavor-vars,$(1),$(2),$(3))) + $$(eval $$(call lu-master-dviflavor-rules,$(1),$(2),$(3))) +endef +########################################################## + +########################################################## +define lu-master-vars # MASTER + $$(call lu-show-rules,Setting vars for $(1)) + $$(eval $$(call lu-setvar-master,MAIN,$(1),$(1).tex)) + $$(eval $$(call lu-addtovar-master,DEPENDS,$(1),\ + $$(call lu-getvalue-master,MAIN,$(1)))) + _LU_$(1)_DVI_FLAVORS=$$(filter $$(_LU_FLAVORS_DEFINED_DVI),\ + $$(sort $$(call lu-getvalues-master,FLAVORS,$(1)))) + _LU_$(1)_TEX_FLAVORS=$$(filter $$(_LU_FLAVORS_DEFINED_TEX),\ + $$(sort $$(call lu-getvalues-master,FLAVORS,$(1)) \ + $$(LU_REC_FLAVOR) \ + $$(foreach dvi,$$(call lu-getvalues-master,FLAVORS,$(1)), \ + $$(call lu-getvalue-flavor,DEPFLAVOR,$$(dvi))))) + $$(foreach flav,$$(_LU_$(1)_TEX_FLAVORS), $$(eval $$(call \ + lu-master-texflavor-vars,$(1),$$(flav),$$(call lu-getvalue-flavor,EXT,$$(flav))))) + $$(foreach flav,$$(_LU_$(1)_DVI_FLAVORS), $$(eval $$(call \ + lu-master-dviflavor-vars,$(1),$$(flav),$$(call lu-getvalue-flavor,EXT,$$(flav))))) +endef #################################################### +define lu-master-rules # MASTER + $$(call lu-show-rules,Defining rules for $(1)) + $$(foreach flav,$$(_LU_$(1)_TEX_FLAVORS), $$(eval $$(call \ + lu-master-texflavor-rules,$(1),$$(flav),$$(call lu-getvalue-flavor,EXT,$$(flav))))) + $$(foreach flav,$$(_LU_$(1)_DVI_FLAVORS), $$(eval $$(call \ + lu-master-dviflavor-rules,$(1),$$(flav),$$(call lu-getvalue-flavor,EXT,$$(flav))))) +endef #################################################### +define lu-master # MASTER + $$(eval $$(call lu-master-vars,$(1))) + $$(eval $$(call lu-master-rules,$(1))) +endef +########################################################## + +#$(warning $(call LU_RULES,example)) +$(eval $(call lu-addtovar-global,MASTERS,\ + $$(shell grep -l '\\documentclass' *.tex 2>/dev/null | sed -e 's/\.tex$$$$//'))) +ifneq ($(LU_REC_TARGET),) +_LU_DEF_MASTERS = $(LU_REC_MASTER) +_LU_DEF_FLAVORS = $(LU_REC_FLAVOR) $(FLAV_DEPFLAVOR_$(LU_REC_FLAVOR)) +else +_LU_DEF_MASTERS = $(call lu-getvalues-global,MASTERS) +_LU_DEF_FLAVORS = $(sort $(foreach master,$(_LU_DEF_MASTERS),\ + $(call lu-getvalues-master,FLAVORS,$(master)))) +endif + +$(foreach flav, $(_LU_DEF_FLAVORS), $(eval $(call lu-define-flavor,$(flav)))) +$(foreach master, $(_LU_DEF_MASTERS), $(eval $(call lu-master-vars,$(master)))) +$(foreach flav, $(_LU_FLAVORS_DEFINED), $(eval $(call lu-flavor-rules,$(flav)))) +$(foreach master, $(_LU_DEF_MASTERS), $(eval $(call lu-master-rules,$(master)))) + +##################################################################"" +# Gestion des subfigs + +%.subfig.mk: %.subfig %.fig + $(COMMON_PREFIX)$(call lu-call-prog,GENSUBFIG) \ + -p '$$(COMMON_PREFIX)$(call lu-call-prog,FIGDEPTH) < $$< > $$@' \ + -s $*.subfig $*.fig < $^ > $@ + +%.subfig.mk: %.subfig %.svg + $(COMMON_PREFIX)$(call lu-call-prog,GENSUBSVG) \ + -p '$$(COMMON_PREFIX)$(call lu-call-prog,SVGDEPTH) < $$< > $$@' \ + -s $*.subfig $*.svg < $^ > $@ + +clean:: + $(call lu-clean,$(FIGS2CREATE_LIST)) + $(call lu-clean,$(FIGS2CREATE_LIST:%.fig=%.pstex)) + $(call lu-clean,$(FIGS2CREATE_LIST:%.fig=%.pstex_t)) + $(call lu-clean,$(FIGS2CREATE_LIST:%.fig=%.$(_LU_PDFTEX_EXT))) + $(call lu-clean,$(FIGS2CREATE_LIST:%.fig=%.pdftex_t)) + $(call lu-clean,$(FIGS2CREATE_LIST:%.svg=%.pstex)) + $(call lu-clean,$(FIGS2CREATE_LIST:%.svg=%.pstex_t)) + $(call lu-clean,$(FIGS2CREATE_LIST:%.svg=%.$(_LU_PDFTEX_EXT))) + $(call lu-clean,$(FIGS2CREATE_LIST:%.svg=%.pdftex_t)) + +.PHONY: LU_FORCE clean distclean +LU_FORCE: + @echo "Previous compilation failed. Rerun needed" + +#$(warning $(MAKEFILE)) + +distclean:: clean + +%.eps: %.fig + $(COMMON_PREFIX)$(call lu-call-prog,FIG2DEV) -L eps $< $@ + +%.pdf: %.fig + $(COMMON_PREFIX)$(call lu-call-prog,FIG2DEV) -L pdf $< $@ + +%.pstex: %.fig + $(COMMON_PREFIX)$(call lu-call-prog,FIG2DEV) -L pstex $< $@ + +%.pstex: %.svg + $(COMMON_PREFIX)$(call lu-call-prog,SVG2DEV) -L pstex $< $@ + + +.PRECIOUS: %.pstex +%.pstex_t: %.fig %.pstex + $(COMMON_PREFIX)$(call lu-call-prog,FIG2DEV) -L pstex_t -p $*.pstex $< $@ + +%.pstex_t: %.svg %.pstex + $(COMMON_PREFIX)$(call lu-call-prog,SVG2DEV) -L pstex_t -p $*.pstex $< $@ + + +%.$(_LU_PDFTEX_EXT): %.fig + $(COMMON_PREFIX)$(call lu-call-prog,FIG2DEV) -L pdftex $< $@ + +%.$(_LU_PDFTEX_EXT): %.svg + $(COMMON_PREFIX)$(call lu-call-prog,SVG2DEV) -L pdftex $< $@ + +.PRECIOUS: %.$(_LU_PDFTEX_EXT) +%.pdftex_t: %.fig %.$(_LU_PDFTEX_EXT) + $(COMMON_PREFIX)$(call lu-call-prog,FIG2DEV) -L pdftex_t -p $*.$(_LU_PDFTEX_EXT) $< $@ + +%.pdftex_t: %.svg %.$(_LU_PDFTEX_EXT) + $(COMMON_PREFIX)$(call lu-call-prog,SVG2DEV) -L pdftex_t -p $*.$(_LU_PDFTEX_EXT) $< $@ + +%.pdf: %.eps + $(COMMON_PREFIX)$(call lu-call-prog,EPSTOPDF) --filter < $< > $@ + +######################################################################### +# Les flavors +LU_REC_LEVEL ?= 1 +ifneq ($(LU_REC_TARGET),) +export LU_REC_FLAVOR +export LU_REC_MASTER +export LU_REC_TARGET +export LU_REC_LEVEL +LU_REC_LOGFILE=$(LU_REC_MASTER).log +LU_REC_GENFILE=$(LU_REC_MASTER)$(call lu-getvalue-flavor,EXT,$(LU_REC_FLAVOR)) + +lu-rebuild-head=$(info *** Checking rebuild with rule '$(subst LU_rebuild_,,$@)') +lu-rebuild-needed=echo $(1) >> "$(LU_REC_GENFILE)_NEED_REBUILD" ; + +.PHONY: $(addprefix LU_rebuild_,latex texdepends bibtex) +LU_rebuild_latex: + $(call lu-rebuild-head) + $(COMMON_HIDE)if grep -sq 'Rerun to get'\ + "$(LU_REC_LOGFILE)" ; then \ + $(call lu-rebuild-needed\ + ,"$@: new run needed (LaTeX message 'Rerun to get...')") \ + fi + +LU_rebuild_texdepends: + $(call lu-rebuild-head) + $(COMMON_HIDE)if grep -sq '^Package texdepends Warning: .* Check dependencies again.$$'\ + "$(LU_REC_LOGFILE)" ; then \ + $(call lu-rebuild-needed,"$@: new depends required") \ + fi + +LU_rebuild_bibtopic: + $(call lu-rebuild-head) + $(COMMON_HIDE)sed -e '/^Package bibtopic Warning: Please (re)run BibTeX on the file(s):$$/,/^(bibtopic) *and after that rerun LaTeX./{s/^(bibtopic) *\([^ ]*\)$$/\1/p};d' \ + "$(LU_REC_LOGFILE)" | while read file ; do \ + touch $$file.aux ; \ + $(call lu-rebuild-needed,"bibtopic: $$file.bbl outdated") \ + done + +LU_rebuild_bibtopic_undefined_references: + $(call lu-rebuild-head) + $(COMMON_HIDE)if grep -sq 'There were undefined references'\ + "$(MASTER_$(LU_REC_MASTER)).log" ; then \ + $(call lu-rebuild-needed,"$@: new run needed") \ + fi + +.PHONY: LU_WATCH_FILES_SAVE LU_WATCH_FILES_RESTORE +LU_WATCH_FILES_SAVE: + $(COMMON_HIDE)$(foreach file, $(sort \ + $(call lu-getvalues,WATCHFILES,$(LU_REC_MASTER),$(LU_REC_FLAVOR))), \ + $(call lu-save-file,$(file),$(file).orig);) + +LU_WATCH_FILES_RESTORE: + $(COMMON_HIDE)$(foreach file, $(sort \ + $(call lu-getvalues,WATCHFILES,$(LU_REC_MASTER),$(LU_REC_FLAVOR))), \ + $(call lu-cmprestaure-file,"$(file)","$(file).orig",\ + echo "New $(file) file" >> $(LU_REC_GENFILE)_NEED_REBUILD;\ + );) + +endif + +%.bbl: %.aux + $(COMMON_PREFIX)$(call lu-call-prog,BIBTEX) $* diff --git a/Master/texmf-dist/doc/support/latex-make/LaTeX.mk.conf b/Master/texmf-dist/doc/support/latex-make/LaTeX.mk.conf new file mode 100644 index 00000000000..c6f3fa931d7 --- /dev/null +++ b/Master/texmf-dist/doc/support/latex-make/LaTeX.mk.conf @@ -0,0 +1,3 @@ +# Choose between GNU/BSD utilities (cp, rm, ...) +# LU_UTILS = GNU +# LU_UTILS = BSD diff --git a/Master/texmf-dist/doc/support/latex-make/README b/Master/texmf-dist/doc/support/latex-make/README new file mode 100644 index 00000000000..57e43009a5e --- /dev/null +++ b/Master/texmf-dist/doc/support/latex-make/README @@ -0,0 +1,63 @@ + +------------------------------+ + | The LaTeX-Make system | + +------------------------------+ + +VERSION: 2.1.19.1 + +DESCRIPTION +=========== + +This package provides several tools that aim to simplify the +compilation of LaTeX documents: +* LaTeX.mk: a Makefile snippet to help compiling LaTeX documents in + DVI, PDF, PS, ... format. Dependencies are automatically tracked: one + should be able to compile documents with a one-line Makefile + containing 'include LaTeX.mk'. Complex documents (with multiple + bibliographies, indexes, glossaries, ...) should be correctly managed. + +* figlatex.sty: a LaTeX package to easily insert xfig figures (with + \includegraphics{file.fig}). It can interact with LaTeX.mk so that the + latter automatically invokes transfig if needed. + +* And various helper tools for LaTeX.mk + +Homepage: http://gforge.inria.fr/projects/latex-utils/ +License type: gpl + +INSTALLATION: +============= + +Once generated, the following files need to be installed: +* LaTeX.mk: + This is the Makefile snipset to include into your main Makefile. + To avoid the need to hardcode the path of LaTeX.mk in the 'include' directive + of the Makefile, LaTeX.mk must be installed in a default search directory of + GNUMake such as PREFIX/include, /usr/local/include, /usr/include/, etc. + See your GNUMake documentation for the list of such search directories; +* *.sty, *.cfg + Main LaTeX package files. Should be installed into + TEXMF/tex/latex/latex-make/ where TEXMF is a base of a TeX Directory + Structure for your TeX installation; +* *.py + Helper scripts used by LaTeX.mk. They should be installed into + TEXMF/scripts/latex-make/ +* *.pdf + Documentation that can be installed into + TEXMF/doc/latex/latex-make/ + +REQUIREMENTS: +============= + + In order to work, LaTeX Make requires: + - GNU Make (>= 3.81) + type "make --version" to check + - a relatively recent LaTeX distribution (teTeX 3.0 should work, + TeXLive >= 2005 also) + + If using figlatex, LaTeX Make also needs: + - inkscape (>= 0.48.2) for converting svg files + - transfig (>= 3.2.4) for the fig2dev command + type "transfig -V" to check + - ghostscript that is called by fig2dev + type "gs --version" to check + diff --git a/Master/texmf-dist/doc/support/latex-make/figlatex.pdf b/Master/texmf-dist/doc/support/latex-make/figlatex.pdf Binary files differnew file mode 100644 index 00000000000..dadd499d909 --- /dev/null +++ b/Master/texmf-dist/doc/support/latex-make/figlatex.pdf diff --git a/Master/texmf-dist/doc/support/latex-make/latex-make.pdf b/Master/texmf-dist/doc/support/latex-make/latex-make.pdf Binary files differnew file mode 100644 index 00000000000..9d9c2ca5035 --- /dev/null +++ b/Master/texmf-dist/doc/support/latex-make/latex-make.pdf diff --git a/Master/texmf-dist/doc/support/latex-make/texdepends.pdf b/Master/texmf-dist/doc/support/latex-make/texdepends.pdf Binary files differnew file mode 100644 index 00000000000..400393dcad7 --- /dev/null +++ b/Master/texmf-dist/doc/support/latex-make/texdepends.pdf diff --git a/Master/texmf-dist/scripts/latex-make/figdepth.py b/Master/texmf-dist/scripts/latex-make/figdepth.py new file mode 100755 index 00000000000..7782d0b29e6 --- /dev/null +++ b/Master/texmf-dist/scripts/latex-make/figdepth.py @@ -0,0 +1,51 @@ +#!/usr/bin/env python +#coding=utf8 + +""" + +stdin : the original xfig file +stdout : the output xfig file +args : all depths we want to keep + +""" + +import optparse +import os.path +import sys + +def main(): + parser = optparse.OptionParser() + (options, args) = parser.parse_args() + + depths_to_keep = set() + for arg in args: + depths_to_keep.add(arg) + + comment = '' + display = True + def show(depth, line): + if depth in depths_to_keep: + print comment+line, + return True + else: + return False + for line in sys.stdin: + if line[0] == '#': + comment += line + continue + if line[0] in "\t ": + if display: + print line + else: + Fld = line.split(' ', 9999) + if not Fld[0] or Fld[0] not in ('1', '2', '3', '4', '5'): + print comment+line + display = True + elif Fld[0] == '4': + display = show(Fld[3], line) + else: + display = show(Fld[6], line) + comment = '' + +if __name__ == "__main__": + main() diff --git a/Master/texmf-dist/scripts/latex-make/gensubfig.py b/Master/texmf-dist/scripts/latex-make/gensubfig.py new file mode 100755 index 00000000000..a6fcd5d5677 --- /dev/null +++ b/Master/texmf-dist/scripts/latex-make/gensubfig.py @@ -0,0 +1,63 @@ +#!/usr/bin/env python +#coding=utf8 + +""" + +Arguments passes : + - fichier image (image.fig ou image.svg) + - -s fichier subfig (image.subfig) + - -p chemin du script pour generer les sous-images (svgdepth.py ou figdepth.py) + +Sortie standard : + - makefile pour creer les sous-images (au format .fig ou .svg), et pour les supprimer + +""" + +from optparse import OptionParser +import os.path + +def main(): + parser = OptionParser(usage='usage: %prog [options] svg file', description='Creates a\ +Makefile generating subfigures using figdepth.py or svgdepth.py') + parser.add_option("-s", "--subfig", dest="subfig", help="subfig file") + parser.add_option("-p", "--depth", dest="depth", help="full path of depth script") + (options, args) = parser.parse_args() + if len(args) < 1: + parser.error("incorrect number of arguments") + if not options.subfig: + parser.error("no subfig file specified") + if not options.depth: + parser.error("no depth script specified") + + (root, ext) = os.path.splitext(args[0]) + sf_name = options.subfig + ds_name = options.depth + varname = '%s_FIGS' % root.upper() + + subfigs = [] + for line in open(options.subfig, 'r'): + t = line.find('#') # looking for comments + if t > -1: line = line[0:t] # remove comments... + line = line.strip() #remove blank chars + if line == '': continue + subfigs.append(line) + + count = 1 + for subfig in subfigs: + print "%s_%d%s: %s%s %s" % (root, count, ext, root, ext, sf_name) + print "\t%s %s" % (ds_name, subfig) + print "" + count += 1 + print "%s := $(foreach n, " % varname, + count = 1 + for subfig in subfigs: + print '%d ' % count, + count += 1 + print ", %s_$(n)%s)" % (root, ext) + print "FILES_TO_DISTCLEAN += $(%s)" % varname + print "FIGS2CREATE_LIST += $(%s)" % varname + print "$(TEMPORAIRE): $(%s)" % varname + print "$(TEMPORAIRE): $(%s)" % varname + +if __name__ == "__main__": + main() diff --git a/Master/texmf-dist/scripts/latex-make/latexfilter.py b/Master/texmf-dist/scripts/latex-make/latexfilter.py new file mode 100755 index 00000000000..1e94870125d --- /dev/null +++ b/Master/texmf-dist/scripts/latex-make/latexfilter.py @@ -0,0 +1,59 @@ +#!/usr/bin/env python +#coding=utf8 + +""" + +stdin : the original xfig file +stdout : the output xfig file +args : all depths we want to keep + +""" + +from __future__ import print_function +import optparse +import os.path +import re +import sys + +def main(): + parser = optparse.OptionParser() + (options, args) = parser.parse_args() + + display = 0 + in_display = 0 + start_line = '' + warnerror_re = re.compile(r"^(LaTeX|Package|Class)( (.*))? (Warning:|Error:)") + fullbox_re = re.compile(r"^(Underfull|Overfull) \\[hv]box") + accu = '' + for line in sys.stdin: + if display > 0: + display -= 1 + if line[0:4].lower() in ('info', 'warn') or line[0:5].lower() == 'error': + display = 0 + line_groups = warnerror_re.match(line) + if line_groups: + start_line = line_groups.group(3) + if not start_line: + start_line = '' + if line_groups.group(2): + start_line = "(" + start_line + ")" + display = 1 + in_display = 1 + elif (start_line != '') and (line[0:len(start_line)] == start_line): + display = 1 + elif line == "\n": + in_display = 0 + elif line[0:4] == 'Chap': + display = 1 + elif fullbox_re.match(line): + display = 2 + if display: + print(accu, end="") + accu = line + elif in_display: + print(accu[0:-1], end="") + accu = line + +if __name__ == "__main__": + main() + diff --git a/Master/texmf-dist/scripts/latex-make/svg2dev.py b/Master/texmf-dist/scripts/latex-make/svg2dev.py new file mode 100755 index 00000000000..1b968edfc49 --- /dev/null +++ b/Master/texmf-dist/scripts/latex-make/svg2dev.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python +#coding=utf8 + +from optparse import OptionParser +import shutil +import subprocess + +svg2eps = 'inkscape %s -z -C --export-eps=%s --export-latex' +svg2pdf = 'inkscape %s -z -C --export-pdf=%s --export-latex' + +def create_image(input_filename, output_filename, mode): + subprocess.Popen(mode % (input_filename, output_filename), + stdout=subprocess.PIPE, shell=True).communicate()[0] + n1 = output_filename + '_tex' + n2 = output_filename + '_t' + shutil.move(n1, n2) + +def main(): + parser = OptionParser() + parser.add_option("-L", "--format", dest="outputFormat", + metavar="FORMAT", help="output format", default="spstex") + parser.add_option("-p", "--portrait", dest="portrait", help="dummy arg") + (options, args) = parser.parse_args() + if len(args) != 2: return + (input_filename, output_filename) = args + fmt = options.outputFormat + portrait = options.portrait + + if fmt == 'eps': + create_image(input_filename, output_filename, svg2eps) + elif fmt == 'spstex' or fmt == 'pstex': + create_image(input_filename, output_filename, svg2eps) + elif fmt == 'spstex_t' or fmt == 'pstex_t': + pass + elif fmt == 'spdftex' or fmt == 'pdftex': + create_image(input_filename, output_filename, svg2pdf) + elif fmt == 'spdftex_t' or fmt == 'pdftex_t': + pass + +if __name__ == "__main__": + main() + diff --git a/Master/texmf-dist/scripts/latex-make/svgdepth.py b/Master/texmf-dist/scripts/latex-make/svgdepth.py new file mode 100755 index 00000000000..6f146647b15 --- /dev/null +++ b/Master/texmf-dist/scripts/latex-make/svgdepth.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python +#coding=utf8 + +import sys +import xml.parsers.expat + +layers = [] +for arg in sys.argv: + layers.append(arg) + +parser = xml.parsers.expat.ParserCreate() +class XmlParser(object): + def __init__(self, layers): + self.state_stack = [True] + self.last_state = True + self.layers = layers + def XmlDeclHandler(self, version, encoding, standalone): + sys.stdout.write("<?xml version='%s' encoding='%s'?>\n" % (version, encoding)) + def StartDoctypeDeclHandler(self, doctypeName, systemId, publicId, has_internal_subset): + if publicId != None: sys.stdout.write("<!DOCTYPE %s PUBLIC \"%s\" \"%s\">\n" %\ + (doctypeName, publicId, systemId)) + else: sys.stdout.write("<!DOCTYPE %s \"%s\">\n" % (doctypeName, systemId)) + def StartElementHandler(self, name, attributes): + if name.lower() == 'g': + r = self.last_state and ('id' not in attributes or \ + attributes['id'] in self.layers) + self.last_state = r + self.state_stack.append(r) + if not self.last_state: return + s = "" + for k, v in attributes.items(): s += ' %s="%s"' % (k, v) + sys.stdout.write("<%s%s>" % (name, s)) + def EndElementHandler(self, name): + r = self.last_state + if name.lower() == 'g': + self.state_stack = self.state_stack[0:-1] + self.last_state = self.state_stack[-1] + if not r: return + sys.stdout.write("</%s>" % (name)) + def CharacterDataHandler(self, data): + if not self.last_state: return + sys.stdout.write(data) + +my_parser = XmlParser(layers) + +parser.XmlDeclHandler = my_parser.XmlDeclHandler +parser.StartDoctypeDeclHandler = my_parser.StartDoctypeDeclHandler +parser.StartElementHandler = my_parser.StartElementHandler +parser.EndElementHandler = my_parser.EndElementHandler +parser.CharacterDataHandler = my_parser.CharacterDataHandler + +for line in sys.stdin: + parser.Parse(line, False) +parser.Parse('', True) + diff --git a/Master/texmf-dist/source/support/latex-make/figlatex.dtx b/Master/texmf-dist/source/support/latex-make/figlatex.dtx new file mode 100644 index 00000000000..c389ed4b487 --- /dev/null +++ b/Master/texmf-dist/source/support/latex-make/figlatex.dtx @@ -0,0 +1,510 @@ +% \iffalse meta-comment +%% +%% File: figlatex.dtx Copyright (C) 2002--2005 V. Danjean, A. Legrand +%% Vincent.Danjean@ens-lyon.org +%% Arnaud.Legrand@ens-lyon.org +%% +%% This program is free software; you can redistribute it and/or +%% modify it under the terms of the GNU General Public License +%% as published by the Free Software Foundation; either version 2 +%% of the License, or (at your option) any later version. +%% +%% This program is distributed in the hope that it will be useful, +%% but WITHOUT ANY WARRANTY; without even the implied warranty of +%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +%% GNU General Public License for more details. +%% +%% You should have received a copy of the GNU General Public License +%% along with this program; if not, write to the Free Software +%% Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +%% +% +%<*dtx> + \ProvidesFile{figlatex.dtx} +%</dtx> +%<package>\NeedsTeXFormat{LaTeX2e}% +%<package>\ProvidesPackage{figlatex}% +%<config> \ProvidesFile{figlatex.cfg}% +%<compat> \ProvidesPackage{texgraphicx}% +% \fi +% \ProvidesFile{figlatex.dtx} +[2011/09/25 v0.1.4 include fig and svg in LaTeX] +% \iffalse +%<*driver> +\documentclass{ltxdoc} +\usepackage[latin1]{inputenc} +\usepackage[french,english]{babel} +\NoAutoSpaceBeforeFDP +\EnableCrossrefs +\CodelineIndex +\RecordChanges +\setcounter{IndexColumns}{2} % make a twocolumn index +\setlength{\columnseprule}{0pt} % no rules between columns ... +\setlength{\columnsep}{2em} % ... but more spacing instead. +\setcounter{unbalance}{4} +\setlength{\IndexMin}{100pt} +%%%%\OnlyDescription % uncomment this line to suppress printing the source code +\makeatletter +% don't show underfull hboxes in index/glossary: +\g@addto@macro{\IndexParms}{\hbadness=10000} +\g@addto@macro{\GlossaryParms}{\hbadness=10000} +\makeatother +\begin{document} + \DocInput{figlatex.dtx} + \PrintIndex + \PrintChanges +\end{document} +%</driver> +% \fi +% +% \GetFileInfo{figlatex.dtx} +% +% \DoNotIndex{\#,\$,\%,\&,\@,\\,\{,\},\^,\_,\~,\ } +% \DoNotIndex{\def,\long,\edef,\xdef,\gdef,\let,\global} +% \DoNotIndex{\if,\ifnum,\ifdim,\ifcat,\ifmmode,\ifvmode,\ifhmode,% +% \iftrue,\iffalse,\ifvoid,\ifx,\ifeof,\ifcase,\else,\or,\fi,\loop,\do} +% \DoNotIndex{\box,\copy,\setbox,\unvbox,\unhbox,\hbox,% +% \vbox,\vtop,\vcenter} +% \DoNotIndex{\@empty,\immediate,\write} +% \DoNotIndex{\egroup,\bgroup,\expandafter,\begingroup,\endgroup} +% \DoNotIndex{\divide,\advance,\multiply,\count,\dimen} +% \DoNotIndex{\relax,\space,\string} +% \DoNotIndex{\csname,\endcsname,\@spaces,\openin,\openout,% +% \closein,\closeout} +% \DoNotIndex{\catcode,\endinput} +% \DoNotIndex{\jobname,\message,\read,\the,\noexpand} +% \DoNotIndex{\hsize,\vsize,\hskip,\vskip,\kern,\hfil,\hfill,\hss} +% \DoNotIndex{\m@ne,\z@,\@m,\z@skip,\@ne,\tw@,\p@} +% \DoNotIndex{\DeclareRobustCommand,\DeclareOption,\newcommand,\newcommand*} +% \DoNotIndex{\newcount,\newif,\newlinechar,\newread,\newtoks,\newwrite} +% \DoNotIndex{\dp,\wd,\ht,\vss,\unskip,\ifthenelse} +% +% \DoNotIndex{\@filef@und,\@nameddef,\@tempa} +% \DoNotIndex{\define@key,\equal,\ExecuteOptions} +% \DoNotIndex{\filename@area,\filename@base,\filename@ext,\filename@parse} +% \DoNotIndex{\Gin@exclamation,\Gin@getbase,\Gin@scalex,\Gin@scaley} +% \DoNotIndex{\Gread@eps,\Gread@pdf,\Gscale@box} +% \DoNotIndex{\IfFileExists,\ifpdf,\input,\InputIfFileExists} +% \DoNotIndex{\MessageBreak,\PackageWarning,\PackageWarningNoLine} +% \DoNotIndex{\ProcessOptions,\RequirePackage,\typeout} +% \DoNotIndex{} +% \DoNotIndex{} +% +% \title{The \textsf{figlatex} package\thanks{This file +% has version number \fileversion, last +% revised \filedate.}} +% \author{Arnaud \textsc{Legrand}\and Vincent \textsc{Danjean}} +% \date{\filedate} +% \maketitle +% \begin{abstract} +% This package allows \LaTeX\space to load XFig and SVG figures (or +% subfigures) with the |\includegraphics| command. +% \end{abstract} +% \CheckSum{217} +% +% \changes{v0.1.1}{2005/03/28}{Version 0.1.1 at last} +% \changes{v0.1.2}{2005/03/29}{Manage index/glossary} +% \changes{v0.1.3}{2008/01/28}{Better support for subfig with texdepends} +% \changes{v0.1.4}{2011/09/25}{Support for svg with texdepends} +% +% \makeatletter +% \def\SpecialOptionIndex#1{\@bsphack +% \index{#1\actualchar{\protect\ttfamily#1} +% (option)\encapchar usage}% +% \index{options:\levelchar{\protect\ttfamily#1}\encapchar +% usage}\@esphack} +% \def\SpecialFileIndex#1{\@bsphack +% \index{#1\actualchar{\protect\ttfamily#1} +% (file)\encapchar usage}% +% \index{files:\levelchar{\protect\ttfamily#1}\encapchar +% usage}\@esphack} +% \def\SpecialMainOptionIndex#1{\@bsphack\special@index{#1\actualchar +% {\string\ttfamily\space#1} +% (option)\encapchar main}% +% \special@index{options:\levelchar{% +% \string\ttfamily\space#1}\encapchar +% main}\@esphack} +% \def\option{\begingroup +% \catcode`\\12 +% \MakePrivateLetters \mym@cro@ \iffalse} +% \long\def\mym@cro@#1#2{\endgroup \topsep\MacroTopsep \trivlist +% \edef\saved@macroname{\string#2}% +% \def\makelabel##1{\llap{##1}}% +% \if@inlabel +% \let\@tempa\@empty \count@\macro@cnt +% \loop \ifnum\count@>\z@ +% \edef\@tempa{\@tempa\hbox{\strut}}\advance\count@\m@ne \repeat +% \edef\makelabel##1{\llap{\vtop to\baselineskip +% {\@tempa\hbox{##1}\vss}}}% +% \advance \macro@cnt \@ne +% \else \macro@cnt\@ne \fi +% \edef\@tempa{\noexpand\item[% +% #1% +% \noexpand\PrintMacroName +% \else +% \noexpand\PrintEnvName +% \fi +% {\string#2}]}% +% \@tempa +% \global\advance\c@CodelineNo\@ne +% #1% +% \SpecialMainIndex{#2}\nobreak +% \DoNotIndex{#2}% +% \else +% \SpecialMainOptionIndex{#2}\nobreak +% \fi +% \global\advance\c@CodelineNo\m@ne +% \ignorespaces} +% \let\endoption \endtrivlist +% \def\DescribeOption{\leavevmode\@bsphack\begingroup\MakePrivateLetters +% \Describe@Option} +% \def\Describe@Option#1{\endgroup +% \marginpar{\raggedleft\PrintDescribeEnv{#1}}% +% \SpecialOptionIndex{#1}\@esphack\ignorespaces} +% \def\DescribeFile{\leavevmode\@bsphack\begingroup\MakePrivateLetters +% \Describe@Option} +% \def\Describe@File#1{\endgroup +% \marginpar{\raggedleft\PrintDescribeEnv{#1}}% +% \SpecialFileIndex{#1}\@esphack\ignorespaces} +% \makeatother +% \MakeShortVerb{\|} +% +% \section{Introduction} +% +% \subsection{General} +% \DescribeMacro{\includegraphics} +% This package allows to load XFig figures from \LaTeX\space sources with +% the |\includegraphics| command from the |graphicx| package: +% \begin{verbatim} +% \includegraphics[width=\linewidth]{myfig.fig} +% \end{verbatim} +% +% This package does not convert by itself XFig figures (see package +% |texdepends| for that). It only diverts the loading functions so +% that \LaTeX\space includes the |.pstex_t| or the |.pdftex_t|. +% +% \subsection{Options} +% Available options for this package: +% \begin{description} +% \item[debug~:] \DescribeOption{debug}more messages written while compiling +% \item[compatibility~:] \DescribeOption{compatibility}old versions of |pdflatex| do not allow +% to declare a PDF file with |\DeclareGraphicsRule| that has not the +% |.pdf| extension. In such cases, this package uses the extension +% |.pdf| instead of |.pdftex| for PDF created from XFig figures. +% \end{description} +% +% \DescribeFile{figlatex.cfg} +% \DescribeMacro{\compatibility} +% \DescribeMacro{\debug} +% When the package is loaded, it tries to read a |figlatex.cfg| +% file. This file can contains |\compatibility| and/or |\debug| to +% enable theses options site wide. +% +% \subsection{Subfigures} +% +% Sometimes, several figures made with XFig should be similar. It is +% possible to make only one XFig figure and then create subfigures +% which contains only a subset of the depths of the original figure. +% +% \StopEventually{ +% } +% \section{Implementation} +% +% \subsection{figlatex} +% \begin{macrocode} +%<*package> +% \end{macrocode} +% +% Options definitions +% \begin{option}{compatibility} +% \begin{macrocode} +\newif\ifFL@compatibility +\DeclareOption{compatibility}{% + %\PackageWarning{figlatex}{option compatibility}% + \global\FL@compatibilitytrue% +} +% \end{macrocode} +% \end{option} +% \begin{option}{debug} +% \begin{macrocode} +\newif\ifFL@debug +\DeclareOption{debug}{% + \global\FL@debugtrue% +} +% \end{macrocode} +% \end{option} +% +% We load the config file if it exists. +% Commands for the config file are local. +% \begin{macrocode} +{ +% \end{macrocode} +% \begin{macro}{\compatibility} +% \begin{macrocode} + \def\compatibility{% + \ExecuteOptions{compatibility}% + } +% \end{macrocode} +% \end{macro} +% \begin{macro}{\debug} +% \begin{macrocode} + \def\debug{% + \ExecuteOptions{debug}% + } +% \end{macrocode} +% \end{macro} +% \begin{macrocode} + \InputIfFileExists{figlatex.cfg}{% + \typeout{***************************************^^J% + * Local config file figlatex.cfg used *^^J% + ***************************************} + }{% + \typeout{Found no configuration file for figlatex} + } +} +% \end{macrocode} +% Run the options +% \begin{macrocode} +\ProcessOptions +% \end{macrocode} +% and requires some packages +% \begin{macrocode} +\RequirePackage{ifpdf} +\RequirePackage{graphicx} +% \end{macrocode} +% XFig uses heavily the color package +% \begin{macrocode} +\RequirePackage{color} +\RequirePackage{epstopdf} +% \end{macrocode} +% \begin{macro}{\FL@dmessage} +% Write the message only if debug is set +% \begin{macrocode} +\def\FL@dmessage#1{% + \ifFL@debug% + \message{#1}% + \fi% +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\Ginclude@rawtex} +% |.pstex_t| or |.pdftex_t| are loaded with |\input| +% \begin{macrocode} +\def\Ginclude@rawtex#1{% + \FL@dmessage{<#1>}% + \bgroup% + \def\@tempa{!}% + \ifx\Gin@scaley\@tempa% + \let\Gin@scaley\Gin@scalex% + \else% + \ifx\Gin@scalex\@tempa\let\Gin@scalex\Gin@scaley\fi% + \fi% + \hbox{% + \Gscale@box{\Gin@scalex}[\Gin@scaley]{% + \def\Gin@scalex{1}% + \let\Gin@scaley\Gin@exclamation% needed for pdflatex + \FL@dmessage{<loading rawtex #1>}% + \input{#1}}}% + \egroup} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\Ginclude@figtex} +% |.fig| are loaded with |\includegraphics| after modifying the name +% \begin{macrocode} +\def\Ginclude@figtex#1{% + \message{<#1>}% + \bgroup% + \xdef\FL@filename{#1}% + \filename@parse{\FL@filename}% + \xdef\FL@filename{\filename@area\filename@base.\FL@figext}% + \FL@dmessage{<****loading fig \FL@filename>}% + \FL@includerawtexgraphics[]{\FL@filename}% + \egroup} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\Gread@figtex} +% |.fig| bounding box is the same as the corresponding |.pstex_t| or |.pdftex_t| +% \begin{macrocode} +\newcommand{\Gread@figtex}[1]{% + %\typeout{Oh, file exists #1}% + \Gread@rawtex{#1}% +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\Ginclude@svgtex} +% |.svg| are loaded with |\includegraphics| after modifying the name +% \begin{macrocode} +\def\Ginclude@svgtex#1{% + \message{<#1>}% + \bgroup% + \xdef\FL@filename{#1}% + \filename@parse{\FL@filename}% + \xdef\FL@filename{\filename@area\filename@base.\FL@svgext}% + \FL@dmessage{<****loading svg \FL@filename>}% + \FL@includerawtexgraphics[]{\FL@filename}% + \egroup} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\Gread@svgtex} +% |.svg| bounding box is the same as the corresponding |.pstex_t| or |.pdftex_t| +% \begin{macrocode} +\newcommand{\Gread@svgtex}[1]{% + %\typeout{Oh, file exists #1}% + \Gread@rawtex{#1}% +} +% \end{macrocode} +% \end{macro} +% Declare the right things depending whether we build a DVI or a PDF file. +% \begin{macrocode} +\ifpdf +% \end{macrocode} +% PDF part +% \begin{macrocode} + \def\FL@figext{pdftex_t}% + \def\FL@svgext{pdftex_t}% +% \end{macrocode} +% To read bounding box information: +% \begin{macrocode} + \let\Gread@rawtex\Gread@pdf% + \DeclareGraphicsRule{.pdftex}{pdf}{*}{}% + \ifFL@compatibility% + \PackageWarningNoLine{figlatex}{Compatibility mode enabled + for old LaTeX + \MessageBreak Using .pdf extension for pdftex files}% + \DeclareGraphicsRule{.pdftex_t}{rawtex}{.pdf}{}% + \DeclareGraphicsRule{.fig}{figtex}{.pdf}{}% + \DeclareGraphicsRule{.svg}{svgtex}{.pdf}{}% + \else% + \DeclareGraphicsRule{.pdftex_t}{rawtex}{.pdftex}{}% + \DeclareGraphicsRule{.fig}{figtex}{.pdftex}{}% + \DeclareGraphicsRule{.svg}{svgtex}{.pdftex}{}% + \fi% +\else +% \end{macrocode} +% DVI part +% \begin{macrocode} + \def\FL@figext{pstex_t}% + \def\FL@svgext{pstex_t}% +% \end{macrocode} +% To read bounding box information: +% \begin{macrocode} + \let\Gread@rawtex\Gread@eps% + \DeclareGraphicsRule{.pstex}{eps}{*}{}% + \DeclareGraphicsRule{.pstex_t}{rawtex}{.pstex}{}% + \DeclareGraphicsRule{.fig}{figtex}{.pstex}{}% + \DeclareGraphicsRule{.svg}{svgtex}{.pstex}{}% +\fi +% \end{macrocode} +% This command is not really necessary here (code could be added in +% |\Ginclude@figtex|). However, it's very convinient for the +% |texdepends| package. +% \begin{macrocode} +\newcommand{\FL@includerawtexgraphics}[2][]{% + \includegraphics[#1]{#2}% +} +% \end{macrocode} +% Addition of the |subfig=name| key for the options of the +% |\includegraphicx[..]{..}| macro. +% \begin{macrocode} +\def\FL@exclamation{!}% +\let\FL@subfig@name\FL@exclamation% +\define@key{Gin}{subfig}{% + \def\FL@subfig@name{#1}% +} +\def\FL@sepdefault{_}% +% \end{macrocode} +% We should ckeck if the \#1 file exists (XXX.subfig) +% This is not yet done but texdepends divert this macro +% to record the dependency +% \begin{macrocode} +\def\FL@subfig@check#1{% +} +% \end{macrocode} +% We divert |\Gin@getbase| to modify the file name if the |subfig| key +% is used. +% \begin{macrocode} +\def\FL@Gin@getbase#1{% + \ifx\FL@subfig@name\FL@exclamation% + \else% + \ifthenelse{\equal{#1}{.fig}}{% + % If we're including a subfig + \IfFileExists{\filename@area\filename@base#1}{% + % If the original .fig file exists, just change the name so that + % it comprises the full path. + \filename@parse{\@filef@und}% + % Remove potential trailing spage at the end of the extension + \def\filename@ext{fig}% + % Check if the subfig file exists + \FL@subfig@check{\filename@area\filename@base.subfig}% + }{% + % Else, write a warning (LaTeX will warn as well but it doesn't + % hurt) + \PackageWarning{figlatex}{No file + '\filename@area\filename@base#1'}% + } + % Add the subfig suffix to the fig name. + \edef\filename@base{\filename@base\FL@sepdefault\FL@subfig@name}% + }{% + }% + \ifthenelse{\equal{#1}{.svg}}{% + % If we're including a subfig + \IfFileExists{\filename@area\filename@base#1}{% + % If the original .svg file exists, just change the name so that + % it comprises the full path. + \filename@parse{\@filef@und}% + % Remove potential trailing spage at the end of the extension + \def\filename@ext{svg}% + % Check if the subfig file exists + \FL@subfig@check{\filename@area\filename@base.subfig}% + }{% + % Else, write a warning (LaTeX will warn as well but it doesn't + % hurt) + \PackageWarning{figlatex}{No file + '\filename@area\filename@base#1'}% + } + % Add the subfig suffix to the svg name. + \edef\filename@base{\filename@base\FL@sepdefault\FL@subfig@name}% + }{% + }% + \fi% + \FL@orig@Gin@getbase{#1}% +} +\let\FL@orig@Gin@getbase\Gin@getbase +\let\Gin@getbase\FL@Gin@getbase + +%\@namedef{Gin@rule@.fig}#1{% + +%} +% \end{macrocode} +% \begin{macrocode} +%</package> +% \end{macrocode} +% The sample config file |figlatex.cfg|\ldots +% \begin{macrocode} +%<*config> +% \end{macrocode} +% \begin{macrocode} + %\compatibility + %\debug +% \end{macrocode} +% \begin{macrocode} +%</config> +% \end{macrocode} +% \subsection{texgraphicx} +% \begin{macrocode} +%<*compat> +% \end{macrocode} +% |texgraphicx.sty| is only a wrapper arround |figlatex.sty|. +% \begin{macrocode} +\PackageWarning{texgraphicx}{'texgraphicx' is now + deprecated\MessageBreak% + Please, consider switching to 'figlatex' + package\MessageBreak} +\RequirePackage{figlatex} +\ProcessOptions +% \end{macrocode} +% \begin{macrocode} +%</compat> +% \end{macrocode} +% \Finale +\endinput diff --git a/Master/texmf-dist/source/support/latex-make/latex-make.dtx b/Master/texmf-dist/source/support/latex-make/latex-make.dtx new file mode 100644 index 00000000000..24e32d0dd62 --- /dev/null +++ b/Master/texmf-dist/source/support/latex-make/latex-make.dtx @@ -0,0 +1,1940 @@ +% \iffalse meta-comment +% +%<*dtx> + \ProvidesFile{latex-make.dtx} +[2012/03/17 v2.1.2 Makefile for LaTeX] +%</dtx> +% \fi +% \iffalse +%<*driver> +\documentclass[a4paper]{ltxdoc} +\usepackage{a4wide} +\usepackage[latin1]{inputenc} +\usepackage[T1]{fontenc} +\usepackage{palatino} +\usepackage{pdfswitch} +\usepackage{array} +\usepackage{tabularx} +\usepackage{boxedminipage} +\EnableCrossrefs +\CodelineIndex +\RecordChanges +\setcounter{IndexColumns}{2} % make a twocolumn index +\setlength{\columnseprule}{0pt} % no rules between columns ... +\setlength{\columnsep}{2em} % ... but more spacing instead. +\setcounter{unbalance}{4} +\setlength{\IndexMin}{100pt} +%%%%\OnlyDescription % uncomment this line to suppress printing the source code +\makeatletter +% don't show underfull hboxes in index/glossary: +\g@addto@macro{\IndexParms}{\hbadness=10000} +\g@addto@macro{\GlossaryParms}{\hbadness=10000} +\makeatother +\newenvironment{source}[1][.8\linewidth]{% + \begin{center}% + \begin{boxedminipage}[c]{#1}\tt% + \vspace{1em}% + \hspace{2em}\begin{minipage}[c]{#1}\tt% + }{% + \end{minipage}% + \vspace{1em}% + \end{boxedminipage}% + \end{center}% +} +\sloppy +\begin{document} + \DocInput{latex-make.dtx} + \PrintIndex + \PrintChanges +\end{document} +%</driver> +% \fi +% +% \GetFileInfo{latex-make.dtx} +% +% \DoNotIndex{\#,\$,\%,\&,\@,\\,\{,\},\^,\_,\~,\ } +% \DoNotIndex{\def,\long,\edef,\xdef,\gdef,\let,\global} +% \DoNotIndex{\if,\ifnum,\ifdim,\ifcat,\ifmmode,\ifvmode,\ifhmode,% +% \iftrue,\iffalse,\ifvoid,\ifx,\ifeof,\ifcase,\else,\or,\fi,\loop,\do} +% \DoNotIndex{\box,\copy,\setbox,\unvbox,\unhbox,\hbox,% +% \vbox,\vtop,\vcenter} +% \DoNotIndex{\@empty,\immediate,\write} +% \DoNotIndex{\egroup,\bgroup,\expandafter,\begingroup,\endgroup} +% \DoNotIndex{\divide,\advance,\multiply,\count,\dimen} +% \DoNotIndex{\relax,\space,\string} +% \DoNotIndex{\csname,\endcsname,\@spaces,\openin,\openout,% +% \closein,\closeout} +% \DoNotIndex{\catcode,\endinput} +% \DoNotIndex{\jobname,\message,\read,\the,\noexpand} +% \DoNotIndex{\hsize,\vsize,\hskip,\vskip,\kern,\hfil,\hfill,\hss} +% \DoNotIndex{\m@ne,\z@,\@m,\z@skip,\@ne,\tw@,\p@} +% \DoNotIndex{\DeclareRobustCommand,\DeclareOption,\newcommand,\newcommand*} +% \DoNotIndex{\newcount,\newif,\newlinechar,\newread,\newtoks,\newwrite} +% \DoNotIndex{\dp,\wd,\ht,\vss,\unskip,\ifthenelse} +% +% \DoNotIndex{\@filef@und,\@nameddef,\@tempa} +% \DoNotIndex{\define@key,\equal,\ExecuteOptions} +% \DoNotIndex{\filename@area,\filename@base,\filename@ext,\filename@parse} +% \DoNotIndex{\Gin@exclamation,\Gin@getbase,\Gin@scalex,\Gin@scaley} +% \DoNotIndex{\Gread@eps,\Gread@pdf,\Gscale@box} +% \DoNotIndex{\IfFileExists,\ifpdf,\input,\InputIfFileExists} +% \DoNotIndex{\MessageBreak,\PackageWarning,\PackageWarningNoLine} +% \DoNotIndex{\ProcessOptions,\RequirePackage,\typeout} +% \DoNotIndex{\(,\),\.,\1,\t,\n,\^^J} +% \catcode\endlinechar 12\DoNotIndex{\ +% }\catcode\endlinechar 10{} +% \catcode`\$=12 +% \DoNotIndex{\$} +% \catcode`\$=3 +% \DoNotIndex{\DeclareGraphicsExtensions,\DeclareGraphicsRule} +% +% +% \title{The \LaTeX.mk Makefile\\ +% and related script tools\thanks{This file +% has version number \fileversion, last +% revised \filedate.}} +% \author{Vincent \textsc{Danjean} \and Arnaud \textsc{Legrand}} +% \date{\filedate} +% \maketitle +% \begin{abstract} +% This package allows to compile all kind and complex \LaTeX\space +% documents with the help of a Makefile. Dependencies are +% automatically tracked with the help of the |texdepends.sty| package. +% \end{abstract} +% \CheckSum{313} +% +% \changes{v2.0.0}{2006/03/09}{First autocommented version} +% \changes{v2.1.0}{2008/01/28}{That's the question} +% \changes{v2.1.1}{2009/11/08}{Improve error message} +% \changes{v2.1.2}{2012/03/17}{Switch from perl to python} +% +% \makeatletter +% \def\SpecialOptionIndex#1{\@bsphack +% \index{#1\actualchar{\protect\ttfamily#1} +% (option)\encapchar usage}% +% \index{options:\levelchar{\protect\ttfamily#1}\encapchar +% usage}\@esphack} +% \def\SpecialFileIndex#1{\@bsphack +% \index{#1\actualchar{\protect\ttfamily#1} +% (file)\encapchar usage}% +% \index{files:\levelchar{\protect\ttfamily#1}\encapchar +% usage}\@esphack} +% \def\SpecialMainOptionIndex#1{\@bsphack\special@index{#1\actualchar +% {\string\ttfamily\space#1} +% (option)\encapchar main}% +% \special@index{options:\levelchar{% +% \string\ttfamily\space#1}\encapchar +% main}\@esphack} +% \def\option{\begingroup +% \catcode`\\12 +% \MakePrivateLetters \mym@cro@ \iffalse} +% \long\def\mym@cro@#1#2{\endgroup \topsep\MacroTopsep \trivlist +% \edef\saved@macroname{\string#2}% +% \def\makelabel##1{\llap{##1}}% +% \if@inlabel +% \let\@tempa\@empty \count@\macro@cnt +% \loop \ifnum\count@>\z@ +% \edef\@tempa{\@tempa\hbox{\strut}}\advance\count@\m@ne \repeat +% \edef\makelabel##1{\llap{\vtop to\baselineskip +% {\@tempa\hbox{##1}\vss}}}% +% \advance \macro@cnt \@ne +% \else \macro@cnt\@ne \fi +% \edef\@tempa{\noexpand\item[% +% #1% +% \noexpand\PrintMacroName +% \else +% \noexpand\PrintEnvName +% \fi +% {\string#2}]}% +% \@tempa +% \global\advance\c@CodelineNo\@ne +% #1% +% \SpecialMainIndex{#2}\nobreak +% \DoNotIndex{#2}% +% \else +% \SpecialMainOptionIndex{#2}\nobreak +% \fi +% \global\advance\c@CodelineNo\m@ne +% \ignorespaces} +% \let\endoption \endtrivlist +% \def\DescribeOption{\leavevmode\@bsphack\begingroup\MakePrivateLetters +% \Describe@Option} +% \def\Describe@Option#1{\endgroup +% \marginpar{\raggedleft\PrintDescribeEnv{#1}}% +% \SpecialOptionIndex{#1}\@esphack\ignorespaces} +% \def\DescribeFile{\leavevmode\@bsphack\begingroup\MakePrivateLetters +% \Describe@Option} +% \def\Describe@File#1{\endgroup +% \marginpar{\raggedleft\PrintDescribeEnv{#1}}% +% \SpecialFileIndex{#1}\@esphack\ignorespaces} +% \makeatother +% \MakeShortVerb{\|} +% +% \tableofcontents +% \newpage +% \section{Introduction} +% +% |latex-make| is a collection of \LaTeX{} packages, scripts and +% Makefile fragments that allows to easily compile \LaTeX{} documents. +% The best feature is that \textbf{\emph{dependencies are +% automatically tracked}}\footnote{Dependencies are tracked with +% the help of the |texdepend.sty| package that is automatically +% loaded: no need to specify it with |\textbackslash usepackage\{\}| +% in your documents.}. +% \par +% These tools can be used to compile small \LaTeX{} documents +% as well as big ones (such as, for example, a thesis with summary, tables of +% contents, list of figures, list of tabulars, multiple indexes and +% multiple bibliographies). +% +% \section{Quick start} +% +% \subsection{First (and often last) step} +% When you want to use |latex-make|, most of the time you have to +% create a |Makefile| with the only line: \par +% \begin{source} +% include LaTeX.mk +% \end{source} +% % Then, the following targets are available: |dvi|, |ps|, |pdf|, +% \emph{file}|.dvi|, \emph{file}|.ps|, \emph{file}|.pdf|, etc., +% |clean| and |distclean|. +% \par +% +% All \LaTeX{} documents of the current directory should be compilable +% with respect to their dependencies. If something fails, please, +% provide me the smallest example you can create to show me what is +% wrong. +% \par\medskip +% +% \paragraph{Tip:} +% If you change the dependencies inside your document (for example, if +% you change |\include{first}| into |\include{second}|), you may have +% to type |make distclean| before being able to recompile your +% document. Else, |make| can fail, trying to build or found the old +% |first.tex| file. +% \subsection{Customization} +% Of course, lots of things can be customized. Here are the most +% useful ones. Look at the section \ref{sec:reference} for more detailed +% and complete possibilities. +% \par +% Customization is done through variables in the |Makefile| set +% \emph{before} including |LaTeX.mk|. Setting them after can sometimes +% work, but not always and it is not supported.\par +% +% \newcommand{\variable}[4][\texttt]{% +% \paragraph*{#3}% +% \addcontentsline{toc}{subsubsection}{#3}% +% \hfill \hbox{#1{\textbf{#2}}}\par\medskip% +% \textbf{Example:}\hspace{1em} |#4|\par\medskip } +% +% \variable{LU\_MASTERS}% +% {Which \LaTeX{} documents to compile}% +% {LU\_MASTERS=figlatex texdepends latex-make}% +% This variable contains the basename of the \LaTeX{} documents to +% compile. \par +% If not set, |LaTeX.mk| looks for all |*.tex| files containing the +% |\documentclass| command. +% +% \variable[]{\emph{master}\texttt{\_MAIN}}% +% {Which \LaTeX{} main source for a document}% +% {figlatex\_MAIN=figlatex.dtx}% +% There is one such variable per documents declared in |LU_MASTERS|. +% It contains the file against which the |latex| (or |pdflatex|, etc.) +% program must be run. \par +% If not set, \emph{master}|.tex| is used. +% +% \variable{LU\_FLAVORS}% +% {Which flavors must be compiled}% +% {LU\_FLAVORS=DVI DVIPDF}% +% A flavor can be see as a kind of document (postscript, PDF, DVI, +% etc.) and the way to create it. For example, a PDF document can be +% created directly from the |.tex| file (with |pdflatex|), from a +% |.dvi| file (with |dvipdfm|) or from a postscript file (with +% |ps2pdf|). This would be three different flavors. +% \par +% Some flavors are already defined in |LaTeX.mk|. Other flavors can be +% defined by the user (see section~\ref{sec:def_flavors}). The list of +% predefined flavors can be see in the table~\ref{tab:flavors}. A +% flavor can depend on another. For example, the flavor creating a +% postscript file from a DVI file depends on the flavor creating a DVI +% file from a \LaTeX{} file. This is automatically handled. +% \par +% If not set, |PS| and |PDF| are used (and |DVI| due to |PS|). +%\def\extrarowheight{2pt} +% \begin{table}[htbp] +% \centering +% +% \begin{tabular}{|c|c|l|l|} +% \hline +% Flavor & dependency & program variable & Transformation \\ +% \hline \hline +% DVI & & LATEX & |.tex| $\Rightarrow$ |.dvi| \\ +% \hline +% PS & DVI & DVIPS & |.dvi| $\Rightarrow$ |.ps| \\ +% \hline +% PDF & & PDFLATEX & |.tex| $\Rightarrow$ |.pdf| \\ +% \hline +% DVIPDF & DVI & DVIPDFM & |.dvi| $\Rightarrow$ |.pdf| \\ +% \hline +% \end{tabular} +% \par\smallskip +% \begin{minipage}[t]{0.8\linewidth} +% \em For example, the |DVI| flavor transforms a |*.tex| file into +% a |*.dvi| file with the |Makefile| command +% |$(LATEX) $(LATEX\_OPTIONS)| +% \end{minipage} +% % \caption{Predefined flavors} +% \label{tab:flavors} +% +% \end{table} +% +% \variable[]{\emph{prog}/\emph{prog}\texttt{\_OPTIONS}} +% {Which programs are called and with which options}% +% { +% \begin{minipage}[t]{0.5\linewidth} +% DVIPS=dvips\\DVIPS\_OPTIONS=-t a4 +% \end{minipage} +% } +% Each flavor has a program variable name that is used by |LaTeX.mk| +% to run the program. Another variable with the suffix |\_OPTIONS| is +% also provided if needed. See the table~\ref{tab:flavors} the look +% for the program variable name associated to the predefined flavors. +% \par +% Other programs are also run in the same manner. For example, the +% |makeindex| program is run from |LaTeX.mk| with the help of the +% variables |MAKEINDEX| and |MAKEINDEX_OPTIONS|. +% +% \variable[]{\emph{master}\texttt{\_}\emph{prog}/\emph{master}\texttt{\_}\emph{prog}\texttt{\_OPTIONS}} +% {Per target programs and options}% +% { +% \begin{minipage}[t]{0.5\linewidth} +% figlatex\_DVIPS=dvips\\ +% figlatex\_DVIPS\_OPTIONS=-t a4 +% \end{minipage} +% } +% Note that, if defined, \emph{master}\texttt{\_}\emph{prog} will +% \textbf{\emph{replace}} \emph{prog} whereas +% \emph{master}\texttt{\_}\emph{prog}\texttt{\_OPTIONS} will +% \textbf{\emph{be added to}} \emph{prog}\texttt{\_OPTIONS} (see +% section \ref{sec:variables} for more details). +% +% \variable[]{\texttt{DEPENDS}/\emph{master}\texttt{\_DEPENDS}} +% {Global and per target dependencies}% +% { +% \begin{minipage}[t]{0.5\linewidth} +% DEPENDS=texdepends.sty\\ +% figlatex\_DEPENDS=figlatex.tex +% \end{minipage} +% } +% All flavor targets will depend to theses files. This should not be +% used as dependencies are automatically tracked. +% +%\section{Reference manual} +%\label{sec:reference} +% +% \subsection{Flavors} +% \subsubsection{What is a flavor ?} +% A flavor can be see as a kind of document (postscript, PDF, DVI, +% etc.) and the way to create it. Several property are attached to +% each flavor. Currently, there exists two kinds of flavors: +% \begin{description} +% \item[TEX-flavors:] these flavors are used to compile a +% \texttt{*.tex} file into a target. A \LaTeX{} compiler +% (\texttt{latex}, \texttt{pdflatex}, etc.) is used; +% \item[DVI-flavors:] these flavors are used to compile a file +% produced by a TEX-flavors into an other file. Examples of such +% flavors are all the ones converting a DVI file into another format +% (postscript, PDF, etc.). +% \end{description} +% Several properties are attached to each flavors. Most are common, a +% few a specific to the kind of the flavor. +% \begin{description} +% \item[Name:] the name of the flavor. It is used to declare dependencies +% between flavors (see below). It also used to tell which flavor +% should be compiled for each document (see the \texttt{FLAVORS} +% variables); +% \item[Program variable name:] name of the variable that will be used +% to run the program of this flavor. This name is used for the +% program and also for the options (variable with the +% \texttt{\_OPTIONS} suffix); +% \item[Target extension:] extension of the target of the flavor. The +% dot must be added if wanted; +% \item[Master target:] if not empty, all documents registered for the +% flavor will be built when this master target is called; +% \item[XFig extensions to clean (\emph{TEX-flavor only}):] files +% extensions of figures that will be cleaned for the \texttt{clean} +% target. Generally, there is \texttt{.pstex\_t .pstex} when using +% \texttt{latex} and \texttt{.pdftex\_t .pdftex} when using +% \texttt{pdflatex}; +% \item[Dependency \emph{DVI-flavor only}:] name of the TEX-flavor the +% one depends upon. +% \end{description} +% +% \subsubsection{Defining a new flavor} +% \label{sec:def_flavors} +% To define a new flavor named \texttt{NAME}, one just have to declare +% a \texttt{lu-define-flavor-NAME} that calls and evaluates the +% \texttt{lu-create-flavor} with the right parameters, ie: +% \begin{itemize} +% \item name of the flavor; +% \item kind of flavor (\texttt{tex} or \texttt{dvi}); +% \item program variable name; +% \item target extension; +% \item master target; +% \item XFig extensions to clean \emph{or} TEX-flavor to depend upon. +% \end{itemize} +% +% \par +% +% For example, \texttt{LaTeX.mk} already defines: +% \paragraph{DVI flavor} +% \begin{source}[0.9\linewidth] +% define lu-define-flavor-DVI\\ +% \hspace*{2ex}\$\$(eval \$\$(call lu-create-flavor,DVI,tex,LATEX,.dvi,dvi,\textbackslash\\ +% \hspace*{4ex}.pstex\_t .pstex))\\ +% endef +% \end{source} +% \subparagraph{Tip:} the \texttt{LATEX} program variable name means +% that the program called will be the one in the \texttt{LATEX} +% variable and that options in the \texttt{LATEX\_OPTIONS} variable +% will be used. +% +% \paragraph{PDF flavor} +% \begin{source}[0.9\linewidth] +% define lu-define-flavor-PDF\\ +% \hspace*{2ex}\$\$(eval \$\$(call lu-create-flavor,PDF,tex,PDFLATEX,.pdf,pdf,\textbackslash\\ +% \hspace*{4ex}.pdftex\_t .\$\$(\_LU\_PDFTEX\_EXT)))\\ +% endef +% \end{source} +% +% \paragraph{PS flavor} +% \begin{source}[0.9\linewidth] +% define lu-define-flavor-PS\\ +% \hspace*{2ex}\$\$(eval \$\$(call lu-create-flavor,PS,dvi,DVIPS,.ps,ps,DVI))\\ +% endef +% \end{source} +% \subparagraph{Tip:} for DVI-flavors, the program will be invoked with +% with the option \texttt{-o \emph{target}} and with the name of the +% file source in argument. +% +% \paragraph{DVIPDF flavor} +% \begin{source}[0.9\linewidth] +% define lu-define-flavor-DVIPDF\\ +% \hspace*{2ex}\$\$(eval \$\$(call lu-create-flavor,DVIPDF,dvi,DVIPDFM,.pdf,pdf,DVI))\\ +% endef +% \end{source} +% +% +% \subsection{Variables} +% \label{sec:variables} +% \texttt{LaTeX.mk} use a generic mechanism to manage variables, so +% that lots of thing can easily be customized per document and/or per +% flavor. +% \subsubsection{Two kind of variables} +% \texttt{LaTeX.mk} distinguish two kind of variables. The first one +% (called SET-variable) is for variables where only \emph{one} value +% can be set. For example, this is the case for a variable that +% contain the name of a program to launch. The second one (called +% ADD-variable) is for variables where values can be cumulative. For +% example, this will be the case for the options of a program. +% \par +% +% For each variable used by \texttt{LaTeX.mk}, there exists several +% variables that can be set in the Makefile so that the value will be +% used for all documents, only for one document, only for one flavor, +% etc. +% +% \newcounter{nbvars}% +% \newenvironment{descvars}{% +% \par +% \noindent% +% \bgroup% +% \setcounter{nbvars}{0}% +% \renewcommand{\emph}[1]{{\it ##1}} +% \renewcommand{\variable}[3][;]{% +% \stepcounter{nbvars}% +% \arabic{nbvars}&\textbf{##2}&##3##1\\% +% } +% \begin{tabular}{clp{0.5\linewidth}} +% }{% +% \end{tabular} +% \egroup +% \par\medskip +% } +% +% \paragraph{SET-variable.} For each SET-variable \texttt{\emph{NAME}}, we +% can find in the Makfile: +% \begin{descvars} +% \variable{\texttt{LU\_\emph{target}\_\emph{NAME}}}{per document +% and per flavor value}% +% \variable{\texttt{TD\_\emph{target}\_\emph{NAME}}}{per document +% and per flavor value filled by the \texttt{texdepends} \LaTeX{} +% package}% +% \variable{\texttt{LU\_\emph{master}\_\emph{NAME}}}{per document +% value}% +% \variable{\texttt{\emph{master}\_\emph{NAME}}}{per document +% value}% +% \variable{\texttt{LU\_FLAVOR\_\emph{flavor}\_\emph{NAME}}}{per +% flavor value}% +% \variable{\texttt{LU\_\emph{NAME}}}{global value}% +% \variable{\texttt{\emph{NAME}}}{global value}% +% \variable[.]{\texttt{\_LU\_\ldots\emph{NAME}}}{internal +% \texttt{LaTeX.mk} default values}% +% \end{descvars} +% The first set variable will be used. +% +% \subparagraph{Tip:} in case of flavor context or document context, +% only relevant variables will be checked. For example, the +% SET-variable \texttt{MAIN} that give the main source of the document +% will be evaluated in document context, so only 4, 5, 6, 7 and 8 will +% be used (and I cannot see any real interest in using 6 or 7 for this +% variable). +% +% \subparagraph{Tip2:} in case of context of index (when building +% indexes or glossary), there exists several other variables per index +% to add to this list (mainly ending with \texttt{\_{\it kind}\_{\it +% indexname}\_{\it NAME}} or \texttt{\_{\it kind}\_{\it NAME}}). +% Refer to the sources if you really need them. +% +% \paragraph{ADD-variable.} An ADD-variable is cumulative. The user +% can replace or add any values per document, per flavor, etc. +% \begin{descvars} +% \variable{\texttt{LU\_\emph{target}\_\emph{NAME}}}{replacing per +% document and per flavor values}% +% \variable{\texttt{\emph{target}\_\emph{NAME}}}{cumulative per +% document and per flavor values}% +% \variable{\texttt{LU\_\emph{master}\_\emph{NAME}}}{replacing per +% document values}% +% \variable{\texttt{\emph{master}\_\emph{NAME}}}{cumulative per +% document values}% +% \variable{\texttt{LU\_FLAVOR\_\emph{flavor}\_\emph{NAME}}}{replacing +% per flavor values}% +% \variable{\texttt{FLAVOR\_\emph{flavor}\_\emph{NAME}}}{cumulative +% per flavor values}% +% \variable{\texttt{LU\_\emph{NAME}}}{replacing global values}% +% \variable{\texttt{\emph{NAME}}}{cumulative global values}% +% \end{descvars} +% \subparagraph{Tip:} if not defined, \texttt{LU\_\emph{variable}} +% defaults to ``\texttt{\$(\emph{variable}) +% \$(\_LU\_\emph{variable})}'' and \texttt{\_LU\_\emph{variable}} +% contains default values managed by \texttt{LaTeX.mk} and the +% \texttt{texdepends} \LaTeX{} package. +% \subparagraph{Example:} the ADD-variable \texttt{FLAVORS} is invoked +% in document context to know which flavors needs to be build for each +% document. This means that \texttt{LU\_{\it master}\_FLAVORS} will be +% used. +% \begin{source} +% \# We override default value for MASTERS\\ +% LU\_MASTERS=foo bar baz\\ +% \# By default, only the DVIPDF flavor will be build\\ +% FLAVORS=DVIPDF\\ +% ~\\ +% bar\_FLAVORS=PS\\ +% LU\_baz\_FLAVORS=PDF\\ +% \# there will be rules to build\\ +% \# * foo.dvi and foo.pdf\\ +% \# ~ (the DVIPDF flavor depends on the DVI flavor)\\ +% \# * bar.dvi, bar.pdf and bar.ps\\ +% \# ~ (the PS flavor is added to global flavors)\\ +% \# * baz.pdf\\ +% \# ~ (the PDF flavor will be the only one for baz) +% include LaTeX.mk +% \end{source} +% \subsubsection{List of used variables} +% Here are most of the variables used by \texttt{LaTeX.mk}. Users +% should only have to sometimes managed the first ones. The latter are +% described here for information only (and are subject to +% modifications). Please, report a bug if some of them are not +% correctly pickup by the \texttt{texdepends} \LaTeX{} package and +% \texttt{LaTeX.mk}. +% +% \newenvironment{describevars}{% +% \par +% \noindent% +% \bgroup% +% \renewcommand{\emph}[1]{{\it ##1}}% +% \newcommand{\default}[1]{\newline\textbf{Default: }##1} +% \renewcommand{\variable}[4]{% +% \textbf{\texttt{##1}}&##2&##3&##4\\% +% } +% \begin{tabular}{cccp{0.5\linewidth}} +% Name & Kind &% +% \multicolumn{1}{m{4em}}{\begin{center}Context of +% use\end{center}} & +% \multicolumn{1}{c}{Description} \\ +% \hline +% \hline +% }{% +% \end{tabular} +% \egroup +% \par\medskip +% } +% +% \begin{describevars} +% \variable{MASTERS}{ADD}{Global}{List of documents to compile. +% These values will be used as jobname. \default{basename of +% \texttt{*.tex} files containing the \texttt{\textbackslash +% documentclass} pattern}}% +% \variable{FLAVORS}{ADD}{Document}{List of flavors for each +% document. \default{\texttt{PS PDF}}}% +% \variable{MAIN}{SET}{Document}{Master \texttt{tex} source +% file\default{\texttt{\emph{master}.tex}}}% +% \variable{DEPENDS}{ADD}{Target}{List of dependencies}% +% \variable{\emph{progvarname}}{SET}{Target}{Program to launch for +% the corresponding flavor}% +% \variable{\emph{progvarname}\_OPTIONS}{ADD}{Target}{Options to use +% when building the target}% +% \variable{STYLE}{SET}{Index}{Name of the index/glossary style file +% to use (\texttt{.ist}, etc.)}% +% \hline +% \variable{TARGET}{SET}{Index}{Name of the index/glossary file to +% produce (\texttt{.ind}, \texttt{.gls}, etc.)}% +% \variable{SRC}{SET}{Index}{Name of the index/glossary file source +% (\texttt{.idx}, \texttt{.glo}, etc.)}% +% \variable{FIGURES}{ADD}{Target}{Lists of figures included}% +% \variable{BIBFILES}{ADD}{Target}{Lists of bibliography files used +% (\texttt{.bib})}% +% \variable{BIBSTYLES}{ADD}{Target}{Lists of bibliography style +% files used (\texttt{.bst})}% +% \variable{BBLFILES}{ADD}{Target}{Lists of built bibliography files +% (\texttt{.bbl})}% +% \variable{INPUT}{ADD}{Target}{Lists of input files (\texttt{.cls}, +% \texttt{.sty}, \texttt{.tex}, etc.)}% +% \variable{OUTPUTS}{ADD}{Target}{Lists of output files +% (\texttt{.aux}, etc.)}% +% \variable{GRAPHICSPATH}{ADD}{Target}{\texttt{\textbackslash +% graphicspath\{\}} arguments}% +% \variable{GPATH}{ADD}{Target}{List of directories from +% \texttt{GRAPHICSPATH} without \texttt{\{} and \texttt{\}}, +% separated by spaces}% +% \variable{INDEXES}{ADD}{Target}{Kinds of index (\texttt{INDEX}, +% \texttt{GLOSS}, etc.)}% +% \variable{INDEXES\_\emph{kind}}{ADD}{Target}{List of indexes or +% glossaries}% +% \variable{WATCHFILES}{ADD}{Target}{List of files that trigger a +% rebuild if modified (\texttt{.aux}, etc.)}% +% \variable{REQUIRED}{ADD}{Target}{List of new dependencies found by +% the \texttt{texdepends} \LaTeX{} package}% +% \variable{MAX\_REC}{SET}{Target}{Maximum level of recursion +% authorized}% +% \variable{REBUILD\_RULES}{ADD}{Target}{List of rebuild rules to +% use (can be modified by the \texttt{texdepends} \LaTeX{} +% package}% +% \variable{EXT}{SET}{Flavor}{Target file extension of the flavor}% +% \variable{DEPFLAVOR}{SET}{Flavor}{TEX-flavor a DVI-flavor depend +% upon}% +% \variable{CLEANFIGEXT}{ADD}{Flavor}{Extensions of figure files to +% remove on clean}% +% \end{describevars} +% +% \newpage +% \section{FAQ} +% +% \newenvironment{question}[2]{ +% \subsection{#1} +% \texttt{}\llap{$\Rightarrow$ \quad }\emph{#2}\par\bigskip}{ +% } +% +% \begin{question}{No rule to make target `LU\_WATCH\_FILES\_SAVE'}{When +% using |LaTeX.mk|, I got the error:\\ +% |make[1]: *** No rule to make target `LU\_WATCH\_FILES\_SAVE'. Stop.|} +% +% |make| is called in such a way that does not allow correct recursive +% calls. As one can not know by advance how many times \LaTeX{}, +% bib\TeX{}, etc. will need to be run, |latex-make| use recursive +% invocations of |make|. This means that in the |LaTeX.mk| makefile, +% there exist rules such as: +% \begin{source} +% \$(MAKE) INTERNAL\_VARIABLE=value internal\_target +% \end{source} +% In order |latex-make| to work, this invocation of |make| must read +% the same rules and variable definitions as the main one. This means +% that calling "|make -f LaTeX.mk foo.pdf|" in a directory with only +% |foo.tex| will not work. Recursive invocations of make will not load +% |LaTeX.mk|, will search for a |Makefile| in the current directory +% and will complain about being unable to build the +% |LU_WATCH_FILES_SAVE| internal target. +% +% \par\medskip +% The solution is to call |make| so that recursive invocations will +% read the same variables and rules. For example:\\ +% |make -f LaTeX.mk MAKE="make -f LaTeX.mk" foo.pdf|\\ +% or (if there is no |Makefile| in the directory):\\ +% |env MAKEFILES=LaTeX.mk make foo.pdf|\\ +% +% \end{question} +% +% \StopEventually{ +% } +% \newpage +% \section{Implementation} +% +% \subsection{LaTeX.mk} +% \begin{macrocode} +%<*makefile> + +####[ Check Software ]################################################ + +ifeq ($(filter else-if,$(.FEATURES)),) +$(error GNU Make 3.81 needed. Please, update your software.) + exit 1 +endif + +# Some people want to call our Makefile snippet with +# make -f LaTeX.mk +# This should not work as $(MAKE) is call recursively and will not read +# LaTeX.mk again. We cannot just add LaTeX.mk to MAKEFILES as LaTeX.mk +# should be read AFTER a standard Makefile (if any) that can define some +# variables (LU_MASTERS, ...) that LaTeX.mk must see. +# So I introduce an HACK here that try to workaround the situation. Keep in +# mind that this hack is not perfect and does not handle all cases +# (for example, "make -f my_latex_config.mk -f LaTeX.mk" will not recurse +# correctly) +ifeq ($(foreach m,$(MAKEFILES), $(m)) $(lastword $(MAKEFILE_LIST)),$(MAKEFILE_LIST)) +# We are the first file read after the ones from MAKEFILES +# So we assume we are read due to "-f LaTeX.mk" +LU_LaTeX.mk_NAME := $(lastword $(MAKEFILE_LIST)) +# Is this Makefile correctly read for recursive calls ? +ifeq ($(findstring -f $(LU_LaTeX.mk_NAME),$(MAKE)),) +$(info ********************************************************************************) +$(info Warning: $(LU_LaTeX.mk_NAME) called directly. I suppose that you run:) +$(info Warning: $(MAKE) -f $(LU_LaTeX.mk_NAME) $(MAKECMDGOALS)) +$(info Warning: or something similar that does not allow recursive invocation of make) +$(info Warning: ) +$(info Warning: Trying to enable a workaround. This ACK will be disabled in a future) +$(info Warning: release. Consider using another syntax, for example:) +$(info Warning: $(MAKE) -f $(LU_LaTeX.mk_NAME) MAKE="$(MAKE) -f $(LU_LaTeX.mk_NAME)" $(MAKECMDGOALS)) +$(info ********************************************************************************) +MAKE+= -f $(LU_LaTeX.mk_NAME) +endif +endif + +####[ Configuration ]################################################ + +# For global site options +-include LaTeX.mk.conf + +# list of messages categories to display +LU_SHOW ?= warning #info debug debug-vars + +# Select GNU/BSD/MACOSX utils (cp, rm, mv, ...) +LU_UTILS ?= GNU + +####[ End of configuration ]################################################ +# Modifying the remaining of this document may endanger you life!!! ;) + +#--------------------------------------------------------------------- +# Controling verbosity +ifdef VERB +MAK_VERB := $(VERB) +else +#MAK_VERB := verbose +#MAK_VERB := normal +MAK_VERB := quiet +#MAK_VERB := silent +endif + +#--------------------------------------------------------------------- +# MAK_VERB -> verbosity +ifeq ($(MAK_VERB),verbose) +COMMON_PREFIX = echo " ======> building " $@ "<======" ; \ + printf "%s $(@F) due to:$(foreach file,$?,\n * $(file))\n" $1; +# +COMMON_HIDE :=# +COMMON_CLEAN :=# +SHOW_LATEX:=true +else +ifeq ($(MAK_VERB),normal) +COMMON_PREFIX =# +COMMON_HIDE := @ +COMMON_CLEAN :=# +SHOW_LATEX:=true +else +ifeq ($(MAK_VERB),quiet) +COMMON_PREFIX = @ echo " ======> building " $@ "<======" ; +# echo "due to $?" ; +COMMON_HIDE := @ +COMMON_CLEAN :=# +SHOW_LATEX:= +else # silent +COMMON_PREFIX = @ +COMMON_HIDE := @ +COMMON_CLEAN := @ +SHOW_LATEX:= +endif +endif +endif + +#--------------------------------------------------------------------- +# Old LaTeX have limitations +_LU_PDFTEX_EXT ?= pdftex + +######################################################################### +# Utilities +LU_CP=$(LU_CP_$(LU_UTILS)) +LU_MV=$(LU_MV_$(LU_UTILS)) +LU_RM=$(LU_RM_$(LU_UTILS)) +LU_CP_GNU ?= cp -a -- +LU_MV_GNU ?= mv -- +LU_RM_GNU ?= rm -f -- +LU_CP_BSD ?= cp -p +LU_MV_BSD ?= mv +LU_RM_BSD ?= rm -f +LU_CP_MACOSX ?= /bin/cp -p +LU_MV_MACOSX ?= /bin/mv +LU_RM_MACOSX ?= /bin/rm -f + +lu-show=\ +$(if $(filter $(LU_SHOW),$(1)), \ + $(if $(2), \ + $(if $(filter-out $(2),$(MAKELEVEL)),,$(3)), \ + $(3))) +lu-show-infos=\ +$(if $(filter $(LU_SHOW),$(1)), \ + $(if $(2), \ + $(if $(filter-out $(2),$(MAKELEVEL)),,$(warning $(3))), \ + $(warning $(3)))) +lu-show-rules=$(call lu-show-infos,info,0,$(1)) +lu-show-flavors=$(call lu-show-infos,info,0,$(1)) +lu-show-var=$(call lu-show-infos,debug-vars,, * Set $(1)=$($(1))) +lu-show-read-var=$(eval $(call lu-show-infos,debug-vars,, Reading $(1) in $(2) ctx: $(3)))$(3) +lu-show-readone-var=$(eval $(call lu-show-infos,debug-vars,, Reading $(1) for $(2) [one value]: $(3)))$(3) +lu-show-set-var=$(call lu-show-infos,debug-vars,, * Setting $(1) for $(2) to value: $(3)) +lu-show-add-var=$(call lu-show-infos,debug-vars,, * Adding to $(1) for $(2) values: $(value 3)) +lu-show-add-var2=$(call lu-show-infos,warning,, * Adding to $(1) for $(2) values: $(value 3)) + +lu-save-file=$(call lu-show,debug,,echo "saving $1" ;) \ + if [ -f "$1" ];then $(LU_CP) "$1" "$2" ;else $(LU_RM) "$2" ;fi +lu-cmprestaure-file=\ + if cmp -s "$1" "$2"; then \ + $(LU_MV) "$2" "$1" ; \ + $(call lu-show,debug,,echo "$1" not modified ;) \ + else \ + $(call lu-show,debug,,echo "$1" modified ;) \ + if [ -f "$2" -o -f "$1" ]; then \ + $(RM) -- "$2" ; \ + $3 \ + fi ; \ + fi + +lu-clean=$(if $(strip $(1)),$(RM) $(1)) + +define lu-bug # description + $$(warning Internal error: $(1)) + $$(error You probably found a bug. Please, report it.) +endef + +######################################################################### +######################################################################### +######################################################################### +######################################################################### +################## ######################### +################## Variables ######################### +################## ######################### +######################################################################### +######################################################################### +######################################################################### +######################################################################### +######################################################################### +# +# _LU_FLAVORS_DEFINED : list of available flavors +# _LU_FLAV_*_'flavname' : per flavor variables +# where * can be : +# PROGNAME : variable name for programme (and .._OPTIONS for options) +# EXT : extension of created file +# TARGETNAME : global target +# DEPFLAVOR : flavor to depend upon +# CLEANFIGEXT : extensions to clean for fig figures +_LU_FLAVORS_DEFINED = $(_LU_FLAVORS_DEFINED_TEX) $(_LU_FLAVORS_DEFINED_DVI) + +# INDEXES_TYPES = GLOSS INDEX +# INDEXES_INDEX = name1 ... +# INDEXES_GLOSS = name2 ... +# INDEX_name1_SRC +# GLOSS_name2_SRC + +define _lu-getvalues# 1:VAR 2:CTX (no inheritage) +$(if $(filter-out undefined,$(origin LU_$2$1)),$(LU_$2$1),$($2$1) $(_LU_$2$1_MK) $(TD_$2$1)) +endef +define lu-define-addvar # 1:suffix_fnname 2:CTX 3:disp-debug 4:nb_args 5:inherited_ctx 6:ctx-build-depend + define lu-addtovar$1 # 1:VAR 2:... $4: value + _LU_$2$$1_MK+=$$($4) + $$(call lu-show-add-var,$$1,$3,$$(value $4)) + endef + define lu-def-addvar-inherited-ctx$1 # 1:VAR 2:... + $6 + _LU_$2$$1_INHERITED_CTX=$$(sort \ + $$(foreach ctx,$5,$$(ctx) $$(if $$(filter-out undefined,$$(origin \ + LU_$$(ctx)$$1)),,\ + $$(_LU_$$(ctx)$$1_INHERITED_CTX)))) + $$$$(call lu-show-var,_LU_$2$$1_INHERITED_CTX) + endef + define lu-getvalues$1# 1:VAR 2:... +$$(if $$(filter-out undefined,$$(origin _LU_$2$$1_INHERITED_CTX)),,$$(eval \ + $$(call lu-def-addvar-inherited-ctx$1,$$1,$$2,$$3,$$4,$$5,$$6)\ +))$$(call lu-show-read-var,$$1,$3,$$(foreach ctx,\ + $(if $2,$2,GLOBAL) $$(if $$(filter-out undefined,$$(origin LU_$2$$1)),,\ + $$(_LU_$2$$1_INHERITED_CTX))\ + ,$$(call _lu-getvalues,$$1,$$(filter-out GLOBAL,$$(ctx))))) + endef +endef + +# Global variable +# VAR (DEPENDS) +$(eval $(call lu-define-addvar,-global,,global,2)) + +# Per flavor variable +# FLAVOR_$2_VAR (FLAVOR_DVI_DEPENDS) +# 2: flavor name +# Inherit from VAR (DEPENDS) +$(eval $(call lu-define-addvar,-flavor,FLAVOR_$$2_,flavor $$2,3,\ + GLOBAL,\ + $$(eval $$(call lu-def-addvar-inherited-ctx-global,$$1)) \ +)) + +# Per master variable +# $2_VAR (source_DEPENDS) +# 2: master name +# Inherit from VAR (DEPENDS) +$(eval $(call lu-define-addvar,-master,$$2_,master $$2,3,\ + GLOBAL,\ + $$(eval $$(call lu-def-addvar-inherited-ctx-global,$$1)) \ +)) + +# Per target variable +# $2$(EXT of $3)_VAR (source.dvi_DEPENDS) +# 2: master name +# 3: flavor name +# Inherit from $2_VAR FLAVOR_$3_VAR (source_DEPENDS FLAVOR_DVI_DEPENDS) +$(eval $(call lu-define-addvar,,$$2$$(call lu-getvalue-flavor,EXT,$$3)_,target $$2$$(call lu-getvalue-flavor,EXT,$$3),4,\ + $$2_ FLAVOR_$$3_,\ + $$(eval $$(call lu-def-addvar-inherited-ctx-master,$$1,$$2)) \ + $$(eval $$(call lu-def-addvar-inherited-ctx-flavor,$$1,$$3)) \ +)) + +# Per index/glossary variable +# $(2)_$(3)_VAR (INDEX_source_DEPENDS) +# 2: type (INDEX, GLOSS, ...) +# 3: index name +# Inherit from VAR (DEPENDS) +$(eval $(call lu-define-addvar,-global-index,$$2_$$3_,index $$3[$$2],4,\ + GLOBAL,\ + $$(eval $$(call lu-def-addvar-inherited-ctx-global,$$1)) \ +)) + +# Per master and per index/glossary variable +# $(2)_$(3)_$(4)_VAR (source_INDEX_source_DEPENDS) +# 2: master name +# 3: type (INDEX, GLOSS, ...) +# 4: index name +# Inherit from $2_VAR $3_$4_VAR (source_DEPENDS INDEX_source_DEPENDS) +$(eval $(call lu-define-addvar,-master-index,$$2_$$3_$$4_,index $$2/$$4[$$3],5,\ + $$2_ $$3_$$4_,\ + $$(eval $$(call lu-def-addvar-inherited-ctx-master,$$1,$$2)) \ + $$(eval $$(call lu-def-addvar-inherited-ctx-global-index,$$1,$$3,$$4)) \ +)) + +# Per target and per index/glossary variable +# $(2)$(EXT of $3)_$(4)_$(5)_VAR (source.dvi_INDEX_source_DEPENDS) +# 2: master name +# 3: flavor name +# 4: type (INDEX, GLOSS, ...) +# 5: index name +# Inherit from $2$(EXT of $3)_VAR $(2)_$(3)_$(4)_VAR +# (source.dvi_DEPENDS source_INDEX_source_DEPENDS) +$(eval $(call lu-define-addvar,-index,$$2$$(call lu-getvalue-flavor,EXT,$$3)_$$4_$$5_,index $$2$$(call lu-getvalue-flavor,EXT,$$3)/$$5[$$4],6,\ + $$2$$(call lu-getvalue-flavor,EXT,$$3)_ $$2_$$4_$$5_,\ + $$(eval $$(call lu-def-addvar-inherited-ctx,$$1,$$2,$$3)) \ + $$(eval $$(call lu-def-addvar-inherited-ctx-master-index,$$1,$$2,$$4,$$5)) \ +)) + + + + + + +define lu-setvar-global # 1:name 2:value + _LU_$(1) ?= $(2) + $$(eval $$(call lu-show-set-var,$(1),global,$(2))) +endef + +define lu-setvar-flavor # 1:name 2:flavor 3:value + _LU_FLAVOR_$(2)_$(1) ?= $(3) + $$(eval $$(call lu-show-set-var,$(1),flavor $(2),$(3))) +endef + +define lu-setvar-master # 1:name 2:master 3:value + _LU_$(2)_$(1) ?= $(3) + $$(eval $$(call lu-show-set-var,$(1),master $(2),$(3))) +endef + +define lu-setvar # 1:name 2:master 3:flavor 4:value + _LU_$(2)$$(call lu-getvalue-flavor,EXT,$(3))_$(1)=$(4) + $$(eval $$(call lu-show-set-var,$(1),master/flavor $(2)/$(3),$(4))) +endef + +define lu-getvalue # 1:name 2:master 3:flavor +$(call lu-show-readone-var,$(1),master/flavor $(2)/$(3),$(or \ + $(LU_$(2)$(call lu-getvalue-flavor,EXT,$(3))_$(1)), \ + $(TD_$(2)$(call lu-getvalue-flavor,EXT,$(3))_$(1)), \ + $(LU_$(2)_$(1)), \ + $($(2)_$(1)), \ + $(LU_FLAVOR_$(3)_$(1)), \ + $(LU_$(1)), \ + $($(1)), \ + $(_LU_$(2)$(call lu-getvalue-flavor,EXT,$(3))_$(1)), \ + $(_LU_$(2)_$(1)), \ + $(_LU_FLAVOR_$(3)_$(1)), \ + $(_LU_$(1))\ +)) +endef + +define lu-getvalue-flavor # 1:name 2:flavor +$(call lu-show-readone-var,$(1),flavor $(2),$(or \ + $(LU_FLAVOR_$(2)_$(1)), \ + $(LU_$(1)), \ + $($(1)), \ + $(_LU_FLAVOR_$(2)_$(1)), \ + $(_LU_$(1))\ +)) +endef + +define lu-getvalue-master # 1:name 2:master +$(call lu-show-readone-var,$(1),master $(2),$(or \ + $(LU_$(2)_$(1)), \ + $($(2)_$(1)), \ + $(LU_$(1)), \ + $($(1)), \ + $(_LU_$(2)_$(1)), \ + $(_LU_$(1))\ +)) +endef + +define lu-getvalue-index # 1:name 2:master 3:flavor 4:type 5:indexname +$(call lu-show-readone-var,$(1),master/flavor/index $(2)/$(3)/[$(4)]$(5),$(or \ + $(LU_$(2)$(call lu-getvalue-flavor,EXT,$(3))_$(4)_$(5)_$(1)), \ + $(LU_$(2)_$(4)_$(5)_$(1)), \ + $(TD_$(2)$(call lu-getvalue-flavor,EXT,$(3))_$(4)_$(5)_$(1)), \ + $($(2)_$(4)_$(5)_$(1)), \ + $(LU_$(4)_$(5)_$(1)), \ + $($(4)_$(5)_$(1)), \ + $(LU_$(2)$(call lu-getvalue-flavor,EXT,$(3))_$(4)_$(1)), \ + $(LU_$(2)_$(4)_$(1)), \ + $($(2)_$(4)_$(1)), \ + $(LU_$(4)_$(1)), \ + $($(4)_$(1)), \ + $(LU_$(2)_$(1)), \ + $($(2)_$(1)), \ + $(LU_FLAVOR_$(3)_$(1)), \ + $(LU_$(1)), \ + $($(1)), \ + $(_LU_$(2)$(call lu-getvalue-flavor,EXT,$(3))_$(4)_$(5)_$(1)), \ + $(_LU_$(2)_$(4)_$(5)_$(1)), \ + $(_LU_$(4)_$(5)_$(1)), \ + $(_LU_$(2)$(call lu-getvalue-flavor,EXT,$(3))_$(4)_$(1)), \ + $(_LU_$(2)_$(4)_$(1)), \ + $(_LU_FLAVOR_$(3)_$(4)_$(1)), \ + $(_LU_$(4)_$(1)), \ + $(_LU_$(2)$(call lu-getvalue-flavor,EXT,$(3))_$(1)), \ + $(_LU_$(2)_$(1)), \ + $(_LU_FLAVOR_$(3)_$(1)), \ + $(_LU_$(1))\ +)) +endef + +define lu-call-prog # 1:varname 2:master 3:flavor [4:index] +$(call lu-getvalue,$(1),$(2),$(3)) $(call lu-getvalues,$(1)_OPTIONS,$(2),$(3)) +endef + +define lu-call-prog-index # 1:varname 2:master 3:flavor 4:type 5:indexname +$(call lu-getvalue$(if $(4),-index),$(1),$(2),$(3),$(4),$(5)) \ + $(call lu-getvalues$(if $(4),-index),$(1)_OPTIONS,$(2),$(3),$(4),$(5)) +endef + +define lu-call-prog-flavor # 1:master 2:flavor +$(call lu-call-prog,$(call lu-getvalue,VARPROG,$(1),$(2)),$(1),$(2)) +endef + +######################################################################### +######################################################################### +######################################################################### +######################################################################### +################## ######################### +################## Global variables ######################### +################## ######################### +######################################################################### +######################################################################### +######################################################################### +######################################################################### +######################################################################### + +# Globals variables +$(eval $(call lu-setvar-global,LATEX,latex)) +$(eval $(call lu-setvar-global,PDFLATEX,pdflatex)) +$(eval $(call lu-setvar-global,DVIPS,dvips)) +$(eval $(call lu-setvar-global,DVIPDFM,dvipdfm)) +$(eval $(call lu-setvar-global,BIBTEX,bibtex)) +#$(eval $(call lu-setvar-global,MPOST,TEX="$(LATEX)" mpost)) +$(eval $(call lu-setvar-global,FIG2DEV,fig2dev)) +#$(eval $(call lu-setvar-global,SVG2DEV,svg2dev)) +$(eval $(call lu-setvar-global,EPSTOPDF,epstopdf)) +$(eval $(call lu-setvar-global,MAKEINDEX,makeindex)) + +# Look for local version, then texmfscript, then in PATH of our program +# At each location, we prefer with suffix than without +define _lu_which # VARNAME progname + ifeq ($(origin _LU_$(1)_DEFAULT), undefined) + _LU_$(1)_DEFAULT := $$(firstword $$(wildcard \ + $$(addprefix bin/,$(2) $$(basename $(2))) \ + $$(addprefix ./,$(2) $$(basename $(2))) \ + $$(shell kpsewhich -format texmfscripts $(2)) \ + $$(shell kpsewhich -format texmfscripts $$(basename $(2))) \ + $$(foreach dir,$$(subst :, ,$$(PATH)), \ + $$(dir)/$(2) $$(dir)/$$(basename $(2))) \ + ) $(2)) + export _LU_$(1)_DEFAULT + endif + $$(eval $$(call lu-setvar-global,$(1),$$(_LU_$(1)_DEFAULT))) +endef + +$(eval $(call _lu_which,GENSUBFIG,gensubfig.py)) +$(eval $(call _lu_which,FIGDEPTH,figdepth.py)) +$(eval $(call _lu_which,GENSUBSVG,gensubfig.py)) +$(eval $(call _lu_which,SVGDEPTH,svgdepth.py)) +$(eval $(call _lu_which,SVG2DEV,svg2dev.py)) +$(eval $(call _lu_which,LATEXFILTER,latexfilter.py)) + +# Rules to use to check if the build document (dvi or pdf) is up-to-date +# This can be overruled per document manually and/or automatically +#REBUILD_RULES ?= latex texdepends bibtopic bibtopic_undefined_references +$(eval $(call lu-addtovar-global,REBUILD_RULES,latex texdepends)) + +# Default maximum recursion level +$(eval $(call lu-setvar-global,MAX_REC,6)) + +######################################################################### +######################################################################### +######################################################################### +######################################################################### +################## ######################### +################## Flavors ######################### +################## ######################### +######################################################################### +######################################################################### +######################################################################### +######################################################################### +######################################################################### + +define lu-create-texflavor # 1:name 2:tex_prog 3:file_ext + # 4:master_cible 5:fig_extention_to_clean + _LU_FLAVORS_DEFINED_TEX += $(1) + $(eval $(call lu-setvar-flavor,VARPROG,$(1),$(2))) + $(eval $(call lu-setvar-flavor,EXT,$(1),$(3))) + $(eval $(call lu-setvar-flavor,TARGETNAME,$(1),$(4))) + $(eval $(call lu-addtovar-flavor,CLEANFIGEXT,$(1),$(5))) + $(eval $(call lu-addtovar-flavor,CLEANSVGEXT,$(1),$(5))) +endef + +define lu-create-dviflavor # 1:name 2:dvi_prog 3:file_ext + # 4:master_cible 5:tex_flavor_depend + $$(eval $$(call lu-define-flavor,$(5))) + _LU_FLAVORS_DEFINED_DVI += $(1) + $(eval $(call lu-setvar-flavor,VARPROG,$(1),$(2))) + $(eval $(call lu-setvar-flavor,EXT,$(1),$(3))) + $(eval $(call lu-setvar-flavor,TARGETNAME,$(1),$(4))) + $(eval $(call lu-setvar-flavor,DEPFLAVOR,$(1),$(5))) +endef + +define lu-create-flavor # 1:name 2:type 3..7:options + $$(if $$(filter $(1),$(_LU_FLAVORS_DEFINED)), \ + $$(call lu-show-flavors,Flavor $(1) already defined), \ + $$(call lu-show-flavors,Creating flavor $(1) ($(2))) \ + $$(eval $$(call lu-create-$(2)flavor,$(1),$(3),$(4),$(5),$(6),$(7)))) +endef + +define lu-define-flavor # 1:name + $$(eval $$(call lu-define-flavor-$(1))) +endef + +define lu-flavor-rules # 1:name + $$(call lu-show-flavors,Defining rules for flavor $(1)) + $$(if $$(call lu-getvalue-flavor,TARGETNAME,$(1)), \ + $$(call lu-getvalue-flavor,TARGETNAME,$(1)): \ + $$(call lu-getvalues-flavor,TARGETS,$(1))) + $$(if $$(call lu-getvalue-flavor,TARGETNAME,$(1)), \ + .PHONY: $$(call lu-getvalue-flavor,TARGETNAME,$(1))) +endef + +define lu-define-flavor-DVI # + $$(eval $$(call lu-create-flavor,DVI,tex,LATEX,.dvi,dvi,\ + .pstex_t .pstex)) +endef + +define lu-define-flavor-PDF # + $$(eval $$(call lu-create-flavor,PDF,tex,PDFLATEX,.pdf,pdf,\ + .pdftex_t .$$(_LU_PDFTEX_EXT))) +endef + +define lu-define-flavor-PS # + $$(eval $$(call lu-create-flavor,PS,dvi,DVIPS,.ps,ps,DVI)) +endef + +define lu-define-flavor-DVIPDF # + $$(eval $$(call lu-create-flavor,DVIPDF,dvi,DVIPDFM,.pdf,pdf,DVI)) +endef + +$(eval $(call lu-addtovar-global,FLAVORS,PDF PS)) + +######################################################################### +######################################################################### +######################################################################### +######################################################################### +################## ######################### +################## Masters ######################### +################## ######################### +######################################################################### +######################################################################### +######################################################################### +######################################################################### +######################################################################### + +define _lu-do-latex # 1:master 2:flavor 3:source.tex 4:ext(.dvi/.pdf) + exec 3>&1; \ + run() { \ + echo -n "Running:" 1>&3 ; \ + for arg; do \ + echo -n " '$$arg'" 1>&3 ; \ + done ; echo 1>&3 ; \ + "$$@" ; \ + }; \ + doit() { \ + $(RM) -v "$(1)$(4)_FAILED" \ + "$(1)$(4)_NEED_REBUILD" \ + "$(1)$(4).mk" ;\ + ( echo X | \ + run $(call lu-call-prog-flavor,$(1),$(2)) \ + --interaction errorstopmode \ + --jobname "$(1)" \ + '\RequirePackage[extension='"$(4)"']{texdepends}\input'"{$(3)}" || \ + touch "$(1)$(4)_FAILED" ; \ + if grep -sq '^! LaTeX Error:' "$(1).log" ; then \ + touch "$(1)$(4)_FAILED" ; \ + fi \ + ) | $(call lu-call-prog,LATEXFILTER,$(1),$(2)) ; \ + NO_TEXDEPENDS_FILE=0 ;\ + if [ ! -f "$(1)$(4).mk" ]; then \ + NO_TEXDEPENDS_FILE=1 ;\ + fi ;\ + sed -e 's,\\openout[0-9]* = `\(.*\)'"'.,TD_$(1)$(4)_OUTPUTS += \1,p;d" \ + "$(1).log" >> "$(1)$(4).mk" ;\ + if [ -f "$(1)$(4)_FAILED" ]; then \ + echo "*************************************" ;\ + echo "Building $(1)$(4) fails" ;\ + echo "*************************************" ;\ + echo "Here are the last lines of the log file" ;\ + echo "If this is not enought, try to" ;\ + echo "call 'make' with 'VERB=verbose' option" ;\ + echo "*************************************" ;\ + echo "==> Last lines in $(1).log <==" ; \ + sed -e '/^[?] X$$/,$$d' \ + -e '/^Here is how much of TeX'"'"'s memory you used:$$/,$$d' \ + < "$(1).log" | tail -n 20; \ + return 1; \ + fi; \ + if [ "$$NO_TEXDEPENDS_FILE" = 1 ]; then \ + echo "*************************************" ;\ + echo "texdepends does not seems be loaded" ;\ + echo "Either your (La)TeX installation is wrong or you found a bug." ;\ + echo "If so, please, report it (with the result of shell command 'kpsepath tex')";\ + echo "Aborting compilation" ;\ + echo "*************************************" ;\ + touch "$(1)$(4)_FAILED" ; \ + return 1 ;\ + fi ;\ + }; doit +endef + +.PHONY: clean-build-fig + +########################################################## +define lu-master-texflavor-index-vars # MASTER FLAVOR TYPE INDEX ext(.dvi/.pdf) + $$(call lu-show-rules,Setting flavor index vars for $(1)/$(2)/[$(3)]$(4)) + $$(eval $$(call lu-addtovar,DEPENDS,$(1),$(2), \ + $$(call lu-getvalue-index,TARGET,$(1),$(2),$(3),$(4)))) + $$(eval $$(call lu-addtovar,WATCHFILES,$(1),$(2), \ + $$(call lu-getvalue-index,SRC,$(1),$(2),$(3),$(4)))) +endef #################################################### +define lu-master-texflavor-index-rules # MASTER FLAVOR TYPE INDEX ext(.dvi/.pdf) + $$(call lu-show-rules,Setting flavor index rules for $(1)/$(2)/[$(3)]$(4)) + $$(if $$(_LU_DEF_IND_$$(call lu-getvalue-index,TARGET,$(1),$(2),$(3),$(4))), \ + $$(call lu-show-rules,=> Skipping: already defined in flavor $$(_LU_DEF_IND_$$(call lu-getvalue-index,TARGET,$(1),$(2),$(3),$(4)))), \ + $$(eval $$(call _lu-master-texflavor-index-rules\ + ,$(1),$(2),$(3),$(4),$(5),$$(call lu-getvalue-index,TARGET,$(1),$(2),$(3),$(4))))) +endef +define _lu-master-texflavor-index-rules # MASTER FLAVOR TYPE INDEX ext TARGET + $(6): \ + $$(call lu-getvalue-index,SRC,$(1),$(2),$(3),$(4)) \ + $$(wildcard $$(call lu-getvalue-index,STYLE,$(1),$(2),$(3),$(4))) + $$(COMMON_PREFIX)$$(call lu-call-prog-index,MAKEINDEX,$(1),$(2),$(3),$(4)) \ + $$(addprefix -s ,$$(call lu-getvalue-index,STYLE,$(1),$(2),$(3),$(4))) \ + -o $$@ $$< + _LU_DEF_IND_$(6)=$(2) + clean:: + $$(call lu-clean,$$(call lu-getvalue-index,TARGET,$(1),$(2),$(3),$(4)) \ + $$(addsuffix .ilg,$$(basename \ + $$(call lu-getvalue-index,SRC,$(1),$(2),$(3),$(4))))) +endef #################################################### +define lu-master-texflavor-index # MASTER FLAVOR INDEX ext(.dvi/.pdf) + $$(eval $$(call lu-master-texflavor-index-vars,$(1),$(2),$(3),$(4))) + $$(eval $$(call lu-master-texflavor-index-rules,$(1),$(2),$(3),$(4))) +endef +########################################################## + +########################################################## +define lu-master-texflavor-vars # MASTER FLAVOR ext(.dvi/.pdf) + $$(call lu-show-rules,Setting flavor vars for $(1)/$(2)) + -include $(1)$(3).mk + $$(eval $$(call lu-addtovar,DEPENDS,$(1),$(2), \ + $$(call lu-getvalues,FIGURES,$(1),$(2)) \ + $$(call lu-getvalues,BIBFILES,$(1),$(2)) \ + $$(wildcard $$(call lu-getvalues,INPUTS,$(1),$(2))) \ + $$(wildcard $$(call lu-getvalues,BIBSTYLES,$(1),$(2))) \ + $$(call lu-getvalues,BBLFILES,$(1),$(2))\ + )) + + $$(eval $$(call lu-addtovar-flavor,TARGETS,$(2),$(1)$(3))) + + $$(eval $$(call lu-addtovar,GPATH,$(1),$(2), \ + $$(subst },,$$(subst {,,$$(subst }{, ,\ + $$(call lu-getvalue,GRAPHICSPATH,$(1),$(2))))))) + + $$(if $$(sort $$(call lu-getvalues,SUBFIGS,$(1),$(2))), \ + $$(eval include $$(addsuffix .mk,$$(sort \ + $$(call lu-getvalues,SUBFIGS,$(1),$(2)))))) + + $$(eval $$(call lu-addtovar,WATCHFILES,$(1),$(2), \ + $$(filter %.aux, $$(call lu-getvalues,OUTPUTS,$(1),$(2))))) + + $$(foreach type,$$(call lu-getvalues,INDEXES,$(1),$(2)), \ + $$(foreach index,$$(call lu-getvalues,INDEXES_$$(type),$(1),$(2)), \ + $$(eval $$(call lu-master-texflavor-index-vars,$(1),$(2),$$(type),$$(index),$(3))))) +endef #################################################### +define lu-master-texflavor-rules # MASTER FLAVOR ext(.dvi/.pdf) + $$(call lu-show-rules,Defining flavor rules for $(1)/$(2)) + $$(call lu-getvalues,BBLFILES,$(1),$(2)): \ + $$(sort $$(call lu-getvalues,BIBFILES,$(1),$(2)) \ + $$(wildcard $$(call lu-getvalues,BIBSTYLES,$(1),$(2)))) + $(1)$(3): %$(3): \ + $$(call lu-getvalues,DEPENDS,$(1),$(2)) \ + $$(call lu-getvalues,REQUIRED,$(1),$(2)) \ + $$(if $$(wildcard $(1)$(3)_FAILED),LU_FORCE,) \ + $$(if $$(wildcard $(1)$(3)_NEED_REBUILD),LU_FORCE,) \ + $$(if $$(wildcard $(1)$(3)_NEED_REBUILD_IN_PROGRESS),LU_FORCE,) + $$(if $$(filter-out $$(LU_REC_LEVEL),$$(call lu-getvalue,MAX_REC,$(1),$(2))),, \ + $$(warning *********************************) \ + $$(warning *********************************) \ + $$(warning *********************************) \ + $$(warning Stopping generation of $$@) \ + $$(warning I got max recursion level $$(LU_$(1)_$(2)_MAX_REC)) \ + $$(warning Set LU_$(1)_$(2)_MAX_REC, LU_MAX_REC_$(1) or LU_MAX_REC if you need it) \ + $$(warning *********************************) \ + $$(warning *********************************) \ + $$(warning *********************************) \ + $$(error Aborting generation of $$@)) + $$(MAKE) LU_REC_MASTER="$(1)" LU_REC_FLAVOR="$(2)" LU_REC_TARGET="$$@"\ + LU_WATCH_FILES_SAVE + $$(COMMON_PREFIX)$$(call _lu-do-latex\ + ,$(1),$(2),$$(call lu-getvalue-master,MAIN,$(1)),$(3)) + $$(MAKE) LU_REC_MASTER="$(1)" LU_REC_FLAVOR="$(2)" LU_REC_TARGET="$$@"\ + LU_WATCH_FILES_RESTORE + $$(MAKE) LU_REC_MASTER="$(1)" LU_REC_FLAVOR="$(2)" LU_REC_TARGET="$$@"\ + $(1)$(3)_NEED_REBUILD +ifneq ($(LU_REC_TARGET),) + $(1)$(3)_NEED_REBUILD_IN_PROGRESS: + $$(COMMON_HIDE)touch $(1)$(3)_NEED_REBUILD_IN_PROGRESS + $$(addprefix LU_rebuild_,$$(call lu-getvalues,REBUILD_RULES,$(1),$(2))): \ + $(1)$(3)_NEED_REBUILD_IN_PROGRESS +.PHONY: $(1)$(3)_NEED_REBUILD + $(1)$(3)_NEED_REBUILD: \ + $(1)$(3)_NEED_REBUILD_IN_PROGRESS \ + $$(addprefix LU_rebuild_,$$(call lu-getvalues,REBUILD_RULES,$(1),$(2))) + $$(COMMON_HIDE)$(RM) $(1)$(3)_NEED_REBUILD_IN_PROGRESS + $$(COMMON_HIDE)if [ -f "$(1)$(3)_NEED_REBUILD" ];then\ + echo "********************************************" ;\ + echo "*********** New build needed ***************" ;\ + echo "********************************************" ;\ + cat "$(1)$(3)_NEED_REBUILD" ; \ + echo "********************************************" ;\ + fi + $$(MAKE) LU_REC_LEVEL=$$(shell expr $$(LU_REC_LEVEL) + 1) \ + $$(LU_REC_TARGET) +endif + clean-build-fig:: + $$(call lu-clean,$$(foreach fig, \ + $$(basename $$(wildcard $$(filter %.fig, \ + $$(call lu-getvalues,FIGURES,$(1),$(2))))), \ + $$(addprefix $$(fig),$$(call lu-getvalues-flavor,CLEANFIGEXT,$(2))))) + $$(call lu-clean,$$(foreach svg, \ + $$(basename $$(wildcard $$(filter %.svg, \ + $$(call lu-getvalues,FIGURES,$(1),$(2))))), \ + $$(addprefix $$(svg),$$(call lu-getvalues-flavor,CLEANSVGEXT,$(2))))) + clean:: clean-build-fig + $$(call lu-clean,$$(call lu-getvalues,OUTPUTS,$(1),$(2)) \ + $$(call lu-getvalues,BBLFILES,$(1),$(2)) \ + $$(addsuffix .mk,$$(call lu-getvalues,SUBFIGS,$(1),$(2))) \ + $$(patsubst %.bbl,%.blg,$$(call lu-getvalues,BBLFILES,$(1),$(2)))) + $$(call lu-clean,$$(wildcard $(1).log)) + distclean:: + $$(call lu-clean,$$(wildcard $(1)$(3) $(1)$(3)_FAILED \ + $(1)$(3)_NEED_REBUILD $(1)$(3)_NEED_REBUILD_IN_PROGRESS)) + $$(foreach type,$$(call lu-getvalues,INDEXES,$(1),$(2)), \ + $$(foreach index,$$(call lu-getvalues,INDEXES_$$(type),$(1),$(2)), \ + $$(eval $$(call lu-master-texflavor-index-rules,$(1),$(2),$$(type),$$(index),$(3))))) +endef #################################################### +define lu-master-texflavor # MASTER FLAVOR ext(.dvi/.pdf) + $$(eval $$(call lu-master-texflavor-vars,$(1),$(2),$(3))) + $$(eval $$(call lu-master-texflavor-rules,$(1),$(2),$(3))) +endef +########################################################## + +########################################################## +define lu-master-dviflavor-vars # MASTER FLAVOR ext(.ps) + $$(call lu-show-rules,Setting flavor vars for \ + $(1)/$(2)/$$(call lu-getvalue-flavor,DEPFLAVOR,$(2))) +# $$(eval $$(call lu-addvar,VARPROG,$(1),$(2))) +# $$(eval $$(call lu-addvar,$$(call lu-getvalue,VARPROG,$(1),$(2)),$(1),$(2))) + $$(eval $$(call lu-addtovar-flavor,TARGETS,$(2),$(1)$(3))) +endef #################################################### +define lu-master-dviflavor-rules # MASTER FLAVOR ext(.ps) + $$(call lu-show-rules,Defining flavor rules for \ + $(1)/$(2)/$$(call lu-getvalue-flavor,DEPFLAVOR,$(2))) + $(1)$(3): %$(3): %$$(call lu-getvalue-flavor,EXT,$$(call lu-getvalue-flavor,DEPFLAVOR,$(2))) + $$(call lu-call-prog-flavor,$(1),$(2)) -o $$@ $$< + distclean:: + $$(call lu-clean,$$(wildcard $(1)$(3))) +endef #################################################### +define lu-master-dviflavor # MASTER FLAVOR ext(.ps) + $$(eval $$(call lu-master-dviflavor-vars,$(1),$(2),$(3))) + $$(eval $$(call lu-master-dviflavor-rules,$(1),$(2),$(3))) +endef +########################################################## + +########################################################## +define lu-master-vars # MASTER + $$(call lu-show-rules,Setting vars for $(1)) + $$(eval $$(call lu-setvar-master,MAIN,$(1),$(1).tex)) + $$(eval $$(call lu-addtovar-master,DEPENDS,$(1),\ + $$(call lu-getvalue-master,MAIN,$(1)))) + _LU_$(1)_DVI_FLAVORS=$$(filter $$(_LU_FLAVORS_DEFINED_DVI),\ + $$(sort $$(call lu-getvalues-master,FLAVORS,$(1)))) + _LU_$(1)_TEX_FLAVORS=$$(filter $$(_LU_FLAVORS_DEFINED_TEX),\ + $$(sort $$(call lu-getvalues-master,FLAVORS,$(1)) \ + $$(LU_REC_FLAVOR) \ + $$(foreach dvi,$$(call lu-getvalues-master,FLAVORS,$(1)), \ + $$(call lu-getvalue-flavor,DEPFLAVOR,$$(dvi))))) + $$(foreach flav,$$(_LU_$(1)_TEX_FLAVORS), $$(eval $$(call \ + lu-master-texflavor-vars,$(1),$$(flav),$$(call lu-getvalue-flavor,EXT,$$(flav))))) + $$(foreach flav,$$(_LU_$(1)_DVI_FLAVORS), $$(eval $$(call \ + lu-master-dviflavor-vars,$(1),$$(flav),$$(call lu-getvalue-flavor,EXT,$$(flav))))) +endef #################################################### +define lu-master-rules # MASTER + $$(call lu-show-rules,Defining rules for $(1)) + $$(foreach flav,$$(_LU_$(1)_TEX_FLAVORS), $$(eval $$(call \ + lu-master-texflavor-rules,$(1),$$(flav),$$(call lu-getvalue-flavor,EXT,$$(flav))))) + $$(foreach flav,$$(_LU_$(1)_DVI_FLAVORS), $$(eval $$(call \ + lu-master-dviflavor-rules,$(1),$$(flav),$$(call lu-getvalue-flavor,EXT,$$(flav))))) +endef #################################################### +define lu-master # MASTER + $$(eval $$(call lu-master-vars,$(1))) + $$(eval $$(call lu-master-rules,$(1))) +endef +########################################################## + +#$(warning $(call LU_RULES,example)) +$(eval $(call lu-addtovar-global,MASTERS,\ + $$(shell grep -l '\\documentclass' *.tex 2>/dev/null | sed -e 's/\.tex$$$$//'))) +ifneq ($(LU_REC_TARGET),) +_LU_DEF_MASTERS = $(LU_REC_MASTER) +_LU_DEF_FLAVORS = $(LU_REC_FLAVOR) $(FLAV_DEPFLAVOR_$(LU_REC_FLAVOR)) +else +_LU_DEF_MASTERS = $(call lu-getvalues-global,MASTERS) +_LU_DEF_FLAVORS = $(sort $(foreach master,$(_LU_DEF_MASTERS),\ + $(call lu-getvalues-master,FLAVORS,$(master)))) +endif + +$(foreach flav, $(_LU_DEF_FLAVORS), $(eval $(call lu-define-flavor,$(flav)))) +$(foreach master, $(_LU_DEF_MASTERS), $(eval $(call lu-master-vars,$(master)))) +$(foreach flav, $(_LU_FLAVORS_DEFINED), $(eval $(call lu-flavor-rules,$(flav)))) +$(foreach master, $(_LU_DEF_MASTERS), $(eval $(call lu-master-rules,$(master)))) + +##################################################################"" +# Gestion des subfigs + +%<<MAKEFILE +%.subfig.mk: %.subfig %.fig + $(COMMON_PREFIX)$(call lu-call-prog,GENSUBFIG) \ + -p '$$(COMMON_PREFIX)$(call lu-call-prog,FIGDEPTH) < $$< > $$@' \ + -s $*.subfig $*.fig < $^ > $@ +%MAKEFILE + +%<<MAKEFILE +%.subfig.mk: %.subfig %.svg + $(COMMON_PREFIX)$(call lu-call-prog,GENSUBSVG) \ + -p '$$(COMMON_PREFIX)$(call lu-call-prog,SVGDEPTH) < $$< > $$@' \ + -s $*.subfig $*.svg < $^ > $@ +%MAKEFILE + +clean:: + $(call lu-clean,$(FIGS2CREATE_LIST)) + $(call lu-clean,$(FIGS2CREATE_LIST:%.fig=%.pstex)) + $(call lu-clean,$(FIGS2CREATE_LIST:%.fig=%.pstex_t)) + $(call lu-clean,$(FIGS2CREATE_LIST:%.fig=%.$(_LU_PDFTEX_EXT))) + $(call lu-clean,$(FIGS2CREATE_LIST:%.fig=%.pdftex_t)) + $(call lu-clean,$(FIGS2CREATE_LIST:%.svg=%.pstex)) + $(call lu-clean,$(FIGS2CREATE_LIST:%.svg=%.pstex_t)) + $(call lu-clean,$(FIGS2CREATE_LIST:%.svg=%.$(_LU_PDFTEX_EXT))) + $(call lu-clean,$(FIGS2CREATE_LIST:%.svg=%.pdftex_t)) + +.PHONY: LU_FORCE clean distclean +LU_FORCE: + @echo "Previous compilation failed. Rerun needed" + +#$(warning $(MAKEFILE)) + +distclean:: clean + +%<<MAKEFILE +%.eps: %.fig + $(COMMON_PREFIX)$(call lu-call-prog,FIG2DEV) -L eps $< $@ + +%.pdf: %.fig + $(COMMON_PREFIX)$(call lu-call-prog,FIG2DEV) -L pdf $< $@ + +%.pstex: %.fig + $(COMMON_PREFIX)$(call lu-call-prog,FIG2DEV) -L pstex $< $@ + +%.pstex: %.svg + $(COMMON_PREFIX)$(call lu-call-prog,SVG2DEV) -L pstex $< $@ + + +.PRECIOUS: %.pstex +%.pstex_t: %.fig %.pstex + $(COMMON_PREFIX)$(call lu-call-prog,FIG2DEV) -L pstex_t -p $*.pstex $< $@ + +%.pstex_t: %.svg %.pstex + $(COMMON_PREFIX)$(call lu-call-prog,SVG2DEV) -L pstex_t -p $*.pstex $< $@ + + +%.$(_LU_PDFTEX_EXT): %.fig + $(COMMON_PREFIX)$(call lu-call-prog,FIG2DEV) -L pdftex $< $@ + +%.$(_LU_PDFTEX_EXT): %.svg + $(COMMON_PREFIX)$(call lu-call-prog,SVG2DEV) -L pdftex $< $@ + +.PRECIOUS: %.$(_LU_PDFTEX_EXT) +%.pdftex_t: %.fig %.$(_LU_PDFTEX_EXT) + $(COMMON_PREFIX)$(call lu-call-prog,FIG2DEV) -L pdftex_t -p $*.$(_LU_PDFTEX_EXT) $< $@ + +%.pdftex_t: %.svg %.$(_LU_PDFTEX_EXT) + $(COMMON_PREFIX)$(call lu-call-prog,SVG2DEV) -L pdftex_t -p $*.$(_LU_PDFTEX_EXT) $< $@ + +%.pdf: %.eps + $(COMMON_PREFIX)$(call lu-call-prog,EPSTOPDF) --filter < $< > $@ +%MAKEFILE + +######################################################################### +# Les flavors +LU_REC_LEVEL ?= 1 +ifneq ($(LU_REC_TARGET),) +export LU_REC_FLAVOR +export LU_REC_MASTER +export LU_REC_TARGET +export LU_REC_LEVEL +LU_REC_LOGFILE=$(LU_REC_MASTER).log +LU_REC_GENFILE=$(LU_REC_MASTER)$(call lu-getvalue-flavor,EXT,$(LU_REC_FLAVOR)) + +lu-rebuild-head=$(info *** Checking rebuild with rule '$(subst LU_rebuild_,,$@)') +lu-rebuild-needed=echo $(1) >> "$(LU_REC_GENFILE)_NEED_REBUILD" ; + +.PHONY: $(addprefix LU_rebuild_,latex texdepends bibtex) +LU_rebuild_latex: + $(call lu-rebuild-head) + $(COMMON_HIDE)if grep -sq 'Rerun to get'\ + "$(LU_REC_LOGFILE)" ; then \ + $(call lu-rebuild-needed\ + ,"$@: new run needed (LaTeX message 'Rerun to get...')") \ + fi + +LU_rebuild_texdepends: + $(call lu-rebuild-head) + $(COMMON_HIDE)if grep -sq '^Package texdepends Warning: .* Check dependencies again.$$'\ + "$(LU_REC_LOGFILE)" ; then \ + $(call lu-rebuild-needed,"$@: new depends required") \ + fi + +LU_rebuild_bibtopic: + $(call lu-rebuild-head) +%</makefile> +% \end{macrocode} +% This part is not needed: already checked with the |lu_rebuild_latex| rule +% \begin{macrocode} +%<*notused> + $(COMMON_HIDE)if grep -sq 'Rerun to get indentation of bibitems right'\ + "$(LU_REC_LOGFILE)" ; then \ + $(call lu-rebuild-needed,"$@: new run needed") \ + fi + $(COMMON_HIDE)if grep -sq 'Rerun to get cross-references right'\ + "$(LU_REC_LOGFILE)" ; then \ + $(call lu-rebuild-needed,"$@: new run needed") \ + fi +%</notused> +%<*makefile> + $(COMMON_HIDE)sed -e '/^Package bibtopic Warning: Please (re)run BibTeX on the file(s):$$/,/^(bibtopic) *and after that rerun LaTeX./{s/^(bibtopic) *\([^ ]*\)$$/\1/p};d' \ + "$(LU_REC_LOGFILE)" | while read file ; do \ + touch $$file.aux ; \ + $(call lu-rebuild-needed,"bibtopic: $$file.bbl outdated") \ + done + +LU_rebuild_bibtopic_undefined_references: + $(call lu-rebuild-head) + $(COMMON_HIDE)if grep -sq 'There were undefined references'\ + "$(MASTER_$(LU_REC_MASTER)).log" ; then \ + $(call lu-rebuild-needed,"$@: new run needed") \ + fi + +.PHONY: LU_WATCH_FILES_SAVE LU_WATCH_FILES_RESTORE +LU_WATCH_FILES_SAVE: + $(COMMON_HIDE)$(foreach file, $(sort \ + $(call lu-getvalues,WATCHFILES,$(LU_REC_MASTER),$(LU_REC_FLAVOR))), \ + $(call lu-save-file,$(file),$(file).orig);) + +LU_WATCH_FILES_RESTORE: + $(COMMON_HIDE)$(foreach file, $(sort \ + $(call lu-getvalues,WATCHFILES,$(LU_REC_MASTER),$(LU_REC_FLAVOR))), \ + $(call lu-cmprestaure-file,"$(file)","$(file).orig",\ + echo "New $(file) file" >> $(LU_REC_GENFILE)_NEED_REBUILD;\ + );) + +endif + +%<<MAKEFILE +%.bbl: %.aux + $(COMMON_PREFIX)$(call lu-call-prog,BIBTEX) $* +%MAKEFILE +%</makefile> +% \end{macrocode} +% \subsection{LaTeX.mk.conf} +% \begin{macrocode} +%<*makefile-config> +# Choose between GNU/BSD utilities (cp, rm, ...) +# LU_UTILS = GNU +# LU_UTILS = BSD +%</makefile-config> +% \end{macrocode} +% \subsection{figdepth} +% +% \begin{macrocode} +%<*figdepth> +#!/usr/bin/env python +#coding=utf8 + +""" + +stdin : the original xfig file +stdout : the output xfig file +args : all depths we want to keep + +""" + +import optparse +import os.path +import sys + +def main(): + parser = optparse.OptionParser() + (options, args) = parser.parse_args() + + depths_to_keep = set() + for arg in args: + depths_to_keep.add(arg) + + comment = '' + display = True + def show(depth, line): + if depth in depths_to_keep: + print comment+line, + return True + else: + return False + for line in sys.stdin: + if line[0] == '#': + comment += line + continue + if line[0] in "\t ": + if display: + print line + else: + Fld = line.split(' ', 9999) + if not Fld[0] or Fld[0] not in ('1', '2', '3', '4', '5'): + print comment+line + display = True + elif Fld[0] == '4': + display = show(Fld[3], line) + else: + display = show(Fld[6], line) + comment = '' + +if __name__ == "__main__": + main() +%</figdepth> +% \end{macrocode} +% \subsection{gensubfig} +% \begin{macrocode} +%<*gensubfig> +#!/usr/bin/env python +#coding=utf8 + +""" + +Arguments passes : + - fichier image (image.fig ou image.svg) + - -s fichier subfig (image.subfig) + - -p chemin du script pour generer les sous-images (svgdepth.py ou figdepth.py) + +Sortie standard : + - makefile pour creer les sous-images (au format .fig ou .svg), et pour les supprimer + +""" + +from optparse import OptionParser +import os.path + +def main(): + parser = OptionParser(usage='usage: %prog [options] svg file', description='Creates a\ +Makefile generating subfigures using figdepth.py or svgdepth.py') + parser.add_option("-s", "--subfig", dest="subfig", help="subfig file") + parser.add_option("-p", "--depth", dest="depth", help="full path of depth script") + (options, args) = parser.parse_args() + if len(args) < 1: + parser.error("incorrect number of arguments") + if not options.subfig: + parser.error("no subfig file specified") + if not options.depth: + parser.error("no depth script specified") + + (root, ext) = os.path.splitext(args[0]) + sf_name = options.subfig + ds_name = options.depth + varname = '%s_FIGS' % root.upper() + + subfigs = [] + for line in open(options.subfig, 'r'): + t = line.find('#') # looking for comments + if t > -1: line = line[0:t] # remove comments... + line = line.strip() #remove blank chars + if line == '': continue + subfigs.append(line) + + count = 1 + for subfig in subfigs: + print "%s_%d%s: %s%s %s" % (root, count, ext, root, ext, sf_name) + print "\t%s %s" % (ds_name, subfig) + print "" + count += 1 + print "%s := $(foreach n, " % varname, + count = 1 + for subfig in subfigs: + print '%d ' % count, + count += 1 + print ", %s_$(n)%s)" % (root, ext) + print "FILES_TO_DISTCLEAN += $(%s)" % varname + print "FIGS2CREATE_LIST += $(%s)" % varname + print "$(TEMPORAIRE): $(%s)" % varname + print "$(TEMPORAIRE): $(%s)" % varname + +if __name__ == "__main__": + main() +%</gensubfig> +% \end{macrocode} +% \subsection{svg2dev} +% \begin{macrocode} +%<*svg2dev> +#!/usr/bin/env python +#coding=utf8 + +from optparse import OptionParser +import shutil +import subprocess + + +svg2eps = 'inkscape %s -z -C --export-eps=%s --export-latex' +svg2pdf = 'inkscape %s -z -C --export-pdf=%s --export-latex' + + +def create_image(input_filename, output_filename, mode): + subprocess.Popen(mode % (input_filename, output_filename), + stdout=subprocess.PIPE, shell=True).communicate()[0] + n1 = output_filename + '_tex' + n2 = output_filename + '_t' + shutil.move(n1, n2) + + +def main(): + parser = OptionParser() + parser.add_option("-L", "--format", dest="outputFormat", + metavar="FORMAT", help="output format", default="spstex") + parser.add_option("-p", "--portrait", dest="portrait", help="dummy arg") + (options, args) = parser.parse_args() + if len(args) != 2: return + (input_filename, output_filename) = args + fmt = options.outputFormat + portrait = options.portrait + + if fmt == 'eps': + create_image(input_filename, output_filename, svg2eps) + elif fmt == 'spstex' or fmt == 'pstex': + create_image(input_filename, output_filename, svg2eps) + elif fmt == 'spstex_t' or fmt == 'pstex_t': + pass + elif fmt == 'spdftex' or fmt == 'pdftex': + create_image(input_filename, output_filename, svg2pdf) + elif fmt == 'spdftex_t' or fmt == 'pdftex_t': + pass + + +if __name__ == "__main__": + main() + +%</svg2dev> +% \end{macrocode} +% \subsection{latexfilter} +% |latexfilter.py| is a small python program that hides most of the output +% of \TeX/\LaTeX{} output. It only display info, warnings, errors +% and underfull/overfull hbox/vbox. +% \begin{macrocode} +%<*latexfilter> +#!/usr/bin/env python +#coding=utf8 + +""" + +stdin : the original xfig file +stdout : the output xfig file +args : all depths we want to keep + +""" + +from __future__ import print_function +import optparse +import os.path +import re +import sys + +def main(): + parser = optparse.OptionParser() + (options, args) = parser.parse_args() + + display = 0 + in_display = 0 + start_line = '' + warnerror_re = re.compile(r"^(LaTeX|Package|Class)( (.*))? (Warning:|Error:)") + fullbox_re = re.compile(r"^(Underfull|Overfull) \\[hv]box") + accu = '' + for line in sys.stdin: + if display > 0: + display -= 1 + if line[0:4].lower() in ('info', 'warn') or line[0:5].lower() == 'error': + display = 0 + line_groups = warnerror_re.match(line) + if line_groups: + start_line = line_groups.group(3) + if not start_line: + start_line = '' + if line_groups.group(2): + start_line = "(" + start_line + ")" + display = 1 + in_display = 1 + elif (start_line != '') and (line[0:len(start_line)] == start_line): + display = 1 + elif line == "\n": + in_display = 0 + elif line[0:4] == 'Chap': + display = 1 + elif fullbox_re.match(line): + display = 2 + if display: + print(accu, end="") + accu = line + elif in_display: + print(accu[0:-1], end="") + accu = line + +if __name__ == "__main__": + main() + +%</latexfilter> +% \end{macrocode} +% \subsection{svgdepth} +% \begin{macrocode} +%<*svgdepth> +#!/usr/bin/env python +#coding=utf8 + +import sys +import xml.parsers.expat + + +layers = [] +for arg in sys.argv: + layers.append(arg) + +parser = xml.parsers.expat.ParserCreate() +class XmlParser(object): + def __init__(self, layers): + self.state_stack = [True] + self.last_state = True + self.layers = layers + def XmlDeclHandler(self, version, encoding, standalone): + sys.stdout.write("<?xml version='%s' encoding='%s'?>\n" % (version, encoding)) + def StartDoctypeDeclHandler(self, doctypeName, systemId, publicId, has_internal_subset): + if publicId != None: sys.stdout.write("<!DOCTYPE %s PUBLIC \"%s\" \"%s\">\n" %\ + (doctypeName, publicId, systemId)) + else: sys.stdout.write("<!DOCTYPE %s \"%s\">\n" % (doctypeName, systemId)) + def StartElementHandler(self, name, attributes): + if name.lower() == 'g': + r = self.last_state and ('id' not in attributes or \ + attributes['id'] in self.layers) + self.last_state = r + self.state_stack.append(r) + if not self.last_state: return + s = "" + for k, v in attributes.items(): s += ' %s="%s"' % (k, v) + sys.stdout.write("<%s%s>" % (name, s)) + def EndElementHandler(self, name): + r = self.last_state + if name.lower() == 'g': + self.state_stack = self.state_stack[0:-1] + self.last_state = self.state_stack[-1] + if not r: return + sys.stdout.write("</%s>" % (name)) + def CharacterDataHandler(self, data): + if not self.last_state: return + sys.stdout.write(data) + +my_parser = XmlParser(layers) + +parser.XmlDeclHandler = my_parser.XmlDeclHandler +parser.StartDoctypeDeclHandler = my_parser.StartDoctypeDeclHandler +parser.StartElementHandler = my_parser.StartElementHandler +parser.EndElementHandler = my_parser.EndElementHandler +parser.CharacterDataHandler = my_parser.CharacterDataHandler + +for line in sys.stdin: + parser.Parse(line, False) +parser.Parse('', True) + + +%</svgdepth> +% \end{macrocode} +% \Finale +\endinput diff --git a/Master/texmf-dist/source/support/latex-make/latex-make.ins b/Master/texmf-dist/source/support/latex-make/latex-make.ins new file mode 100644 index 00000000000..b00b11e4e48 --- /dev/null +++ b/Master/texmf-dist/source/support/latex-make/latex-make.ins @@ -0,0 +1,68 @@ +\NeedsTeXFormat{LaTeX2e} +\ProvidesFile{latex-make.ins}[2005/03/28 v1.1 Installation script for latex-make package] + +\def\batchfile{latex-make.ins} +\input docstrip + +\ifx\generate\undefined + \Msg{**********************************************} + \Msg{* This installation requires docstrip} + \Msg{* version 2.4 or later.} + \Msg{* An older version of docstrip has been input} + \Msg{**********************************************} + \errhelp{Move or rename old docstrip.tex and get a newer one.} + \errmessage{Old docstrip in input path} + \batchmode + \csname @@end\endcsname\end +\fi + +\askforoverwritefalse +\keepsilent + +\catcode`\^^I=12 +\generate{ + \file{figlatex.sty}{\from{figlatex.dtx}{package}} + \file{figlatex.cfg}{\from{figlatex.dtx}{config}} + \file{texgraphicx.sty}{\from{figlatex.dtx}{compat}} + \file{pdfswitch.sty}{\from{pdfswitch.dtx}{package}} + \file{texdepends.sty}{\from{texdepends.dtx}{package}} + \nopreamble + \nopostamble + \file{LaTeX.mk}{\from{latex-make.dtx}{makefile}} + \file{LaTeX.mk.conf}{\from{latex-make.dtx}{makefile-config}} + \file{figdepth.py}{\from{latex-make.dtx}{figdepth}} + \file{gensubfig.py}{\from{latex-make.dtx}{gensubfig}} + \file{latexfilter.py}{\from{latex-make.dtx}{latexfilter}} + \file{svg2dev.py}{\from{latex-make.dtx}{svg2dev}} + \file{svgdepth.py}{\from{latex-make.dtx}{svgdepth}} +} +\catcode`\^^I=10 + +\Msg{***************************************************************} +\Msg{*} +\Msg{* \space Copy the files listed below into a TeX searchable directory.} +\Msg{* \@spaces figlatex.sty} +\Msg{* \@spaces figlatex.cfg} +\Msg{* \@spaces texgraphicx.sty} +\Msg{* \@spaces pdfswitch.sty} +\Msg{* \@spaces texdepends.sty} +\Msg{* \space Copy the files listed below into a Make searchable directory} +\Msg{* \space (as /usr/include or current directory)} +\Msg{* \@spaces LaTeX.mk} +\Msg{* \space Make executable the files listed below and install them in the current} +\Msg{* \space directory, in a 'bin' subdirectory, in a scripts directory of a searchable} +\Msg{* \space TeX Directory Structure, or in your PATH} +\Msg{* \@spaces figdepth.py} +\Msg{* \@spaces gensubfig.py} +\Msg{* \@spaces latexfilter.py} +\Msg{* \@spaces svg2dev.py} +\Msg{* \@spaces svgdepth.py} +\Msg{*} +\Msg{* \space To get latex-make documentation,} +\Msg{* \@spaces make doc (for A4 PDF) or} +\Msg{* \@spaces make dvi.} +\Msg{*} +\Msg{***************************************************************} + +\endinput + diff --git a/Master/texmf-dist/source/support/latex-make/pdfswitch.dtx b/Master/texmf-dist/source/support/latex-make/pdfswitch.dtx new file mode 100644 index 00000000000..ef63c39f5ed --- /dev/null +++ b/Master/texmf-dist/source/support/latex-make/pdfswitch.dtx @@ -0,0 +1,127 @@ +%<*package> +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% SWITCH FOR PDFLATEX or LATEX +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% +\def\fileversion{0.0.2} +\def\filedate{2003/07/12} + +\NeedsTeXFormat{LaTeX2e} + +\ProvidesPackage% +{pdfswitch}% +[\filedate\space Automatic switch between pdf and ps. v\fileversion] + +\RequirePackage{ae,aeguill} +\RequirePackage{color} +\RequirePackage{ifthen} +\RequirePackage{ifpdf} + +\newboolean{nocolor@pdfswitch} +\setboolean{nocolor@pdfswitch}{false} +\DeclareOption{nocolor}{\setboolean{nocolor@pdfswitch}{true}} +\newboolean{backref@pdfswitch} +\setboolean{backref@pdfswitch}{false} +\DeclareOption{backref}{\setboolean{backref@pdfswitch}{true}} +\newboolean{pagebackref@pdfswitch} +\setboolean{pagebackref@pdfswitch}{false} +\DeclareOption{pagebackref}{\setboolean{pagebackref@pdfswitch}{true}} +\newboolean{noborder@pdfswitch} +\setboolean{noborder@pdfswitch}{false} +\DeclareOption{noborder}{\setboolean{noborder@pdfswitch}{true}} +\newboolean{plainpages@pdfswitch} +\setboolean{plainpages@pdfswitch}{false} +\DeclareOption{plainpages}{\setboolean{plainpages@pdfswitch}{true}} + +\ProcessOptions + +\definecolor{pdfurlcolor}{rgb}{0,0,0.6} +\definecolor{pdfcitecolor}{rgb}{0,0.6,0} +\definecolor{pdflinkcolor}{rgb}{0.6,0,0} + + %%%%%%%%%%%%%%%%%%%%%%%%% graphicx and thumbpdf %%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\ifpdf +\usepackage[pdftex]{graphicx} %%% graphics for pdfLaTeX +\DeclareGraphicsExtensions{.pdf} %%% standard extension for included graphics +\usepackage[pdftex]{thumbpdf} %%% thumbnails for pdflatex +\else +\usepackage[dvips]{graphicx} %%% graphics for dvips +\DeclareGraphicsExtensions{.eps} %%% standard extension for included graphics +%\usepackage[ps2pdf]{thumbpdf} %%% thumbnails for ps2pdf +\fi + +%%%%%%%%%%%%%%%%%%%%%%%%% Basic options for hyperref %%%%%%%%%%%%%%%%%%%%%%%%% +\ifpdf +\edef\keys@pdfswitch{% + pdftex, %%% hyper-references for pdflatex + bookmarks=true,% %%% generate bookmarks ... + bookmarksnumbered=true,% %%% ... with numbers + hypertexnames=false,% %%% needed for correct links to figures !!! + breaklinks=true% %%% break links if exceeding a single line +} +\else +\edef\keys@pdfswitch{% + ps2pdf, %%% hyper-references for ps2pdf + bookmarks=true,% %%% generate bookmarks ... + bookmarksnumbered=true,% %%% ... with numbers + hypertexnames=false,% %%% needed for correct links to figures !!! + breaklinks=true,% %%% breaks lines, but links are very small + pdfborder={0 0 11.0} %%% border-width of frames will + %%% be multiplied with 0.009 by ps2pdf +} +\fi + +\ifthenelse{\boolean{nocolor@pdfswitch}}{% + \edef\keys@pdfswitch{\keys@pdfswitch,colorlinks=false}% +}{ + \edef\keys@pdfswitch{\keys@pdfswitch,colorlinks=true,% + citecolor=pdfcitecolor, + urlcolor=pdfurlcolor, + linkcolor=pdflinkcolor, + linkbordercolor={1 1 1}}% +} + +\ifthenelse{\boolean{plainpages@pdfswitch}}{% +}{ + \edef\keys@pdfswitch{\keys@pdfswitch,plainpages=false}% +} + +\ifthenelse{\boolean{noborder@pdfswitch}}{% + \edef\keys@pdfswitch{\keys@pdfswitch,pdfborder={0 0 0}}% +}{} + +\ifthenelse{\boolean{backref@pdfswitch}}{% + \edef\keys@pdfswitch{\keys@pdfswitch,backref}% +}{} + +\ifthenelse{\boolean{pagebackref@pdfswitch}}{% + \edef\keys@pdfswitch{\keys@pdfswitch,pagebackref}% +}{} + +\usepackage[\keys@pdfswitch]{hyperref} + +%%%%%%%%%%%%%%%%%%%%%%%%% HyperSetup %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\ifpdf +\AtBeginDocument{ + \hypersetup{ + pdfauthor = {\@author}, + pdftitle = {\@title}, + pdfsubject = {\@ifundefined{@subject}{}{\@subject}}, + pdfkeywords = {\@ifundefined{@keywords}{}{\@keywords}} + } +} +%%% pdfcreator, pdfproducer, and Creation Date are automatically set by pdflatex !!! +\pdfadjustspacing=1 %%% force LaTeX-like character spacing +\else +\AtBeginDocument{ +% \hypersetup{ +% pdfauthor = {\@author}, +% pdftitle = {\@title}, +% pdfsubject = {\@ifundefined{@subject}{}{\@subject}}, +% pdfkeywords = {\@ifundefined{@keywords}{}{\@keywords}}, +% pdfcreator = {LaTeX with hyperref package}, +% pdfproducer = {dvips + ps2pdf} +% } +} +\fi +%</package>
\ No newline at end of file diff --git a/Master/texmf-dist/source/support/latex-make/texdepends.dtx b/Master/texmf-dist/source/support/latex-make/texdepends.dtx new file mode 100644 index 00000000000..0a9d0b645ad --- /dev/null +++ b/Master/texmf-dist/source/support/latex-make/texdepends.dtx @@ -0,0 +1,1037 @@ +% \iffalse meta-comment +%% +%% File: texdepends.dtx Copyright (C) 2004--2011 V. Danjean +%% Vincent.Danjean@ens-lyon.org +%% Modified by Matthieu Gallet +%% Matthieu.Gallet@ens-lyon.org +%% +%% This program is free software; you can redistribute it and/or +%% modify it under the terms of the GNU General Public License +%% as published by the Free Software Foundation; either version 2 +%% of the License, or (at your option) any later version. +%% +%% This program is distributed in the hope that it will be useful, +%% but WITHOUT ANY WARRANTY; without even the implied warranty of +%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +%% GNU General Public License for more details. +%% +%% You should have received a copy of the GNU General Public License +%% along with this program; if not, write to the Free Software +%% Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +%% +% +%<*dtx> + \ProvidesFile{texdepends.dtx} +%</dtx> +%<package>\NeedsTeXFormat{LaTeX2e}% +%<package>\ProvidesPackage{texdepends}% +% \fi +% \ProvidesFile{texdepends.dtx} +[2008/01/28\space Automatic depends generation. v1.2.0] +% \iffalse +%<*driver> +\documentclass{ltxdoc} +\usepackage[latin1]{inputenc} +\usepackage[french,english]{babel} +\usepackage{pdfswitch} +\NoAutoSpaceBeforeFDP +\EnableCrossrefs +\CodelineIndex +\RecordChanges +\setcounter{IndexColumns}{2} % make a twocolumn index +\setlength{\columnseprule}{0pt} % no rules between columns ... +\setlength{\columnsep}{2em} % ... but more spacing instead. +\setcounter{unbalance}{4} +\setlength{\IndexMin}{100pt} +%%%%\OnlyDescription % uncomment this line to suppress printing the source code +\makeatletter +% don't show underfull hboxes in index/glossary: +\g@addto@macro{\IndexParms}{\hbadness=10000} +\g@addto@macro{\GlossaryParms}{\hbadness=10000} +\makeatother +\begin{document} + \DocInput{texdepends.dtx} + \PrintIndex + \PrintChanges +\end{document} +%</driver> +% \fi +% +% \GetFileInfo{texdepends.dtx} +% +% \DoNotIndex{\#,\$,\%,\&,\@,\\,\{,\},\^,\_,\~,\ } +% \DoNotIndex{\def,\long,\edef,\xdef,\gdef,\let,\global} +% \DoNotIndex{\if,\ifnum,\ifdim,\ifcat,\ifmmode,\ifvmode,\ifhmode,% +% \iftrue,\iffalse,\ifvoid,\ifx,\ifeof,\ifcase,\else,\or,\fi,\loop,\do} +% \DoNotIndex{\box,\copy,\setbox,\unvbox,\unhbox,\hbox,% +% \vbox,\vtop,\vcenter} +% \DoNotIndex{\@empty,\immediate,\write} +% \DoNotIndex{\egroup,\bgroup,\expandafter,\begingroup,\endgroup} +% \DoNotIndex{\divide,\advance,\multiply,\count,\dimen} +% \DoNotIndex{\relax,\space,\string} +% \DoNotIndex{\csname,\endcsname,\@spaces,\openin,\openout,% +% \closein,\closeout} +% \DoNotIndex{\catcode,\endinput} +% \DoNotIndex{\jobname,\message,\read,\the,\noexpand} +% \DoNotIndex{\hsize,\vsize,\hskip,\vskip,\kern,\hfil,\hfill,\hss} +% \DoNotIndex{\m@ne,\z@,\@m,\z@skip,\@ne,\tw@,\p@} +% \DoNotIndex{\DeclareRobustCommand,\DeclareOption,\newcommand,\newcommand*} +% \DoNotIndex{\newcount,\newif,\newlinechar,\newread,\newtoks,\newwrite} +% \DoNotIndex{\dp,\wd,\ht,\vss,\unskip,\ifthenelse} +% +% \DoNotIndex{\@filef@und,\@nameddef,\@tempa} +% \DoNotIndex{\define@key,\equal,\ExecuteOptions} +% \DoNotIndex{\filename@area,\filename@base,\filename@ext,\filename@parse} +% \DoNotIndex{\Gin@exclamation,\Gin@getbase,\Gin@scalex,\Gin@scaley} +% \DoNotIndex{\Gread@eps,\Gread@pdf,\Gscale@box} +% \DoNotIndex{\IfFileExists,\ifpdf,\input,\InputIfFileExists} +% \DoNotIndex{\MessageBreak,\PackageWarning,\PackageWarningNoLine} +% \DoNotIndex{\ProcessOptions,\RequirePackage,\typeout} +% \DoNotIndex{} +% \DoNotIndex{} +% +% \title{The \textsf{texdepends} package\thanks{This file +% has version number \fileversion, last +% revised \filedate.}} +% \author{Vincent \textsc{Danjean}} +% \date{\filedate} +% \maketitle +% \begin{abstract} +% This package allows \LaTeX\space to automatically generate +% dependencies while compiling documents. +% \end{abstract} +% \CheckSum{785} +% +% \changes{v1.0.1}{2005/03/22}{Version 1.0.1 at last} +% \changes{v1.0.2}{2005/10/22}{Add support for package index.sty} +% \changes{v1.1.0}{2005/11/05}{Manage index/glossary} +% \changes{v1.1.0}{2005/11/05}{Rewrite of the package} +% \changes{v1.2.0}{2008/01/28}{Better management of subfig files} +% \changes{v1.3.0}{2011/09/25}{Management of svg files} +% +% \makeatletter +% \def\SpecialOptionIndex#1{\@bsphack +% \index{#1\actualchar{\protect\ttfamily#1} +% (option)\encapchar usage}% +% \index{options:\levelchar{\protect\ttfamily#1}\encapchar +% usage}\@esphack} +% \def\SpecialFileIndex#1{\@bsphack +% \index{#1\actualchar{\protect\ttfamily#1} +% (file)\encapchar usage}% +% \index{files:\levelchar{\protect\ttfamily#1}\encapchar +% usage}\@esphack} +% \def\SpecialMainOptionIndex#1{\@bsphack\special@index{#1\actualchar +% {\string\ttfamily\space#1} +% (option)\encapchar main}% +% \special@index{options:\levelchar{% +% \string\ttfamily\space#1}\encapchar +% main}\@esphack} +% \def\option{\begingroup +% \catcode`\\12 +% \MakePrivateLetters \mym@cro@ \iffalse} +% \long\def\mym@cro@#1#2{\endgroup \topsep\MacroTopsep \trivlist +% \edef\saved@macroname{\string#2}% +% \def\makelabel##1{\llap{##1}}% +% \if@inlabel +% \let\@tempa\@empty \count@\macro@cnt +% \loop \ifnum\count@>\z@ +% \edef\@tempa{\@tempa\hbox{\strut}}\advance\count@\m@ne \repeat +% \edef\makelabel##1{\llap{\vtop to\baselineskip +% {\@tempa\hbox{##1}\vss}}}% +% \advance \macro@cnt \@ne +% \else \macro@cnt\@ne \fi +% \edef\@tempa{\noexpand\item[% +% #1% +% \noexpand\PrintMacroName +% \else +% \noexpand\PrintEnvName +% \fi +% {\string#2}]}% +% \@tempa +% \global\advance\c@CodelineNo\@ne +% #1% +% \SpecialMainIndex{#2}\nobreak +% \DoNotIndex{#2}% +% \else +% \SpecialMainOptionIndex{#2}\nobreak +% \fi +% \global\advance\c@CodelineNo\m@ne +% \ignorespaces} +% \let\endoption \endtrivlist +% \def\DescribeOption{\leavevmode\@bsphack\begingroup\MakePrivateLetters +% \Describe@Option} +% \def\Describe@Option#1{\endgroup +% \marginpar{\raggedleft\PrintDescribeEnv{#1}}% +% \SpecialOptionIndex{#1}\@esphack\ignorespaces} +% \def\DescribeFile{\leavevmode\@bsphack\begingroup\MakePrivateLetters +% \Describe@Option} +% \def\Describe@File#1{\endgroup +% \marginpar{\raggedleft\PrintDescribeEnv{#1}}% +% \SpecialFileIndex{#1}\@esphack\ignorespaces} +% \makeatother +% \MakeShortVerb{\|} +% +% \tableofcontents +% \section{Introduction} +% This package automatically generates dependancies on \LaTeX\ files and +% packages, figures, bibliography files, glossary and index files. The +% generated file is then used by a Makefile to handle dependancies. +% \StopEventually{ +% } +% \section{Implementation of texdepends} +% \subsection{Options} +% \begin{macrocode} +%<*package> +% \end{macrocode} +% |texdepends| is easier to write with the |ifthen| package. +% \begin{macrocode} +\RequirePackage{ifthen} +% \end{macrocode} +% \begin{option}{debug} +% The debug option (enable debug messages, useful for debuging) +% \begin{macrocode} +\newboolean{TD@debug} +\newcommand{\TD@option@debug}[1][true]{% + %\PackageWarningNoLine{texdepends}{Setting debug to #1} + \setboolean{TD@debug}{#1}% +}% +% \end{macrocode} +% \end{option} +% \begin{option}{extension} +% The extension option. We can use it to let |texdepends| +% know whether we compile a dvi or a pdf file. +% \begin{macrocode} +\def\TD@option@extension[#1]{% + %\PackageWarningNoLine{texdepends}{Using extention #1} + \def\TD@extention{#1}% +}% +% \end{macrocode} +% \end{option} +% Managing options with specific code. Using the |keyval| +% package could be a solution, but this would add one more dependency. +% \begin{macrocode} +\def\TD@option@split#1=#2=#3\relax{% + \def\TD@option@name{#1}% + \ifx\TD@option@name\@empty\else + \expandafter\let\expandafter\TD@option@cmd + \csname TD@option@\TD@option@name\endcsname + %\PackageWarningNoLine{texdepends}{1: '#1', 2: '#2', 3: '#3'} + \ifx\TD@option@cmd\relax + \@unknownoptionerror% + \else + \ifx\@empty#3\@empty + \TD@option@cmd\relax% + \else + \def\TD@option@value{#2}% + \TD@option@cmd[\TD@option@value]% + \fi + \fi + \fi +}% +% \end{macrocode} +% All option are managed by the same code. +% \begin{macrocode} +\DeclareOption*{% + %\PackageWarningNoLine{texdepends}{Option \CurrentOption}% + \expandafter\TD@option@split\CurrentOption==\relax% +}% +% \end{macrocode} +% So lets process options +% \begin{macrocode} +\ProcessOptions +% \end{macrocode} +% If the |extension| option is not used, we try to find ourselves +% the good extension based on TeX engine or mode. +% \begin{macrocode} +\ifthenelse{\isundefined{\TD@extention}}{% + \PackageWarningNoLine{texdepends}{No extension given: detecting it}% + \RequirePackage{ifxetex,ifpdf}% + \ifxetex% + \PackageWarningNoLine{textdepends}{Detected XeTeX: using .pdf}% + \def\TD@extention{.pdf}% + \else\ifpdf% + \PackageWarningNoLine{texdepends}{Detected PDF mode: using .pdf}% + \def\TD@extention{.pdf}% + \else% + \PackageWarningNoLine{texdepends}{Detected DVI mode. Using .dvi}% + \def\TD@extention{.dvi}% + \fi\fi% +}{}% +% \end{macrocode} +% +% \subsection{Tools} +% Some macros to help development +% \subsubsection{Debug/info wrapper} +% \begin{macro}{\TD@warning} +% To write a warning +% \begin{macrocode} +\newcommand{\TD@warning}[1]{% + \PackageWarningNoLine{texdepends}{#1}% +}% +% \end{macrocode} +% \end{macro} +% \begin{macro}{\TD@warningLine} +% To write a warning with line info +% \begin{macrocode} +\newcommand{\TD@warningLine}[1]{% + \PackageWarning{texdepends}{#1}% +}% +% \end{macrocode} +% \end{macro} +% \begin{macro}{\TD@info} +% To write an info (as a warning if the |debug| option is set +% \begin{macrocode} +\newcommand{\TD@info}[1]{% + \ifthenelse{\boolean{TD@debug}}{% + \PackageWarningNoLine{texdepends}{#1}% + }{% + \PackageInfo{texdepends}{#1}% + }% +}% +% \end{macrocode} +% \end{macro} +% \begin{macro}{\TD@debug} +% To write a message if the |debug| option is set +% \begin{macrocode} +\newcommand{\TD@debug}[1]{% + \ifthenelse{\boolean{TD@debug}}{% + \PackageWarningNoLine{texdepends}{#1}% + }{% + }% +}% +% \end{macrocode} +% \end{macro} +% \subsubsection{Writing dependencies} +% We open the file where we will write dependencies and other infos. +% \begin{macrocode} +\newwrite\TD@write +\TD@info{Writing info in '\jobname\TD@extention.mk'} +\immediate\openout\TD@write\jobname\TD@extention.mk% +% \end{macrocode} +% And we define a few macro to write in this file +% +% \begin{macro}{\TD@print} +% We write something in the file +% \begin{macrocode} +\def\TD@print#1{% + \immediate\write\TD@write{#1}% +}% +% \end{macrocode} +% \end{macro} +% \begin{macro}{\TD@printClass} +% We need a class +% \begin{macrocode} +\def\TD@printClass#1{% + \TD@print{TD_\jobname\TD@extention _INPUTS\space += #1.cls}% +}% +% \end{macrocode} +% \end{macro} +% \begin{macro}{\TD@printPackage} +% We need a package +% \begin{macrocode} +\def\TD@printPackage#1{% + \TD@print{TD_\jobname\TD@extention _INPUTS\space += #1.sty}% +}% +% \end{macrocode} +% \end{macro} +% \begin{macro}{\TD@printInput} +% We need a (\LaTeX) file +% \begin{macrocode} +\def\TD@printInput#1{% + \TD@print{TD_\jobname\TD@extention _INPUTS\space += #1}% +}% +% \end{macrocode} +% \end{macro} +% \begin{macro}{\TD@printFig} +% We need an |XFig| file +% \begin{macrocode} +\def\TD@printFig#1{% + \TD@print{TD_\jobname\TD@extention _FIGURES\space += #1}% +}% +% \end{macrocode} +% \end{macro} +% \begin{macro}{\TD@printSubfig} +% Web need a subfig file (see figlatex.dtx) +% \begin{macrocode} +\def\TD@printSubfig#1{% + \TD@print{TD_\jobname\TD@extention _SUBFIGS\space += #1}% +}% +% \end{macrocode} +% \end{macro} +% \begin{macro}{\TD@printRequiredFile} +% A file is missing. |texdepend| will try to skip it this time, +% but it will be needed at the next compilation +% \begin{macrocode} +\def\TD@printRequiredFile#1{% + \TD@print{TD_\jobname\TD@extention _REQUIRED\space += #1}% +}% +% \end{macrocode} +% \end{macro} +% \begin{macro}{\RequireFile} +% LaTeX users can directly declare a dependencie +% \begin{macrocode} +\let\RequireFile\TD@printRequiredFile +% \end{macrocode} +% \end{macro} +% \begin{macro}{\TD@printOut} +% We write in a file +% \begin{macrocode} +\def\TD@printOut#1{% + \TD@print{TD_\jobname\TD@extention _OUTPUTS\space += #1}% +}% +% \end{macrocode} +% \end{macro} +% \begin{macro}{\TD@printGraphicspath} +% We modify the graphicspath +% \begin{macrocode} +\def\TD@printGraphicspath#1{% + \TD@print{TD_\jobname\TD@extention _GRAPHICSPATH\space := #1}% +}% +% \end{macrocode} +% \end{macro} +% \begin{macro}{\TD@printBibfile} +% We use a bibfile (|*.bib|) +% \begin{macrocode} +\def\TD@printBibfile#1{% + \TD@print{TD_\jobname\TD@extention _BIBFILES\space += #1.bib}% +}% +% \end{macrocode} +% \end{macro} +% \begin{macro}{\TD@printBibstyle} +% We use a bibstyle file (|*.bst|) +% \begin{macrocode} +\def\TD@printBibstyle#1{% + \TD@print{TD_\jobname\TD@extention _BIBSTYLES\space += #1.bst}% +}% +% \end{macrocode} +% \end{macro} +% \begin{macro}{\TD@printBblfile} +% We use a bibliography file (|*.bbl|) +% \begin{macrocode} +\def\TD@printBblfile#1{% + \TD@print{TD_\jobname\TD@extention _BBLFILES\space += #1.bbl}% +}% +% \end{macrocode} +% \end{macro} +% \begin{macro}{\TD@printRebuildRule} +% We need a specific rule in the |Makefile| to check if a +% rebuild is needed +% \begin{macrocode} +\def\TD@printRebuildRule#1{% + \TD@print{TD_\jobname\TD@extention _REBUILD_RULES\space += #1}% +}% +% \end{macrocode} +% \end{macro} +% \begin{macro}{\TD@printIndex} +% We use a new index +% \begin{macrocode} +\def\TD@printIndex#1{% + \TD@print{TD_\jobname\TD@extention _INDEXES\space += INDEX}% + \TD@print{TD_\jobname\TD@extention _INDEXES_INDEX\space += #1}% +}% +% \end{macrocode} +% \end{macro} +% \begin{macro}{\TD@printIndexSource} +% The index file filled by \LaTeX +% \begin{macrocode} +\def\TD@printIndexSource#1#2{% + \TD@print{TD_\jobname\TD@extention _INDEX_#1_SRC\space = #2}% +}% +% \end{macrocode} +% \end{macro} +% \begin{macro}{\TD@printIndexTarget} +% And the index file read by \LaTeX{} after |makeindex| +% processing +% \begin{macrocode} +\def\TD@printIndexTarget#1#2{% + \TD@print{TD_\jobname\TD@extention _INDEX_#1_TARGET\space = #2}% +}% +% \end{macrocode} +% \end{macro} +% \begin{macro}{\TD@printIndexStyle} +% The index style to be used with |makeindex| (never +% called for now) +% \begin{macrocode} +\def\TD@printIndexStyle#1#2{% + \TD@print{TD_\jobname\TD@extention _INDEX_#1_STYLE\space = #2}% +}% +% \end{macrocode} +% \end{macro} +% \begin{macro}{\TD@printGlossary} +% And the same things for glossary. Its name +% \begin{macrocode} +\def\TD@printGlossary#1{% + \TD@print{TD_\jobname\TD@extention _INDEXES += GLOSS}% + \TD@print{TD_\jobname\TD@extention _INDEXES_GLOSS\space += #1}% +}% +% \end{macrocode} +% \end{macro} +% \begin{macro}{\TD@printGlossarySource} +% The glossary file filled by \LaTeX +% \begin{macrocode} +\def\TD@printGlossarySource#1#2{% + \TD@print{TD_\jobname\TD@extention _GLOSS_#1_SRC\space = #2}% +}% +% \end{macrocode} +% \end{macro} +% \begin{macro}{\TD@printGlossaryTarget} +% And the glossary file read by \LaTeX{} after |makeindex| +% processing +% \begin{macrocode} +\def\TD@printGlossaryTarget#1#2{% + \TD@print{TD_\jobname\TD@extention _GLOSS_#1_TARGET\space = #2}% +}% +% \end{macrocode} +% \end{macro} +% \begin{macro}{\TD@printGlossaryStyle} +% The glossary style to be used with |makeindex| (never +% called for now) +% \begin{macrocode} +\def\TD@printGlossaryStyle#1#2{% + \TD@print{TD_\jobname\TD@extention _GLOSS_#1_STYLE\space = #2}% +}% +% \end{macrocode} +% \end{macro} +% +% \subsubsection{Diverting a macro} +% \begin{macro}{\TD@switch} +% |\TD@switch| replace the macro |\#1| by the macro |\TD@#1|. The +% original macro is stored in the |\TD@orig@#1| macro. Nothing is done +% if |\#1| is already |\TD@#1| (that is if |\TD@switch| is called +% severall times with the same argument) +% \begin{macrocode} +\def\TD@switch#1{% + \expandafter\let\expandafter\TD@local@old\csname#1\endcsname% + \expandafter\let\expandafter\TD@local@new\csname TD@#1\endcsname% + \ifx\TD@local@old\TD@local@new + \PackageWarning{texdepends}{#1 already redefined. Skipping it.}% + \else + \ifx\TD@local@old\relax + \TD@warning{Diverting empty macro '#1' \MessageBreak% + Probably a bug in texdepends.sty}% + \else + \TD@info{Diverting macro '#1'}% + \fi + \expandafter\let\csname TD@orig@#1\endcsname\TD@local@old% + \expandafter\let\csname#1\endcsname\TD@local@new% + \fi +}% +% \end{macrocode} +% \end{macro} +% \begin{macro}{\TD@docswitch} +% Sometimes, we want the diversion to be delayed until the start of +% the document. +% \begin{macrocode} +\def\TD@docswitchlist{}% +\def\TD@docswitch#1{% + \TD@info{Registering macro '#1' for diversion}% + \ifx\TD@docswitchlist\@empty% + \xdef\TD@docswitchlist{#1}% + \else% + \xdef\TD@docswitchlist{\TD@docswitchlist,#1}% + \fi% +}% +\AtBeginDocument{% + \TD@info{Diverting registered macros...}% + \@for\TD@cmd:=\TD@docswitchlist\do{% + \TD@switch{\TD@cmd}% + }% + \TD@info{Divertions done}% +}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\TD@PackagePreDivert} +% \begin{macro}{\TD@PackagePostDivert} +% And then, two macros to insert command just before or after +% loading a package. The first argument is the name of the package +% we want to add an hook before or after, and then there is the +% definition of the hook that will be called. Four parameters (|#1|, +% \ldots, |#4|) are available (the same as the |@onefilewithoptions| +% \LaTeX{} macro, ie package name, options, and the two remaining ;-)). +% \begin{macrocode} +\def\TD@PackagePreDivert#1{% + \expandafter\def\csname TD@PackageStart@#1\endcsname ##1##2##3##4% +}% +\def\TD@PackagePostDivert#1{% + \expandafter\def\csname TD@PackageEnd@#1\endcsname ##1##2##3##4% +}% +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \subsubsection{Initialisation} +% We need to be loaded \emph{before} \string\documentclass +% \begin{macrocode} +\ifx\documentclass\@twoclasseserror + \PackageError{texdepends}{texdepends needs to be loaded BEFORE + \string\documentclass \MessageBreak + Use \string\RequirePackage\space instead of \string\usepackage + \MessageBreak as the later is not allowed before + \string\documentclass} +\fi +% \end{macrocode} +% And we write the first dependency (upon ourself) +% \begin{macrocode} +\TD@printPackage{texdepends} +% \end{macrocode} +% We write default graphicspath (is this really needed ?) +% \begin{macrocode} +\TD@printGraphicspath{{.}} +% \end{macrocode} +% +% \subsubsection{Warning upon missing figures} +% \begin{macro}{\TD@depends} +% \begin{macro}{\TD@dependsWarning} +% \begin{macro}{\TD@missingDepends} +% If some figures are missing, |\TD@missingDepends| will be called so +% that a warning will be displayed at the end of the +% compilation. Figures should be generated before the next run. +% \begin{macrocode} +\def\TD@depends{}% +\def\TD@dependsWarning{% + \PackageWarningNoLine{texdepends}{Figure(s) missing. Check + dependencies again}% +}% +\def\TD@missingDepends{% + \global\let\TD@depends\TD@dependsWarning% +}% +\AtEndDocument{% + \TD@depends% +}% +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \subsection{Diversion of \LaTeX{} macros} +% +% \subsubsection{Class and package loading} +% \begin{macro}{\TD@@fileswith@pti@ns} +% \begin{macro}{\TD@@@fileswith@pti@ns} +% Diverting |\@fileswith@pti@ns| and |@@fileswith@pti@ns| so that we +% can track class loading. Package are tracked with an other macro +% (see just after). +% \begin{macrocode} +\def\TD@@fileswith@pti@ns#1[#2]#3[#4]{% + \ifx#1\@clsextension + \TD@printClass{#3} + \fi + \TD@orig@@fileswith@pti@ns{#1}[#2]{#3}[#4]% +}% +\let\TD@@@fileswith@pti@ns\TD@@fileswith@pti@ns +\TD@switch{@fileswith@pti@ns}% +\TD@switch{@@fileswith@pti@ns}% +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\TD@@onefilewithoptions} +% By diverting |\@onefilewithoptions|, we can track all loaded +% packages. We write the dependency, and we look at the loaded package +% to see if we need some special requirements +% \begin{macrocode} +\def\TD@@onefilewithoptions#1[#2][#3]#4{% + \TD@printPackage{#1}% + \ifthenelse{\equal{#1}{texdepends}}{% +% \end{macrocode} +% The |texdepends| package is special : we know it has already been +% loaded (we are running code in it) but perhaps \LaTeX{} does not +% know it. So we try to honor the |debug| option. +% \begin{macrocode} + \TD@debug{Package '#1' detected} + \@for\TD@package@option:=#2\do{% + \ifthenelse{\expandafter\isundefined\csname TD@option@\TD@package@option\endcsname}{ + \TD@warningLine{Ignoring unknown option '\TD@package@option'} + }{ + \ifthenelse{% + \equal{\TD@package@option}{debug}% + %\OR\equal{\TD@package@option}{debug}% + }{ + \csname TD@option@\TD@package@option\endcsname% + }{ + \TD@warningLine{Ignoring option '\TD@package@option' + \MessageBreak #1 already loaded + } + } + } + } + }{% + \expandafter\let\expandafter\TD@divert + \csname TD@PackageStart@#1\endcsname + \ifx\TD@divert\relax + \TD@debug{No preamble for package #1} + \else + \TD@info{Preamble for package #1} + \TD@divert{#1}{#2}{#3}{#4}% + \fi + \TD@orig@@onefilewithoptions{#1}[#2][#3]{#4}% + \expandafter\let\expandafter\TD@divert + \csname TD@PackageEnd@#1\endcsname + \ifx\TD@divert\relax + \TD@debug{No postamble for package #1} + \else + \TD@info{Postamble for package #1} + \TD@divert{#1}{#2}{#3}{#4}% + \fi + }% +}% +\TD@switch{@onefilewithoptions}% +% \end{macrocode} +% \end{macro} +% +% \subsubsection{Tracking input files} +% \begin{macro}{\TD@@iinput} +% \begin{macro}{\TD@@input@} +% |\@iinput| and |\@input@| are diverted to track loaded files +% \begin{macrocode} +\def\TD@@iinput#1{% + \TD@printInput{#1}% + \TD@orig@@iinput{#1}}% +\def\TD@@input@#1{% + \IfFileExists{#1}{% + \TD@printInput{#1}% + }{}% + \TD@orig@@input@{#1}}% +\TD@switch{@iinput}% +\TD@switch{@input@}% +\def\TD@verbatiminput#1{% + \TD@printInput{#1}% + \TD@orig@verbatiminput{#1}}% +\TD@PackagePostDivert{verbatim}{% + \TD@switch{verbatiminput}}% +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \subsubsection{Tracking output files} +% \begin{macro}{\TD@openout} +% \begin{macro}{\TD@poenout@eq} +% \begin{macro}{\TD@poenout@noeq} +% Note: that does not work. Currently, we parse the log file instead +% of using this. If someone has ideas\ldots +% \begin{macrocode} +\let\TD@orig@openout\openout +\def\TD@openout#1{% + \@ifnextchar={\TD@openout@eq#1}{\TD@openout@noeq#1}} +\def\TD@openout@eq#1=#2.#3{% + \TD@printOut{#2.#3}% + \TD@orig@openout#1=#2.#3% +}% +\def\TD@openout@noeq#1#2.#3{% + \TD@printOut{#2.#3}% + \TD@orig@openout#1#2.#3% +}% + %\TD@switch{openout} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \subsubsection{Tracking bibliography files} +% \begin{macrocode} +\def\TD@bibli@bbl{% + \TD@printBblfile{\jobname}% + \global\let\TD@bibli@bbl\relax% +}% +\def\TD@bibli@files#1{% + \TD@bibli@bbl% + \@for\TD@bibfile:=#1\do{% + \TD@printBibfile{\TD@bibfile}% + }% +} +\def\TD@bibli@style#1{% + \TD@bibli@bbl% + %\@for\TD@bibstyle:=#1\do{% + % \TD@printBibstyle{\TD@bibstyle}% + %} + \TD@printBibstyle{#1}% +} +\def\TD@bibliography#1{% + \TD@bibli@files{#1}% + \TD@orig@bibliography{#1}% +}% +\def\TD@bibliographystyle#1{% + \TD@bibli@style{#1}% + \TD@orig@bibliographystyle{#1}% +}% +\TD@docswitch{bibliography}% +\TD@switch{bibliographystyle}% +% \end{macrocode} +% \subsubsection{Glossary and index files} +% \begin{macrocode} +\def\TD@makeindex{% + \TD@printIndex{\jobname}% + \TD@printIndexSource{\jobname}{\jobname.idx}% + \TD@orig@makeindex% +}% +\def\TD@makeglossary{% + \TD@printGlossary{\jobname}% + \TD@printGlossarySource{\jobname}{\jobname.glo}% + \TD@orig@makeglossary% +}% +\TD@switch{makeindex}% +\TD@switch{makeglossary}% +% \end{macrocode} +% \subsection{Diversion of package's macros} +% \subsubsection{Package graphics} +% \begin{macrocode} +\def\TD@Gin@getbase#1{% + \TD@orig@Gin@getbase{#1}% + \ifx\Gin@ext\relax% + \else% + \TD@printFig{\Gin@base\Gin@ext}% + \fi% +}% +\def\TD@Ginclude@eps#1{% + \IfFileExists{#1}{% + \TD@orig@Ginclude@eps{#1}% + }{% + \PackageWarning{texdepends}{Figure '#1' needed\MessageBreak + Skipping it this time (the last one however)\MessageBreak}% + \TD@missingDepends% + \TD@printRequiredFile{#1}% + }% +}% +\def\TD@Ginclude@pdf#1{% + \IfFileExists{#1}{% + \TD@orig@Ginclude@pdf{#1}% + }{% + \PackageWarning{texdepends}{Figure '#1' needed\MessageBreak + Skipping it this time (the last one however)\MessageBreak}% + \TD@missingDepends% + \TD@printRequiredFile{#1}% + }% +}% +\def\TD@graphicspath#1{% + \TD@printGraphicspath{#1}% + \TD@orig@graphicspath{#1}% +}% +\def\TD@Gread@eps#1{% + \IfFileExists{#1}{% + %\PackageWarning{texdepends}{Gread File '#1' exists}% + \TD@orig@Gread@eps{#1}% + }{% + \PackageWarning{texdepends}{No '#1' file \MessageBreak + using 1 for graphic dimensions}% + \setbox\@tempboxa\hbox{\relax}% + \def\Gin@llx{1}\let\Gin@lly\Gin@llx + \Gin@defaultbp\Gin@urx{\wd\@tempboxa}% + \Gin@defaultbp\Gin@ury{\ht\@tempboxa}% + }% +}% +\def\TD@Gread@pdf#1{% + \IfFileExists{#1}{% + %\PackageWarning{texdepends}{Gread File '#1' exists}% + \TD@orig@Gread@pdf{#1}% + }{% + \PackageWarning{texdepends}{No '#1' file \MessageBreak + using 1 for graphic dimensions}% + \setbox\@tempboxa\hbox{\relax}% + \def\Gin@llx{1}\let\Gin@lly\Gin@llx + \Gin@defaultbp\Gin@urx{\wd\@tempboxa}% + \Gin@defaultbp\Gin@ury{\ht\@tempboxa}% + }% +}% +\TD@PackagePostDivert{graphics}{% + \TD@switch{graphicspath}% + \TD@docswitch{Gin@getbase}% + \TD@docswitch{Ginclude@eps}% + \TD@docswitch{Ginclude@pdf}% + \TD@docswitch{Gread@eps}% + \TD@docswitch{Gread@pdf}% +}% +% \end{macrocode} +% \subsubsection{Package figlatex} +% \begin{macrocode} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% We do not want to fail when trying to load a missing subfig. +% \@Ginclude@rawtex +\def\TD@FL@includerawtexgraphics[#1]#2{% + \IfFileExists{#2}{% + \TD@orig@FL@includerawtexgraphics[#1]{#2}% + }{% + \PackageWarning{texdepends}{Figure '#2' needed\MessageBreak + Skipping it this time (the last one however)\MessageBreak}% + \TD@missingDepends% + \TD@printRequiredFile{#2}% + }% +}% + +\def\TD@Ginclude@rawtex#1{% + \IfFileExists{#1}{% + \TD@orig@Ginclude@rawtex{#1}% + }{% + \PackageWarning{texdepends}{Figure '#1' needed\MessageBreak + Skipping it this time (the last one however)\MessageBreak}% + \TD@missingDepends% + \TD@printRequiredFile{#1}% + }% +}% + +% \@Ginclude@figtex +\def\TD@Ginclude@figtex#1{% + \IfFileExists{#1}{% + %\PackageWarning{texdepends}{Ginclude File '#1' exists}% + \TD@orig@Ginclude@figtex{#1}% + }{% + \ifthenelse{\isundefined{\FL@subfig@mainfigname}}{% + \PackageWarning{texdepends}{Figure '#1' needed\MessageBreak + Skipping it this time (the last one however)\MessageBreak}% + }{% + \PackageWarning{texdepends}{SubFigure '#1' from + \FL@subfig@mainfigname needed\MessageBreak + Skipping it this time (the last one however)\MessageBreak}% + } + \TD@missingDepends% + \TD@printRequiredFile{#1}% + }% +}% +% \@Ginclude@svgtex +\def\TD@Ginclude@svgtex#1{% + \IfFileExists{#1}{% + %\PackageWarning{texdepends}{Ginclude File '#1' exists}% + \TD@orig@Ginclude@svgtex{#1}% + }{% + \ifthenelse{\isundefined{\FL@subfig@mainfigname}}{% + \PackageWarning{texdepends}{Figure '#1' needed\MessageBreak + Skipping it this time (the last one however)\MessageBreak}% + }{% + \PackageWarning{texdepends}{SubFigure '#1' from + \FL@subfig@mainfigname needed\MessageBreak + Skipping it this time (the last one however)\MessageBreak}% + } + \TD@missingDepends% + \TD@printRequiredFile{#1}% + }% +}% + + +% \@Gread@figtex +\def\TD@Gread@figtex#1{% + \IfFileExists{#1}{% + %\PackageWarning{texdepends}{Gread File '#1' exists}% + \TD@orig@Gread@figtex{#1}% + }{% + \PackageWarning{texdepends}{No '#1' file \MessageBreak + using 1 for graphic dimensions}% + \setbox\@tempboxa\hbox{\relax}% + \def\Gin@llx{1}\let\Gin@lly\Gin@llx + \Gin@defaultbp\Gin@urx{\wd\@tempboxa}% + \Gin@defaultbp\Gin@ury{\ht\@tempboxa}% + }% +}% + +% \@Gread@svgtex +\def\TD@Gread@svgtex#1{% + \IfFileExists{#1}{% + %\PackageWarning{texdepends}{Gread File '#1' exists}% + \TD@orig@Gread@svgtex{#1}% + }{% + \PackageWarning{texdepends}{No '#1' file \MessageBreak + using 1 for graphic dimensions}% + \setbox\@tempboxa\hbox{\relax}% + \def\Gin@llx{1}\let\Gin@lly\Gin@llx + \Gin@defaultbp\Gin@urx{\wd\@tempboxa}% + \Gin@defaultbp\Gin@ury{\ht\@tempboxa}% + }% +}% +% \FL@subfig@check +\def\TD@FL@subfig@check#1{% + \TD@printRequiredFile{#1}% + \TD@printSubfig{#1}% +}% +% +\TD@PackagePostDivert{figlatex}{% + \TD@docswitch{FL@includerawtexgraphics}% + \TD@docswitch{Ginclude@rawtex}% + \TD@docswitch{Ginclude@figtex}% + \TD@docswitch{Ginclude@svgtex}% + \TD@docswitch{Gread@figtex}% + \TD@docswitch{Gread@svgtex}% + \TD@docswitch{FL@subfig@check}% +}% +% \end{macrocode} +% \subsubsection{Package doc} +% \begin{macrocode} +\def\TD@PrintIndex{% + \TD@printIndexStyle{\jobname}{gind.ist} + \TD@printIndexTarget{\jobname}{\jobname.ind} + \TD@orig@PrintIndex% +}% +\def\TD@PrintChanges{% + \TD@printGlossaryStyle{\jobname}{gglo.ist} + \TD@printGlossaryTarget{\jobname}{\jobname.gls} + \TD@orig@PrintChanges% +}% +\TD@PackagePostDivert{doc}{% + \TD@docswitch{PrintIndex}% + \TD@docswitch{PrintChanges}% +}% +% \end{macrocode} +% \subsubsection{Package index} +% \begin{macrocode} +\def\TD@def@index#1#2#3#4{% + \TD@printIndex{#2}% + \TD@printIndexSource{#2}{\jobname.#3}% + \TD@printIndexTarget{#2}{\jobname.#4} + \TD@orig@def@index{#1}{#2}{#3}{#4}% +}% +\TD@PackagePostDivert{index}{% + \TD@switch{def@index}% +}% +% \end{macrocode} +% \subsubsection{Package makeidx} +% \begin{macrocode} +\def\TD@printindex{% + \TD@printIndexTarget{\jobname}{\jobname.ind} + \TD@orig@printindex% +}% +\TD@PackagePostDivert{makeidx}{% + \TD@docswitch{printindex}% +}% +% \end{macrocode} +% \subsubsection{Package nomencl} +% We divert |makeglossary| again after loading this package as its +% redefines this macro (loosing our divertion). We also setup the +% glossary style for this package. +% \begin{macrocode} +\def\TD@printglossary{% + \TD@printGlossaryTarget{\jobname}{\jobname.gls} + \TD@orig@printglossary% +}% +\TD@PackagePostDivert{nomencl}{% + \TD@docswitch{printglossary}% + \TD@switch{makeglossary}% + \TD@printGlossaryStyle{\jobname}{nomencl.ist} +}% +% \end{macrocode} +% \subsubsection{Package bibtopic} +% \begin{macrocode} +% Pour le package bibtopic +\def\TD@btSect{% + \@ifnextchar[{\TD@btSect@opt}{\TD@btSect@noopt}} +\def\TD@btSect@opt[#1]#2{% + \TD@bibli@files{#2}% + \TD@bibli@style{#1}% + \TD@orig@btSect[#1]{#2}} +\def\TD@btSect@noopt#1{% + \TD@bibli@files{#1}% + \TD@orig@btSect{#1}} + +\def\TD@@bt@write@auxfile{% + \TD@printBblfile{\thebtauxfile}% + \TD@orig@@bt@write@auxfile% +}% +\TD@PackagePostDivert{bibtopic}{% + \global\let\TD@bibli@bbl\relax% + \global\let\TD@biblio@rules@package\TD@biblio@rules@package@bibtopic% + \TD@switch{@bt@write@auxfile}% + \TD@printOut{btbbl.aux}% + \TD@printRebuildRule{bibtopic}% + \TD@docswitch{btSect}% +}% +% \end{macrocode} +% \begin{macrocode} +%</package> +% \end{macrocode} +% \Finale +\endinput diff --git a/Master/texmf-dist/tex/latex/latex-make/figlatex.cfg b/Master/texmf-dist/tex/latex/latex-make/figlatex.cfg new file mode 100644 index 00000000000..bb139c3581f --- /dev/null +++ b/Master/texmf-dist/tex/latex/latex-make/figlatex.cfg @@ -0,0 +1,48 @@ +%% +%% This is file `figlatex.cfg', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% figlatex.dtx (with options: `config') +%% +%% IMPORTANT NOTICE: +%% +%% For the copyright see the source file. +%% +%% Any modified versions of this file must be renamed +%% with new filenames distinct from figlatex.cfg. +%% +%% For distribution of the original source see the terms +%% for copying and modification in the file figlatex.dtx. +%% +%% This generated file may be distributed as long as the +%% original source files, as listed above, are part of the +%% same distribution. (The sources need not necessarily be +%% in the same archive or directory.) +%% +%% File: figlatex.dtx Copyright (C) 2002--2005 V. Danjean, A. Legrand +%% Vincent.Danjean@ens-lyon.org +%% Arnaud.Legrand@ens-lyon.org +%% +%% This program is free software; you can redistribute it and/or +%% modify it under the terms of the GNU General Public License +%% as published by the Free Software Foundation; either version 2 +%% of the License, or (at your option) any later version. +%% +%% This program is distributed in the hope that it will be useful, +%% but WITHOUT ANY WARRANTY; without even the implied warranty of +%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +%% GNU General Public License for more details. +%% +%% You should have received a copy of the GNU General Public License +%% along with this program; if not, write to the Free Software +%% Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +%% + \ProvidesFile{figlatex.cfg}% +[2011/09/25 v0.1.4 include fig and svg in LaTeX] + %\compatibility + %\debug +\endinput +%% +%% End of file `figlatex.cfg'. diff --git a/Master/texmf-dist/tex/latex/latex-make/figlatex.sty b/Master/texmf-dist/tex/latex/latex-make/figlatex.sty new file mode 100644 index 00000000000..9efc78a077c --- /dev/null +++ b/Master/texmf-dist/tex/latex/latex-make/figlatex.sty @@ -0,0 +1,210 @@ +%% +%% This is file `figlatex.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% figlatex.dtx (with options: `package') +%% +%% IMPORTANT NOTICE: +%% +%% For the copyright see the source file. +%% +%% Any modified versions of this file must be renamed +%% with new filenames distinct from figlatex.sty. +%% +%% For distribution of the original source see the terms +%% for copying and modification in the file figlatex.dtx. +%% +%% This generated file may be distributed as long as the +%% original source files, as listed above, are part of the +%% same distribution. (The sources need not necessarily be +%% in the same archive or directory.) +%% +%% File: figlatex.dtx Copyright (C) 2002--2005 V. Danjean, A. Legrand +%% Vincent.Danjean@ens-lyon.org +%% Arnaud.Legrand@ens-lyon.org +%% +%% This program is free software; you can redistribute it and/or +%% modify it under the terms of the GNU General Public License +%% as published by the Free Software Foundation; either version 2 +%% of the License, or (at your option) any later version. +%% +%% This program is distributed in the hope that it will be useful, +%% but WITHOUT ANY WARRANTY; without even the implied warranty of +%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +%% GNU General Public License for more details. +%% +%% You should have received a copy of the GNU General Public License +%% along with this program; if not, write to the Free Software +%% Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +%% +\NeedsTeXFormat{LaTeX2e}% +\ProvidesPackage{figlatex}% +[2011/09/25 v0.1.4 include fig and svg in LaTeX] +\newif\ifFL@compatibility +\DeclareOption{compatibility}{% + %\PackageWarning{figlatex}{option compatibility}% + \global\FL@compatibilitytrue% +} +\newif\ifFL@debug +\DeclareOption{debug}{% + \global\FL@debugtrue% +} +{ + \def\compatibility{% + \ExecuteOptions{compatibility}% + } + \def\debug{% + \ExecuteOptions{debug}% + } + \InputIfFileExists{figlatex.cfg}{% + \typeout{***************************************^^J% + * Local config file figlatex.cfg used *^^J% + ***************************************} + }{% + \typeout{Found no configuration file for figlatex} + } +} +\ProcessOptions +\RequirePackage{ifpdf} +\RequirePackage{graphicx} +\RequirePackage{color} +\RequirePackage{epstopdf} +\def\FL@dmessage#1{% + \ifFL@debug% + \message{#1}% + \fi% +} +\def\Ginclude@rawtex#1{% + \FL@dmessage{<#1>}% + \bgroup% + \def\@tempa{!}% + \ifx\Gin@scaley\@tempa% + \let\Gin@scaley\Gin@scalex% + \else% + \ifx\Gin@scalex\@tempa\let\Gin@scalex\Gin@scaley\fi% + \fi% + \hbox{% + \Gscale@box{\Gin@scalex}[\Gin@scaley]{% + \def\Gin@scalex{1}% + \let\Gin@scaley\Gin@exclamation% needed for pdflatex + \FL@dmessage{<loading rawtex #1>}% + \input{#1}}}% + \egroup} +\def\Ginclude@figtex#1{% + \message{<#1>}% + \bgroup% + \xdef\FL@filename{#1}% + \filename@parse{\FL@filename}% + \xdef\FL@filename{\filename@area\filename@base.\FL@figext}% + \FL@dmessage{<****loading fig \FL@filename>}% + \FL@includerawtexgraphics[]{\FL@filename}% + \egroup} +\newcommand{\Gread@figtex}[1]{% + %\typeout{Oh, file exists #1}% + \Gread@rawtex{#1}% +} +\def\Ginclude@svgtex#1{% + \message{<#1>}% + \bgroup% + \xdef\FL@filename{#1}% + \filename@parse{\FL@filename}% + \xdef\FL@filename{\filename@area\filename@base.\FL@svgext}% + \FL@dmessage{<****loading svg \FL@filename>}% + \FL@includerawtexgraphics[]{\FL@filename}% + \egroup} +\newcommand{\Gread@svgtex}[1]{% + %\typeout{Oh, file exists #1}% + \Gread@rawtex{#1}% +} +\ifpdf + \def\FL@figext{pdftex_t}% + \def\FL@svgext{pdftex_t}% + \let\Gread@rawtex\Gread@pdf% + \DeclareGraphicsRule{.pdftex}{pdf}{*}{}% + \ifFL@compatibility% + \PackageWarningNoLine{figlatex}{Compatibility mode enabled + for old LaTeX + \MessageBreak Using .pdf extension for pdftex files}% + \DeclareGraphicsRule{.pdftex_t}{rawtex}{.pdf}{}% + \DeclareGraphicsRule{.fig}{figtex}{.pdf}{}% + \DeclareGraphicsRule{.svg}{svgtex}{.pdf}{}% + \else% + \DeclareGraphicsRule{.pdftex_t}{rawtex}{.pdftex}{}% + \DeclareGraphicsRule{.fig}{figtex}{.pdftex}{}% + \DeclareGraphicsRule{.svg}{svgtex}{.pdftex}{}% + \fi% +\else + \def\FL@figext{pstex_t}% + \def\FL@svgext{pstex_t}% + \let\Gread@rawtex\Gread@eps% + \DeclareGraphicsRule{.pstex}{eps}{*}{}% + \DeclareGraphicsRule{.pstex_t}{rawtex}{.pstex}{}% + \DeclareGraphicsRule{.fig}{figtex}{.pstex}{}% + \DeclareGraphicsRule{.svg}{svgtex}{.pstex}{}% +\fi +\newcommand{\FL@includerawtexgraphics}[2][]{% + \includegraphics[#1]{#2}% +} +\def\FL@exclamation{!}% +\let\FL@subfig@name\FL@exclamation% +\define@key{Gin}{subfig}{% + \def\FL@subfig@name{#1}% +} +\def\FL@sepdefault{_}% +\def\FL@subfig@check#1{% +} +\def\FL@Gin@getbase#1{% + \ifx\FL@subfig@name\FL@exclamation% + \else% + \ifthenelse{\equal{#1}{.fig}}{% + % If we're including a subfig + \IfFileExists{\filename@area\filename@base#1}{% + % If the original .fig file exists, just change the name so that + % it comprises the full path. + \filename@parse{\@filef@und}% + % Remove potential trailing spage at the end of the extension + \def\filename@ext{fig}% + % Check if the subfig file exists + \FL@subfig@check{\filename@area\filename@base.subfig}% + }{% + % Else, write a warning (LaTeX will warn as well but it doesn't + % hurt) + \PackageWarning{figlatex}{No file + '\filename@area\filename@base#1'}% + } + % Add the subfig suffix to the fig name. + \edef\filename@base{\filename@base\FL@sepdefault\FL@subfig@name}% + }{% + }% + \ifthenelse{\equal{#1}{.svg}}{% + % If we're including a subfig + \IfFileExists{\filename@area\filename@base#1}{% + % If the original .svg file exists, just change the name so that + % it comprises the full path. + \filename@parse{\@filef@und}% + % Remove potential trailing spage at the end of the extension + \def\filename@ext{svg}% + % Check if the subfig file exists + \FL@subfig@check{\filename@area\filename@base.subfig}% + }{% + % Else, write a warning (LaTeX will warn as well but it doesn't + % hurt) + \PackageWarning{figlatex}{No file + '\filename@area\filename@base#1'}% + } + % Add the subfig suffix to the svg name. + \edef\filename@base{\filename@base\FL@sepdefault\FL@subfig@name}% + }{% + }% + \fi% + \FL@orig@Gin@getbase{#1}% +} +\let\FL@orig@Gin@getbase\Gin@getbase +\let\Gin@getbase\FL@Gin@getbase + + +\endinput +%% +%% End of file `figlatex.sty'. diff --git a/Master/texmf-dist/tex/latex/latex-make/pdfswitch.sty b/Master/texmf-dist/tex/latex/latex-make/pdfswitch.sty new file mode 100644 index 00000000000..b103f8d54dd --- /dev/null +++ b/Master/texmf-dist/tex/latex/latex-make/pdfswitch.sty @@ -0,0 +1,140 @@ +%% +%% This is file `pdfswitch.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% pdfswitch.dtx (with options: `package') +%% +%% IMPORTANT NOTICE: +%% +%% For the copyright see the source file. +%% +%% Any modified versions of this file must be renamed +%% with new filenames distinct from pdfswitch.sty. +%% +%% For distribution of the original source see the terms +%% for copying and modification in the file pdfswitch.dtx. +%% +%% This generated file may be distributed as long as the +%% original source files, as listed above, are part of the +%% same distribution. (The sources need not necessarily be +%% in the same archive or directory.) +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% +\def\fileversion{0.0.2} +\def\filedate{2003/07/12} + +\NeedsTeXFormat{LaTeX2e} + +\ProvidesPackage% +{pdfswitch}% +[\filedate\space Automatic switch between pdf and ps. v\fileversion] + +\RequirePackage{ae,aeguill} +\RequirePackage{color} +\RequirePackage{ifthen} +\RequirePackage{ifpdf} + +\newboolean{nocolor@pdfswitch} +\setboolean{nocolor@pdfswitch}{false} +\DeclareOption{nocolor}{\setboolean{nocolor@pdfswitch}{true}} +\newboolean{backref@pdfswitch} +\setboolean{backref@pdfswitch}{false} +\DeclareOption{backref}{\setboolean{backref@pdfswitch}{true}} +\newboolean{pagebackref@pdfswitch} +\setboolean{pagebackref@pdfswitch}{false} +\DeclareOption{pagebackref}{\setboolean{pagebackref@pdfswitch}{true}} +\newboolean{noborder@pdfswitch} +\setboolean{noborder@pdfswitch}{false} +\DeclareOption{noborder}{\setboolean{noborder@pdfswitch}{true}} +\newboolean{plainpages@pdfswitch} +\setboolean{plainpages@pdfswitch}{false} +\DeclareOption{plainpages}{\setboolean{plainpages@pdfswitch}{true}} + +\ProcessOptions + +\definecolor{pdfurlcolor}{rgb}{0,0,0.6} +\definecolor{pdfcitecolor}{rgb}{0,0.6,0} +\definecolor{pdflinkcolor}{rgb}{0.6,0,0} + + %%%%%%%%%%%%%%%%%%%%%%%%% graphicx and thumbpdf %%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\ifpdf +\usepackage[pdftex]{graphicx} %%% graphics for pdfLaTeX +\DeclareGraphicsExtensions{.pdf} %%% standard extension for included graphics +\usepackage[pdftex]{thumbpdf} %%% thumbnails for pdflatex +\else +\usepackage[dvips]{graphicx} %%% graphics for dvips +\DeclareGraphicsExtensions{.eps} %%% standard extension for included graphics +\fi + +%%%%%%%%%%%%%%%%%%%%%%%%% Basic options for hyperref %%%%%%%%%%%%%%%%%%%%%%%%% +\ifpdf +\edef\keys@pdfswitch{% + pdftex, %%% hyper-references for pdflatex + bookmarks=true,% %%% generate bookmarks ... + bookmarksnumbered=true,% %%% ... with numbers + hypertexnames=false,% %%% needed for correct links to figures !!! + breaklinks=true% %%% break links if exceeding a single line +} +\else +\edef\keys@pdfswitch{% + ps2pdf, %%% hyper-references for ps2pdf + bookmarks=true,% %%% generate bookmarks ... + bookmarksnumbered=true,% %%% ... with numbers + hypertexnames=false,% %%% needed for correct links to figures !!! + breaklinks=true,% %%% breaks lines, but links are very small + pdfborder={0 0 11.0} %%% border-width of frames will + %%% be multiplied with 0.009 by ps2pdf +} +\fi + +\ifthenelse{\boolean{nocolor@pdfswitch}}{% + \edef\keys@pdfswitch{\keys@pdfswitch,colorlinks=false}% +}{ + \edef\keys@pdfswitch{\keys@pdfswitch,colorlinks=true,% + citecolor=pdfcitecolor, + urlcolor=pdfurlcolor, + linkcolor=pdflinkcolor, + linkbordercolor={1 1 1}}% +} + +\ifthenelse{\boolean{plainpages@pdfswitch}}{% +}{ + \edef\keys@pdfswitch{\keys@pdfswitch,plainpages=false}% +} + +\ifthenelse{\boolean{noborder@pdfswitch}}{% + \edef\keys@pdfswitch{\keys@pdfswitch,pdfborder={0 0 0}}% +}{} + +\ifthenelse{\boolean{backref@pdfswitch}}{% + \edef\keys@pdfswitch{\keys@pdfswitch,backref}% +}{} + +\ifthenelse{\boolean{pagebackref@pdfswitch}}{% + \edef\keys@pdfswitch{\keys@pdfswitch,pagebackref}% +}{} + +\usepackage[\keys@pdfswitch]{hyperref} + +%%%%%%%%%%%%%%%%%%%%%%%%% HyperSetup %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\ifpdf +\AtBeginDocument{ + \hypersetup{ + pdfauthor = {\@author}, + pdftitle = {\@title}, + pdfsubject = {\@ifundefined{@subject}{}{\@subject}}, + pdfkeywords = {\@ifundefined{@keywords}{}{\@keywords}} + } +} +%%% pdfcreator, pdfproducer, and Creation Date are automatically set by pdflatex !!! +\pdfadjustspacing=1 %%% force LaTeX-like character spacing +\else +\AtBeginDocument{ +} +\fi +\endinput +%% +%% End of file `pdfswitch.sty'. diff --git a/Master/texmf-dist/tex/latex/latex-make/texdepends.sty b/Master/texmf-dist/tex/latex/latex-make/texdepends.sty new file mode 100644 index 00000000000..e40de23c813 --- /dev/null +++ b/Master/texmf-dist/tex/latex/latex-make/texdepends.sty @@ -0,0 +1,581 @@ +%% +%% This is file `texdepends.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% texdepends.dtx (with options: `package') +%% +%% IMPORTANT NOTICE: +%% +%% For the copyright see the source file. +%% +%% Any modified versions of this file must be renamed +%% with new filenames distinct from texdepends.sty. +%% +%% For distribution of the original source see the terms +%% for copying and modification in the file texdepends.dtx. +%% +%% This generated file may be distributed as long as the +%% original source files, as listed above, are part of the +%% same distribution. (The sources need not necessarily be +%% in the same archive or directory.) +%% +%% File: texdepends.dtx Copyright (C) 2004--2011 V. Danjean +%% Vincent.Danjean@ens-lyon.org +%% Modified by Matthieu Gallet +%% Matthieu.Gallet@ens-lyon.org +%% +%% This program is free software; you can redistribute it and/or +%% modify it under the terms of the GNU General Public License +%% as published by the Free Software Foundation; either version 2 +%% of the License, or (at your option) any later version. +%% +%% This program is distributed in the hope that it will be useful, +%% but WITHOUT ANY WARRANTY; without even the implied warranty of +%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +%% GNU General Public License for more details. +%% +%% You should have received a copy of the GNU General Public License +%% along with this program; if not, write to the Free Software +%% Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +%% +\NeedsTeXFormat{LaTeX2e}% +\ProvidesPackage{texdepends}% +[2008/01/28\space Automatic depends generation. v1.2.0] +\RequirePackage{ifthen} +\newboolean{TD@debug} +\newcommand{\TD@option@debug}[1][true]{% + %\PackageWarningNoLine{texdepends}{Setting debug to #1} + \setboolean{TD@debug}{#1}% +}% +\def\TD@option@extension[#1]{% + %\PackageWarningNoLine{texdepends}{Using extention #1} + \def\TD@extention{#1}% +}% +\def\TD@option@split#1=#2=#3\relax{% + \def\TD@option@name{#1}% + \ifx\TD@option@name\@empty\else + \expandafter\let\expandafter\TD@option@cmd + \csname TD@option@\TD@option@name\endcsname + %\PackageWarningNoLine{texdepends}{1: '#1', 2: '#2', 3: '#3'} + \ifx\TD@option@cmd\relax + \@unknownoptionerror% + \else + \ifx\@empty#3\@empty + \TD@option@cmd\relax% + \else + \def\TD@option@value{#2}% + \TD@option@cmd[\TD@option@value]% + \fi + \fi + \fi +}% +\DeclareOption*{% + %\PackageWarningNoLine{texdepends}{Option \CurrentOption}% + \expandafter\TD@option@split\CurrentOption==\relax% +}% +\ProcessOptions +\ifthenelse{\isundefined{\TD@extention}}{% + \PackageWarningNoLine{texdepends}{No extension given: detecting it}% + \RequirePackage{ifxetex,ifpdf}% + \ifxetex% + \PackageWarningNoLine{textdepends}{Detected XeTeX: using .pdf}% + \def\TD@extention{.pdf}% + \else\ifpdf% + \PackageWarningNoLine{texdepends}{Detected PDF mode: using .pdf}% + \def\TD@extention{.pdf}% + \else% + \PackageWarningNoLine{texdepends}{Detected DVI mode. Using .dvi}% + \def\TD@extention{.dvi}% + \fi\fi% +}{}% +\newcommand{\TD@warning}[1]{% + \PackageWarningNoLine{texdepends}{#1}% +}% +\newcommand{\TD@warningLine}[1]{% + \PackageWarning{texdepends}{#1}% +}% +\newcommand{\TD@info}[1]{% + \ifthenelse{\boolean{TD@debug}}{% + \PackageWarningNoLine{texdepends}{#1}% + }{% + \PackageInfo{texdepends}{#1}% + }% +}% +\newcommand{\TD@debug}[1]{% + \ifthenelse{\boolean{TD@debug}}{% + \PackageWarningNoLine{texdepends}{#1}% + }{% + }% +}% +\newwrite\TD@write +\TD@info{Writing info in '\jobname\TD@extention.mk'} +\immediate\openout\TD@write\jobname\TD@extention.mk% +\def\TD@print#1{% + \immediate\write\TD@write{#1}% +}% +\def\TD@printClass#1{% + \TD@print{TD_\jobname\TD@extention _INPUTS\space += #1.cls}% +}% +\def\TD@printPackage#1{% + \TD@print{TD_\jobname\TD@extention _INPUTS\space += #1.sty}% +}% +\def\TD@printInput#1{% + \TD@print{TD_\jobname\TD@extention _INPUTS\space += #1}% +}% +\def\TD@printFig#1{% + \TD@print{TD_\jobname\TD@extention _FIGURES\space += #1}% +}% +\def\TD@printSubfig#1{% + \TD@print{TD_\jobname\TD@extention _SUBFIGS\space += #1}% +}% +\def\TD@printRequiredFile#1{% + \TD@print{TD_\jobname\TD@extention _REQUIRED\space += #1}% +}% +\let\RequireFile\TD@printRequiredFile +\def\TD@printOut#1{% + \TD@print{TD_\jobname\TD@extention _OUTPUTS\space += #1}% +}% +\def\TD@printGraphicspath#1{% + \TD@print{TD_\jobname\TD@extention _GRAPHICSPATH\space := #1}% +}% +\def\TD@printBibfile#1{% + \TD@print{TD_\jobname\TD@extention _BIBFILES\space += #1.bib}% +}% +\def\TD@printBibstyle#1{% + \TD@print{TD_\jobname\TD@extention _BIBSTYLES\space += #1.bst}% +}% +\def\TD@printBblfile#1{% + \TD@print{TD_\jobname\TD@extention _BBLFILES\space += #1.bbl}% +}% +\def\TD@printRebuildRule#1{% + \TD@print{TD_\jobname\TD@extention _REBUILD_RULES\space += #1}% +}% +\def\TD@printIndex#1{% + \TD@print{TD_\jobname\TD@extention _INDEXES\space += INDEX}% + \TD@print{TD_\jobname\TD@extention _INDEXES_INDEX\space += #1}% +}% +\def\TD@printIndexSource#1#2{% + \TD@print{TD_\jobname\TD@extention _INDEX_#1_SRC\space = #2}% +}% +\def\TD@printIndexTarget#1#2{% + \TD@print{TD_\jobname\TD@extention _INDEX_#1_TARGET\space = #2}% +}% +\def\TD@printIndexStyle#1#2{% + \TD@print{TD_\jobname\TD@extention _INDEX_#1_STYLE\space = #2}% +}% +\def\TD@printGlossary#1{% + \TD@print{TD_\jobname\TD@extention _INDEXES += GLOSS}% + \TD@print{TD_\jobname\TD@extention _INDEXES_GLOSS\space += #1}% +}% +\def\TD@printGlossarySource#1#2{% + \TD@print{TD_\jobname\TD@extention _GLOSS_#1_SRC\space = #2}% +}% +\def\TD@printGlossaryTarget#1#2{% + \TD@print{TD_\jobname\TD@extention _GLOSS_#1_TARGET\space = #2}% +}% +\def\TD@printGlossaryStyle#1#2{% + \TD@print{TD_\jobname\TD@extention _GLOSS_#1_STYLE\space = #2}% +}% +\def\TD@switch#1{% + \expandafter\let\expandafter\TD@local@old\csname#1\endcsname% + \expandafter\let\expandafter\TD@local@new\csname TD@#1\endcsname% + \ifx\TD@local@old\TD@local@new + \PackageWarning{texdepends}{#1 already redefined. Skipping it.}% + \else + \ifx\TD@local@old\relax + \TD@warning{Diverting empty macro '#1' \MessageBreak% + Probably a bug in texdepends.sty}% + \else + \TD@info{Diverting macro '#1'}% + \fi + \expandafter\let\csname TD@orig@#1\endcsname\TD@local@old% + \expandafter\let\csname#1\endcsname\TD@local@new% + \fi +}% +\def\TD@docswitchlist{}% +\def\TD@docswitch#1{% + \TD@info{Registering macro '#1' for diversion}% + \ifx\TD@docswitchlist\@empty% + \xdef\TD@docswitchlist{#1}% + \else% + \xdef\TD@docswitchlist{\TD@docswitchlist,#1}% + \fi% +}% +\AtBeginDocument{% + \TD@info{Diverting registered macros...}% + \@for\TD@cmd:=\TD@docswitchlist\do{% + \TD@switch{\TD@cmd}% + }% + \TD@info{Divertions done}% +}% +\def\TD@PackagePreDivert#1{% + \expandafter\def\csname TD@PackageStart@#1\endcsname ##1##2##3##4% +}% +\def\TD@PackagePostDivert#1{% + \expandafter\def\csname TD@PackageEnd@#1\endcsname ##1##2##3##4% +}% +\ifx\documentclass\@twoclasseserror + \PackageError{texdepends}{texdepends needs to be loaded BEFORE + \string\documentclass \MessageBreak + Use \string\RequirePackage\space instead of \string\usepackage + \MessageBreak as the later is not allowed before + \string\documentclass} +\fi +\TD@printPackage{texdepends} +\TD@printGraphicspath{{.}} +\def\TD@depends{}% +\def\TD@dependsWarning{% + \PackageWarningNoLine{texdepends}{Figure(s) missing. Check + dependencies again}% +}% +\def\TD@missingDepends{% + \global\let\TD@depends\TD@dependsWarning% +}% +\AtEndDocument{% + \TD@depends% +}% +\def\TD@@fileswith@pti@ns#1[#2]#3[#4]{% + \ifx#1\@clsextension + \TD@printClass{#3} + \fi + \TD@orig@@fileswith@pti@ns{#1}[#2]{#3}[#4]% +}% +\let\TD@@@fileswith@pti@ns\TD@@fileswith@pti@ns +\TD@switch{@fileswith@pti@ns}% +\TD@switch{@@fileswith@pti@ns}% +\def\TD@@onefilewithoptions#1[#2][#3]#4{% + \TD@printPackage{#1}% + \ifthenelse{\equal{#1}{texdepends}}{% + \TD@debug{Package '#1' detected} + \@for\TD@package@option:=#2\do{% + \ifthenelse{\expandafter\isundefined\csname TD@option@\TD@package@option\endcsname}{ + \TD@warningLine{Ignoring unknown option '\TD@package@option'} + }{ + \ifthenelse{% + \equal{\TD@package@option}{debug}% + %\OR\equal{\TD@package@option}{debug}% + }{ + \csname TD@option@\TD@package@option\endcsname% + }{ + \TD@warningLine{Ignoring option '\TD@package@option' + \MessageBreak #1 already loaded + } + } + } + } + }{% + \expandafter\let\expandafter\TD@divert + \csname TD@PackageStart@#1\endcsname + \ifx\TD@divert\relax + \TD@debug{No preamble for package #1} + \else + \TD@info{Preamble for package #1} + \TD@divert{#1}{#2}{#3}{#4}% + \fi + \TD@orig@@onefilewithoptions{#1}[#2][#3]{#4}% + \expandafter\let\expandafter\TD@divert + \csname TD@PackageEnd@#1\endcsname + \ifx\TD@divert\relax + \TD@debug{No postamble for package #1} + \else + \TD@info{Postamble for package #1} + \TD@divert{#1}{#2}{#3}{#4}% + \fi + }% +}% +\TD@switch{@onefilewithoptions}% +\def\TD@@iinput#1{% + \TD@printInput{#1}% + \TD@orig@@iinput{#1}}% +\def\TD@@input@#1{% + \IfFileExists{#1}{% + \TD@printInput{#1}% + }{}% + \TD@orig@@input@{#1}}% +\TD@switch{@iinput}% +\TD@switch{@input@}% +\def\TD@verbatiminput#1{% + \TD@printInput{#1}% + \TD@orig@verbatiminput{#1}}% +\TD@PackagePostDivert{verbatim}{% + \TD@switch{verbatiminput}}% +\let\TD@orig@openout\openout +\def\TD@openout#1{% + \@ifnextchar={\TD@openout@eq#1}{\TD@openout@noeq#1}} +\def\TD@openout@eq#1=#2.#3{% + \TD@printOut{#2.#3}% + \TD@orig@openout#1=#2.#3% +}% +\def\TD@openout@noeq#1#2.#3{% + \TD@printOut{#2.#3}% + \TD@orig@openout#1#2.#3% +}% + %\TD@switch{openout} +\def\TD@bibli@bbl{% + \TD@printBblfile{\jobname}% + \global\let\TD@bibli@bbl\relax% +}% +\def\TD@bibli@files#1{% + \TD@bibli@bbl% + \@for\TD@bibfile:=#1\do{% + \TD@printBibfile{\TD@bibfile}% + }% +} +\def\TD@bibli@style#1{% + \TD@bibli@bbl% + %\@for\TD@bibstyle:=#1\do{% + % \TD@printBibstyle{\TD@bibstyle}% + %} + \TD@printBibstyle{#1}% +} +\def\TD@bibliography#1{% + \TD@bibli@files{#1}% + \TD@orig@bibliography{#1}% +}% +\def\TD@bibliographystyle#1{% + \TD@bibli@style{#1}% + \TD@orig@bibliographystyle{#1}% +}% +\TD@docswitch{bibliography}% +\TD@switch{bibliographystyle}% +\def\TD@makeindex{% + \TD@printIndex{\jobname}% + \TD@printIndexSource{\jobname}{\jobname.idx}% + \TD@orig@makeindex% +}% +\def\TD@makeglossary{% + \TD@printGlossary{\jobname}% + \TD@printGlossarySource{\jobname}{\jobname.glo}% + \TD@orig@makeglossary% +}% +\TD@switch{makeindex}% +\TD@switch{makeglossary}% +\def\TD@Gin@getbase#1{% + \TD@orig@Gin@getbase{#1}% + \ifx\Gin@ext\relax% + \else% + \TD@printFig{\Gin@base\Gin@ext}% + \fi% +}% +\def\TD@Ginclude@eps#1{% + \IfFileExists{#1}{% + \TD@orig@Ginclude@eps{#1}% + }{% + \PackageWarning{texdepends}{Figure '#1' needed\MessageBreak + Skipping it this time (the last one however)\MessageBreak}% + \TD@missingDepends% + \TD@printRequiredFile{#1}% + }% +}% +\def\TD@Ginclude@pdf#1{% + \IfFileExists{#1}{% + \TD@orig@Ginclude@pdf{#1}% + }{% + \PackageWarning{texdepends}{Figure '#1' needed\MessageBreak + Skipping it this time (the last one however)\MessageBreak}% + \TD@missingDepends% + \TD@printRequiredFile{#1}% + }% +}% +\def\TD@graphicspath#1{% + \TD@printGraphicspath{#1}% + \TD@orig@graphicspath{#1}% +}% +\def\TD@Gread@eps#1{% + \IfFileExists{#1}{% + %\PackageWarning{texdepends}{Gread File '#1' exists}% + \TD@orig@Gread@eps{#1}% + }{% + \PackageWarning{texdepends}{No '#1' file \MessageBreak + using 1 for graphic dimensions}% + \setbox\@tempboxa\hbox{\relax}% + \def\Gin@llx{1}\let\Gin@lly\Gin@llx + \Gin@defaultbp\Gin@urx{\wd\@tempboxa}% + \Gin@defaultbp\Gin@ury{\ht\@tempboxa}% + }% +}% +\def\TD@Gread@pdf#1{% + \IfFileExists{#1}{% + %\PackageWarning{texdepends}{Gread File '#1' exists}% + \TD@orig@Gread@pdf{#1}% + }{% + \PackageWarning{texdepends}{No '#1' file \MessageBreak + using 1 for graphic dimensions}% + \setbox\@tempboxa\hbox{\relax}% + \def\Gin@llx{1}\let\Gin@lly\Gin@llx + \Gin@defaultbp\Gin@urx{\wd\@tempboxa}% + \Gin@defaultbp\Gin@ury{\ht\@tempboxa}% + }% +}% +\TD@PackagePostDivert{graphics}{% + \TD@switch{graphicspath}% + \TD@docswitch{Gin@getbase}% + \TD@docswitch{Ginclude@eps}% + \TD@docswitch{Ginclude@pdf}% + \TD@docswitch{Gread@eps}% + \TD@docswitch{Gread@pdf}% +}% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\def\TD@FL@includerawtexgraphics[#1]#2{% + \IfFileExists{#2}{% + \TD@orig@FL@includerawtexgraphics[#1]{#2}% + }{% + \PackageWarning{texdepends}{Figure '#2' needed\MessageBreak + Skipping it this time (the last one however)\MessageBreak}% + \TD@missingDepends% + \TD@printRequiredFile{#2}% + }% +}% + +\def\TD@Ginclude@rawtex#1{% + \IfFileExists{#1}{% + \TD@orig@Ginclude@rawtex{#1}% + }{% + \PackageWarning{texdepends}{Figure '#1' needed\MessageBreak + Skipping it this time (the last one however)\MessageBreak}% + \TD@missingDepends% + \TD@printRequiredFile{#1}% + }% +}% + +\def\TD@Ginclude@figtex#1{% + \IfFileExists{#1}{% + %\PackageWarning{texdepends}{Ginclude File '#1' exists}% + \TD@orig@Ginclude@figtex{#1}% + }{% + \ifthenelse{\isundefined{\FL@subfig@mainfigname}}{% + \PackageWarning{texdepends}{Figure '#1' needed\MessageBreak + Skipping it this time (the last one however)\MessageBreak}% + }{% + \PackageWarning{texdepends}{SubFigure '#1' from + \FL@subfig@mainfigname needed\MessageBreak + Skipping it this time (the last one however)\MessageBreak}% + } + \TD@missingDepends% + \TD@printRequiredFile{#1}% + }% +}% +\def\TD@Ginclude@svgtex#1{% + \IfFileExists{#1}{% + %\PackageWarning{texdepends}{Ginclude File '#1' exists}% + \TD@orig@Ginclude@svgtex{#1}% + }{% + \ifthenelse{\isundefined{\FL@subfig@mainfigname}}{% + \PackageWarning{texdepends}{Figure '#1' needed\MessageBreak + Skipping it this time (the last one however)\MessageBreak}% + }{% + \PackageWarning{texdepends}{SubFigure '#1' from + \FL@subfig@mainfigname needed\MessageBreak + Skipping it this time (the last one however)\MessageBreak}% + } + \TD@missingDepends% + \TD@printRequiredFile{#1}% + }% +}% + +\def\TD@Gread@figtex#1{% + \IfFileExists{#1}{% + %\PackageWarning{texdepends}{Gread File '#1' exists}% + \TD@orig@Gread@figtex{#1}% + }{% + \PackageWarning{texdepends}{No '#1' file \MessageBreak + using 1 for graphic dimensions}% + \setbox\@tempboxa\hbox{\relax}% + \def\Gin@llx{1}\let\Gin@lly\Gin@llx + \Gin@defaultbp\Gin@urx{\wd\@tempboxa}% + \Gin@defaultbp\Gin@ury{\ht\@tempboxa}% + }% +}% + +\def\TD@Gread@svgtex#1{% + \IfFileExists{#1}{% + %\PackageWarning{texdepends}{Gread File '#1' exists}% + \TD@orig@Gread@svgtex{#1}% + }{% + \PackageWarning{texdepends}{No '#1' file \MessageBreak + using 1 for graphic dimensions}% + \setbox\@tempboxa\hbox{\relax}% + \def\Gin@llx{1}\let\Gin@lly\Gin@llx + \Gin@defaultbp\Gin@urx{\wd\@tempboxa}% + \Gin@defaultbp\Gin@ury{\ht\@tempboxa}% + }% +}% +\def\TD@FL@subfig@check#1{% + \TD@printRequiredFile{#1}% + \TD@printSubfig{#1}% +}% +\TD@PackagePostDivert{figlatex}{% + \TD@docswitch{FL@includerawtexgraphics}% + \TD@docswitch{Ginclude@rawtex}% + \TD@docswitch{Ginclude@figtex}% + \TD@docswitch{Ginclude@svgtex}% + \TD@docswitch{Gread@figtex}% + \TD@docswitch{Gread@svgtex}% + \TD@docswitch{FL@subfig@check}% +}% +\def\TD@PrintIndex{% + \TD@printIndexStyle{\jobname}{gind.ist} + \TD@printIndexTarget{\jobname}{\jobname.ind} + \TD@orig@PrintIndex% +}% +\def\TD@PrintChanges{% + \TD@printGlossaryStyle{\jobname}{gglo.ist} + \TD@printGlossaryTarget{\jobname}{\jobname.gls} + \TD@orig@PrintChanges% +}% +\TD@PackagePostDivert{doc}{% + \TD@docswitch{PrintIndex}% + \TD@docswitch{PrintChanges}% +}% +\def\TD@def@index#1#2#3#4{% + \TD@printIndex{#2}% + \TD@printIndexSource{#2}{\jobname.#3}% + \TD@printIndexTarget{#2}{\jobname.#4} + \TD@orig@def@index{#1}{#2}{#3}{#4}% +}% +\TD@PackagePostDivert{index}{% + \TD@switch{def@index}% +}% +\def\TD@printindex{% + \TD@printIndexTarget{\jobname}{\jobname.ind} + \TD@orig@printindex% +}% +\TD@PackagePostDivert{makeidx}{% + \TD@docswitch{printindex}% +}% +\def\TD@printglossary{% + \TD@printGlossaryTarget{\jobname}{\jobname.gls} + \TD@orig@printglossary% +}% +\TD@PackagePostDivert{nomencl}{% + \TD@docswitch{printglossary}% + \TD@switch{makeglossary}% + \TD@printGlossaryStyle{\jobname}{nomencl.ist} +}% +\def\TD@btSect{% + \@ifnextchar[{\TD@btSect@opt}{\TD@btSect@noopt}} +\def\TD@btSect@opt[#1]#2{% + \TD@bibli@files{#2}% + \TD@bibli@style{#1}% + \TD@orig@btSect[#1]{#2}} +\def\TD@btSect@noopt#1{% + \TD@bibli@files{#1}% + \TD@orig@btSect{#1}} + +\def\TD@@bt@write@auxfile{% + \TD@printBblfile{\thebtauxfile}% + \TD@orig@@bt@write@auxfile% +}% +\TD@PackagePostDivert{bibtopic}{% + \global\let\TD@bibli@bbl\relax% + \global\let\TD@biblio@rules@package\TD@biblio@rules@package@bibtopic% + \TD@switch{@bt@write@auxfile}% + \TD@printOut{btbbl.aux}% + \TD@printRebuildRule{bibtopic}% + \TD@docswitch{btSect}% +}% +\endinput +%% +%% End of file `texdepends.sty'. diff --git a/Master/texmf-dist/tex/latex/latex-make/texgraphicx.sty b/Master/texmf-dist/tex/latex/latex-make/texgraphicx.sty new file mode 100644 index 00000000000..911070e7cdd --- /dev/null +++ b/Master/texmf-dist/tex/latex/latex-make/texgraphicx.sty @@ -0,0 +1,52 @@ +%% +%% This is file `texgraphicx.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% figlatex.dtx (with options: `compat') +%% +%% IMPORTANT NOTICE: +%% +%% For the copyright see the source file. +%% +%% Any modified versions of this file must be renamed +%% with new filenames distinct from texgraphicx.sty. +%% +%% For distribution of the original source see the terms +%% for copying and modification in the file figlatex.dtx. +%% +%% This generated file may be distributed as long as the +%% original source files, as listed above, are part of the +%% same distribution. (The sources need not necessarily be +%% in the same archive or directory.) +%% +%% File: figlatex.dtx Copyright (C) 2002--2005 V. Danjean, A. Legrand +%% Vincent.Danjean@ens-lyon.org +%% Arnaud.Legrand@ens-lyon.org +%% +%% This program is free software; you can redistribute it and/or +%% modify it under the terms of the GNU General Public License +%% as published by the Free Software Foundation; either version 2 +%% of the License, or (at your option) any later version. +%% +%% This program is distributed in the hope that it will be useful, +%% but WITHOUT ANY WARRANTY; without even the implied warranty of +%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +%% GNU General Public License for more details. +%% +%% You should have received a copy of the GNU General Public License +%% along with this program; if not, write to the Free Software +%% Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +%% + \ProvidesPackage{texgraphicx}% +[2011/09/25 v0.1.4 include fig and svg in LaTeX] +\PackageWarning{texgraphicx}{'texgraphicx' is now + deprecated\MessageBreak% + Please, consider switching to 'figlatex' + package\MessageBreak} +\RequirePackage{figlatex} +\ProcessOptions +\endinput +%% +%% End of file `texgraphicx.sty'. |