################################################################## # Fake various .sty files. # # # # There are three reasons for these fake .sty files: # # (1) Enable a package to work with an unsupported TeX engine. # # (2) Prevent naming conflicts. # # (3) Improve package performance. # # # # Author: Scott Pakin # ################################################################## rule make-fake-sty command = $ base="$$(echo $in | cut -c9-)" ; $ script="$$(readlink -f $in)" ; $ if [ "$$(kpsewhich $$base.sty)" ] ; then $ $$script $$(kpsewhich $$base.sty) > $out ; $ else $ $$script /dev/null > $out ; $ fi description = Creating $out build fakeMnSymbol.sty : make-fake-sty makefakeMnSymbol build fakefdsymbol.sty : make-fake-sty makefakefdsymbol build fakeboisik.sty : make-fake-sty makefakeboisik build fakestix.sty : make-fake-sty makefakestix build fakestarfont.sty : make-fake-sty makefakestarfont build fakecmupint.sty : make-fake-sty makefakecmupint build fakeasapsym.sty | Asap-Symbol.pfb fakeasapsym.enc fakeasapsym.tfm : make-fake-sty makefakeasapsym rule make-fake-lualatex-sty command = $ if [ "$$(kpsewhich $pkg.sty)" ] ; then $ echo $$($before-cmds) ; $ ./makefakelualatex $extra-args $pkg $font ; $ echo $$($after-cmds) ; $ else $ touch $out ; $ fi description = Creating $out and related .enc and .tfm files build faketypicons.sty | faketypiconsA.enc faketypiconsA.tfm faketypiconsB.enc faketypiconsB.tfm : make-fake-lualatex-sty pkg = typicons font = typicons.ttf after-cmds = $ sed -i $ -e 's,{\\tiCss},{\\tiCss}[1],' $ -e 's,{\\tiHtml},{\\tiHtml}[1],' $ faketypicons.sty build fakefontmfizz.sty | fakefontmfizz.enc fakefontmfizz.tfm : make-fake-lualatex-sty pkg = fontmfizz font = font-mfizz.ttf build fakehamnosys.sty | fakehamnosys.enc fakehamnosys.tfm : make-fake-lualatex-sty pkg = hamnosys font = HamNoSysUnicode.ttf extra-args = --regexp='\\DeclareTextCommand\{\\(?Pham\w+)\}.*?\\char\s*\"(?P[0-9A-F]+)' build fakelogix.sty | $ Logix.pfb $ fakelogixA.enc $ fakelogixA.tfm $ fakelogixB.enc $ fakelogixB.tfm $ fakelogixC.enc $ fakelogixC.tfm $ fakelogixD.enc $ fakelogixD.tfm $ fakelogixE.enc $ fakelogixE.tfm : $ make-fake-lualatex-sty pkg = logix font = logix.otf extra-args = $ --regexp='\\newcommand\s*\\(?P[A-Z]\w+)\s*\{\\lg[lrmx]\{(?P[0-9A-F]+)\}' $ --regexp='\\defineDelimiter\s*\{(?P[A-Z]\w+)\}\s*\{(?P[0-9A-F]+)\} ; Big ; 0x2' # If we have symbats3.sty, generate a faked version that works with # pdfLaTeX. The first challenge is that the package name contains a number # (3), which leads fakesymbats3.sty to define font commands \fakesymbats3A # and \fakesymbats3B, which have invalid names. The solution is to rename # them to \fakesymbatsiiiA and \fakesymbatsiiiB. The second challenge is # that symbols beginning with "\RU@" or "\OG@" are exposed to the user with # an RU or OG prefix, but symbols beginning with "\SY@" are exposed without # a prefix. The solution is manually to add an "RU" or "OG" prefix. (This # is needed because some of the symbols have short names, like "c".) Then, # *all* symbols are prefixed with "SMBT" to avoid name collisions with # other packages. build fakesymbats3.sty | $ Symbats-Regular.pfb $ fakesymbats3A.enc $ fakesymbats3A.tfm $ fakesymbats3B.enc $ fakesymbats3B.tfm : $ make-fake-lualatex-sty pkg = symbats3 font = Symbats-Regular.otf before-cmds = $ sed -e 's/\\RU@/\\RU@RU/g' $ -e 's/\\OG@/\\OG@OG/g' $ "$$(kpsewhich symbats3.sty)" > symbats3.sty extra-args = $ --prefix=SMBT $ --regexp='DeclareTextSymbol.*?(SY|OG|RU)@(?P[A-Za-z]+).*?\{"(?P[0-9A-F]{4})\}' after-cmds = $ sed -i -e 's/\\fakesymbats3/\\fakesymbatsiii/g' fakesymbats3.sty ; $ rm -f symbats3.sty build fakecasiofont.sty | fakecasiofont.enc fakecasiofont.tfm : make-fake-lualatex-sty pkg = casiofont font = CASIOClassWiz.ttf before-cmds = perl -ne 'm,\\newcommand\*\{\\(\w+).*\\casio\s*\\?(.), && printf "%s %x\n", $$1, ord($$2); /\\ProvidesPackage/ && print' "`kpsewhich casiofont.sty`" > casiofont.sty extra-args = --prefix=CASIO --regexp='(?P\w+) (?P[0-9a-f]+)' after-cmds = rm -f casiofont.sty # If we have knitting.sty, generate a truncated version that excludes # some catcode trickery which breaks mylatex.ltx. rule make-fake-knitting command = $ echo "% This is a truncated version of knitting.sty for use only" > $out ; $ echo "% with the Comprehensive LaTeX Symbol List." >> $out ; $ echo "" >> $out ; $ if [ "$$(kpsewhich knitting.sty)" ] ; then $ cat $$(kpsewhich knitting.sty) | sed '/Standard chart commands/,$$d' >> $out ; $ fi description = Creating $out build fakeknitting.sty : make-fake-knitting # If we have wasysym.sty, generate a version that declares symbols with # \DeclareRobustCommand instead of \def. This keeps expansions like # "{\fontencoding{U}\fontfamily{wasy}\selectfont\char48}" out of the index, # favoring the control sequence (in this case, \agemO) instead. rule make-fake-wasysym command = $ echo "%% This is a generated file. DO NOT EDIT." > $out ; $ echo "%% Edit $$(readlink -f fake-sty.ninja) instead." >> $out ; $ wasy="$$(kpsewhich wasysym.sty)" ; $ if [ "$$wasy" ] ; then $ echo "" >> $out ; $ perl -ne 's/^\\def([^#]+)$$/\\DeclareRobustCommand\1/; s/\\(lightning|Box|Diamond|clock|euro)\b/\\WASY$$1/; print' "$$wasy" >> $out ; $ fi description = Creating $out build fakewasysym.sty : make-fake-wasysym # Based on the existance of newcomputermodern.sty and the value of # $LATEX, determine what helper files makefakenewcm will generate. rule predict-newcm-outputs command = $ echo "ninja_dyndep_version = 1" > $out ; $ if [ "$$(kpsewhich newcomputermodern.sty)" -a "$LATEX" = pdflatex ] ; then $ echo "build fakenewcomputermodern.sty | newcmsans.tfm newcmsans.enc NewCMSans10-Book.pfb : dyndep" >> $out ; $ else $ echo "build fakenewcomputermodern.sty : dyndep" >> $out ; $ fi description = Creating $out build newcmsans.dd : predict-newcm-outputs # Generate a fakenewcomputermodern.sty that either does nothing (if # newcomputermodern.sty is unavailable), defines a few symbol commands # (if LuaLaTeX is being used), or defines a few symbol commands that # point to a version of the OTF file converted to Type 1. rule make-fake-newcm command = ./makefakenewcm $LATEX description = Creating $out build fakenewcomputermodern.sty : make-fake-newcm makefakenewcm unicode.txt || newcmsans.dd dyndep = newcmsans.dd # The apl package's versatim.tex messes up TeX's category codes. # Hence, we override that file with a do-nothing version. rule make-fake-versatim command = $ echo "% Do-nothing replacement for the apl package's versatim.tex" > $out ; $ echo '\\endinput' >> $out description = Creating $out build versatim.tex : make-fake-versatim # Depend upon all .sty files generated above. build FAKE_STY : phony $ fakeasapsym.sty $ fakeboisik.sty $ fakecasiofont.sty $ fakecmupint.sty $ fakefdsymbol.sty $ fakefontmfizz.sty $ fakehamnosys.sty $ fakeknitting.sty $ fakelogix.sty $ fakeMnSymbol.sty $ fakenewcomputermodern.sty $ fakestarfont.sty $ fakestix.sty $ fakesymbats3.sty $ faketypicons.sty $ fakewasysym.sty $ versatim.tex