[rtems-docs commit] waf: Add support to handle missing Latex packages on hosts they are not available on.

Chris Johns chrisj at rtems.org
Sun Nov 6 01:06:17 UTC 2016


Module:    rtems-docs
Branch:    master
Commit:    8330198edc3ec08021f358c3030266194278c5a2
Changeset: http://git.rtems.org/rtems-docs/commit/?id=8330198edc3ec08021f358c3030266194278c5a2

Author:    Chris Johns <chrisj at rtems.org>
Date:      Sun Nov  6 12:02:47 2016 +1100

waf: Add support to handle missing Latex packages on hosts they are not available on.

It appears the support for texlive packages on some hosts is variable. This patch
lets us add missing packages to our source tree so a PDF can be built on
those hosts. The quality of the PDFs created may vary as some short cuts may
have been take. For example lato is a font and only the sty file as been added
and not the actual font which means it's use will default to another font.

---

 common/latex.py              | 145 ++++++++++++++++++++++
 common/latex/capt-of.sty     |  33 +++++
 common/latex/environ.sty     | 145 ++++++++++++++++++++++
 common/latex/eqparbox.sty    | 280 +++++++++++++++++++++++++++++++++++++++++++
 common/latex/ifplatform.sty  | 151 +++++++++++++++++++++++
 common/latex/inconsolata.sty |  92 ++++++++++++++
 common/latex/lato.sty        |  47 ++++++++
 common/latex/slantsc.sty     | 101 ++++++++++++++++
 common/latex/trimspaces.sty  |  58 +++++++++
 common/latex/upquote.sty     |  40 +++++++
 common/waf.py                | 116 ++++--------------
 11 files changed, 1113 insertions(+), 95 deletions(-)

diff --git a/common/latex.py b/common/latex.py
new file mode 100644
index 0000000..186a64f
--- /dev/null
+++ b/common/latex.py
@@ -0,0 +1,145 @@
+#
+# Support for Latex used to build the PDF output format.
+#
+
+import os
+import platform
+import re
+
+package_test_preamble = ['\\newif\\ifsphinxKeepOldNames \\sphinxKeepOldNamestrue',
+                         '\documentclass[a4paper,11pt,english]{report}']
+package_test_postamble = ['\\begin{document} test \\end{document}']
+package_tests = {
+    'Bjarne'         : ['\\usepackage[Bjarne]{fncychap}'],
+    'alltt'          : ['\\usepackage{alltt}'],
+    'amsmath'        : ['\\usepackage{amsmath}'],
+    'amssymb'        : ['\\usepackage{amssymb}'],
+    'amstext'        : ['\\usepackage{amstext}'],
+    'array'          : ['\\usepackage{array}'],
+    'atbegshi'       : ['\\usepackage{atbegshi}'],
+    'babel'          : ['\\usepackage{babel}'],
+    'babel'          : ['\\usepackage{babel}'],
+    'calc'           : ['\\usepackage{calc}'],
+    'capt-of'        : ['\\usepackage{capt-of}'],
+    'charter'        : ['\\usepackage{charter}'],
+    'cmap'           : ['\\usepackage{cmap}'],
+    'color'          : ['\\usepackage{color}'],
+    'eqparbox'       : ['\\usepackage{eqparbox}'],
+    'etoolbox'       : ['\\usepackage{etoolbox}'],
+    'fancybox'       : ['\\usepackage{fancybox}'],
+    'fancyhdr'       : ['\\usepackage{fancyhdr}'],
+    'fancyvrb'       : ['\\usepackage{fancyvrb}'],
+    'float'          : ['\\usepackage{float}'],
+    'fncychap'       : ['\\usepackage{fncychap}'],
+    'fontenc'        : ['\\usepackage[T1]{fontenc}'],
+    'footnote'       : ['\\usepackage{footnote}'],
+    'framed'         : ['\\usepackage{framed}'],
+    'graphicx'       : ['\\usepackage{graphicx}'],
+    'hypcap'         : ['\\usepackage{hyperref}',
+                        '\\usepackage{hypcap}'],
+    'hyperref'       : ['\\usepackage{hyperref}'],
+    'ifplatform'     : ['\\usepackage{ifplatform}'],
+    'ifthen'         : ['\\usepackage{ifthen}'],
+    'inconsolata'    : ['\\usepackage{inconsolata}'],
+    'inputenc'       : ['\\usepackage{inputenc}'],
+    'keyval'         : ['\\usepackage{keyval}'],
+    'kvoptions'      : ['\\usepackage{kvoptions}'],
+    'lato'           : ['\\usepackage{lato}'],
+    'lineno'         : ['\\usepackage{lineno}'],
+    'longtable'      : ['\\usepackage{longtable}'],
+    'makeidx'        : ['\\usepackage{makeidx}'],
+    'multirow'       : ['\\usepackage{multirow}'],
+    'parskip'        : ['\\usepackage{parskip}'],
+    'pdftexcmds'     : ['\\usepackage{pdftexcmds}'],
+    'textcomp'       : ['\\usepackage{textcomp}'],
+    'threeparttable' : ['\\usepackage{threeparttable}'],
+    'times'          : ['\\usepackage{times}'],
+    'titlesec'       : ['\\usepackage{titlesec}'],
+    'upquote'        : ['\\usepackage{upquote}'],
+    'utf8'           : ['\\usepackage[utf8]{inputenc}'],
+    'wrapfig'        : ['\\usepackage{wrapfig}'],
+    'xcolor'         : ['\\usepackage{xcolor}'],
+    'xstring'        : ['\\usepackage{xstring}'],
+}
+
+#
+# Add per host support. If there is a version clash for the same texlive
+# package create a directory, add to that directory and use the path in this
+# name here.
+#
+hosts = {
+    # All versions of CentOS until told otherwise
+    'Linux/centos' : { '.*' : ['capt-of.sty',
+                               'eqparbox.sty',
+                               'environ.sty',
+                               'inconsolata.sty',
+                               'ifplatform.sty',
+                               'lato.sty',
+                               'trimspaces.sty',
+                               'slantsc.sty',
+                               'upquote.sty'] }
+}
+
+def tex_test(test):
+    return os.linesep.join(package_test_preamble +
+                           package_tests[test] +
+                           package_test_postamble)
+
+def host_name():
+    uname = os.uname()
+    if uname[0] == 'Linux':
+        distro = platform.dist()
+        name = '%s/%s' % (uname[0], distro[0])
+        version = distro[1]
+    else:
+        name = uname[0]
+        version = uname[2]
+    return name, version
+
+def local_packages():
+    host, version = host_name()
+    packages = None
+    if host in hosts:
+        for version in list(hosts[host].keys()):
+            if re.compile(version).match(version) is not None:
+                packages = hosts[host][version]
+    return packages
+
+def configure_tests(conf):
+
+    #
+    # Using a hint from ita (thank you) :
+    #  https://github.com/waf-project/waf/blob/master/demos/tex/wscript
+    #
+    def build_latex_test(bld):
+        def write_tex_test(tsk):
+            tsk.outputs[0].write(tex_test(tsk.env.TEST))
+
+        test = bld.kw['tex_test']
+        bld.env.TEST = test
+
+        bld.to_log('%s.tex %s' % (test, '=' * (40 - len(test) + 5)))
+        bld.to_log(tex_test(test))
+        bld.to_log('=' * 40)
+
+        bld(rule = write_tex_test, target = 'main.tex')
+        bld(features = 'tex', type = 'pdflatex', source = 'main.tex', prompt = 0)
+
+    tests = sorted(package_tests.keys())
+    excludes = [p[:p.rfind('.')] for p in local_packages()]
+    for e in excludes:
+        if e in tests:
+            tests.remove(e)
+
+    fails = 0
+    for t in tests:
+        r = conf.test(build_fun = build_latex_test,
+                      msg = "Checking for Tex package '%s'" % (t),
+                      tex_test = t,
+                      okmsg = 'ok',
+                      errmsg = 'not found (please install)',
+                      mandatory = False)
+        if r is None:
+            fails += 1
+    if fails > 0:
+        conf.fatal('There are %d Tex package failures. Please fix.' % (fails))
diff --git a/common/latex/capt-of.sty b/common/latex/capt-of.sty
new file mode 100644
index 0000000..b40978a
--- /dev/null
+++ b/common/latex/capt-of.sty
@@ -0,0 +1,33 @@
+%%
+%% This is file `capt-of.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% capt-of.dtx  (with options: `package')
+%% ----------------------------------------------------------------------
+%% The capt-off package -- float-style captions outside of floats
+%% Copyright (c) 2010 Robin Fairbairns
+%% 
+%% This work may be distributed and/or modified under the conditions of the
+%% LaTeX Project Public License, either version 1.3c of this license or (at
+%% your option) any later version. The latest version of this license is in:
+%% http://www.latex-project.org/lppl.txt, and version 1.3c or later is part
+%% of all distributions of LaTeX version 2005/12/01 or later.
+%% 
+%% This work has the LPPL maintenance status `author-maintained'.
+%% 
+%% This work consists of the files capt-of.dtx, capt-of.ins, and README
+%% and the derived files footmisc.sty (not distributed from the archive)
+%% and footmisc.pdf.
+%% -----------------------------------------------------------------------
+%% 
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{capt-of}%
+        [2009/12/29 v0.2
+     standard captions outside of floats%
+         ]% $Id: footmisc.dtx,v 4.20 2005/03/17 13:41:58 rf Exp rf10 $
+\newcommand\captionof[1]{\def\@captype{#1}\caption}
+\endinput
+%%
+%% End of file `capt-of.sty'.
diff --git a/common/latex/environ.sty b/common/latex/environ.sty
new file mode 100644
index 0000000..8cf854b
--- /dev/null
+++ b/common/latex/environ.sty
@@ -0,0 +1,145 @@
+%%
+%% This is file `environ.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% environ.dtx  (with options: `package')
+%% 
+%%   __________________________________
+%%   Copyright (C) 2007  Will Robertson
+%% 
+%%   License information appended.
+%% 
+%% ^^A Test that \RenewEnvironment works correctly:
+\ProvidesPackage{environ}[2014/05/04 v0.3 A new way to define environments]
+\RequirePackage{trimspaces}
+\def\environbodyname#1{\def\env at BODY{#1}}
+\environbodyname\BODY
+\def\environfinalcode#1{%
+  \def\env at finalcode{#1}}
+\environfinalcode{\ignorespacesafterend}
+\def\longdef at c#1{%
+  \expandafter\long\expandafter\def\csname#1\endcsname}
+\unless\ifdefined\collect at body
+  \newtoks\@envbody
+  \def\collect at body#1{%
+    \@envbody{\expandafter#1\expandafter{\the\@envbody}}%
+    \edef\process at envbody{\the\@envbody\noexpand\end{\@currenvir}}%
+    \@envbody={}%
+    \def\begin at stack{b}%
+    \begingroup
+    \expandafter\let\csname\@currenvir\endcsname\collect@@body
+    \edef\process at envbody{%
+      \expandafter\noexpand\csname\@currenvir\endcsname}%
+    \process at envbody
+  }
+  \def\push at begins#1\begin#2{%
+    \ifx\end#2\else
+      b\expandafter\push at begins
+    \fi}
+  \def\addto at envbody#1{%
+    \global\@envbody\expandafter{\the\@envbody#1}}
+  \def\collect@@body#1\end#2{%
+    \edef\begin at stack{%
+      \push at begins#1\begin\end \expandafter\@gobble\begin at stack}%
+    \ifx\@empty\begin at stack
+      \endgroup
+      \@checkend{#2}%
+      \addto at envbody{#1}%
+    \else
+      \addto at envbody{#1\end{#2}}%
+    \fi
+    \process at envbody}
+\fi
+\long\def\Collect at Body#1{%
+  \@envbody{\expandafter#1\expandafter{\the\@envbody}}%
+  \edef\process at envbody{\the\@envbody\noexpand\end{\@currenvir}}%
+  \@envbody={}%
+  \def\begin at stack{b}%
+  \begingroup
+  \expandafter\let\csname\@currenvir\endcsname\Collect@@Body
+  \edef\process at envbody{%
+    \expandafter\noexpand\csname\@currenvir\endcsname}%
+  \process at envbody
+}
+\long\def\Push at Begins#1\begin#2{%
+  \ifx\end#2\else
+    b\expandafter\Push at Begins
+  \fi}
+\long\def\Addto at Envbody#1{%
+  \global\@envbody\expandafter{\the\@envbody#1}}
+\long\def\Collect@@Body#1\end#2{%
+  \edef\begin at stack{%
+    \Push at Begins#1\begin\end\expandafter\@gobble\begin at stack}%
+  \ifx\@empty\begin at stack
+    \endgroup
+    \@checkend{#2}%
+    \Addto at Envbody{#1}%
+  \else
+    \Addto at Envbody{#1\end{#2}}%
+  \fi
+  \process at envbody}
+\def\NewEnviron{%
+  \let\env at newenvironment\newenvironment
+  \env at NewEnviron}
+\def\RenewEnviron{%
+  \let\env at newenvironment\renewenvironment
+  \env at NewEnviron}
+\def\env at NewEnviron#1{%
+  \@ifnextchar[
+    {\env at new@i{#1}}
+    {\env at new@iii{#1}{}}}
+\def\env at new@i#1[#2]{%
+  \@ifnextchar[
+    {\env at new@ii{#1}[#2]}
+    {\env at new@iii{#1}{[#2]}}}
+\def\env at new@ii#1[#2][#3]{%
+  \env at new@iii{#1}{[#2][#3]}}
+\long\def\env at new@iii#1#2#3{%
+  \@temptokena={\env at new{#1}{#2}{#3}}%
+  \@ifnextchar[{%
+    \the\@temptokena
+  }{%
+    \expandafter\the\expandafter
+      \@temptokena\expandafter[\env at finalcode]%
+  }}
+\long\def\env at new#1#2#3[#4]{%
+  \longdef at c{env@#1 at BODY\expandafter}\expandafter{\env at BODY}%
+  \env at newenvironment{#1}{%
+    \expandafter\Collect at Body\csname env@#1 at parse\endcsname
+  }{#4}%
+  \longdef at c{env@#1 at parse}##1{%
+    \csname env@#1 at save@env\endcsname##1\env at nil
+    \csname env@#1 at process\endcsname##1\env at nil}%
+  \expandafter\let\csname env@#1 at save@env\endcsname\relax
+  \expandafter\let\csname env@#1 at process\endcsname\relax
+  \expandafter\newcommand
+    \csname env@#1 at save@env\endcsname#2{%
+      \expandafter\expandafter\expandafter
+        \env at save\csname env@#1 at BODY\endcsname}%
+  \expandafter\newcommand
+    \csname env@#1 at process\endcsname#2{#3\env at ignore}%
+}
+\long\def\env at save#1#2\env at nil{%
+  \edef#1{%
+    \unexpanded\expandafter
+      \expandafter\expandafter{\trim at spaces{#2}}}}
+\long\def\env at ignore#1\env at nil{}
+%% 
+%% Copyright (C) 2007-2014 by Will Robertson <wspr81 at gmail.com>
+%% 
+%% Distributable under the LaTeX Project Public License,
+%% version 1.3c or higher (your choice). The latest version of
+%% this license is at: http://www.latex-project.org/lppl.txt
+%% 
+%% This work is "maintained" (as per LPPL maintenance status)
+%% by Will Robertson.
+%% 
+%% This work consists of the file  environ.dtx
+%%           and the derived files environ.pdf,
+%%                                 environ.sty, and
+%%                                 environ.ins.
+%% 
+%%
+%% End of file `environ.sty'.
diff --git a/common/latex/eqparbox.sty b/common/latex/eqparbox.sty
new file mode 100644
index 0000000..2f9749c
--- /dev/null
+++ b/common/latex/eqparbox.sty
@@ -0,0 +1,280 @@
+%%
+%% This is file `eqparbox.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% eqparbox.dtx  (with options: `package')
+%% 
+%% This is a generated file.
+%% 
+%% Copyright (C) 2013 Scott Pakin <scott+eqp at pakin.org>
+%% -------------------------------------------------------
+%% 
+%% This package may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.2
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%%    http://www.latex-project.org/lppl.txt
+%% and version 1.3c or later is part of all distributions of LaTeX
+%% version 2008/05/04 or later.
+%% 
+\NeedsTeXFormat{LaTeX2e}[1999/12/01]
+\ProvidesPackage{eqparbox}
+    [2013/03/15 v4.0 Create equal-widthed boxes]
+\newlength{\eqp at tempdima}
+\newlength{\eqp at tempdimb}
+\def\eqp at taglist{}
+\newif\ifeqp at must@rerun
+\RequirePackage{array}
+\newsavebox{\eqp at tabular@box}
+\newsavebox{\eqp at list@box}
+\newlength{\eqp at list@indent}
+\RequirePackage{environ}
+\newcommand*{\eqp at storefont}{%
+  \xdef\eqp at restorefont{%
+    \noexpand\usefont{\f at encoding}{\f at family}{\f at series}{\f at shape}%
+    \noexpand\fontsize{\f at size}{\f at baselineskip}%
+    \noexpand\selectfont
+  }%
+}
+\newcommand{\eqp at settowidth}[2]{%
+  \begingroup
+    \global\setbox\eqp at tabular@box=\hbox{%
+      \def\eqp at endings{}%
+      \ifx\enditemize\endlist
+        \g at addto@macro\eqp at endings{\let\enditemize=\endlist}%
+      \fi
+      \ifx\endenumerate\endlist
+        \g at addto@macro\eqp at endings{\let\endenumerate=\endlist}%
+      \fi
+      \ifx\enddescription\endlist
+        \g at addto@macro\eqp at endings{\let\enddescription=\endlist}%
+      \fi
+      \renewenvironment{list}[2]{%
+        \ifnum \@listdepth >5\relax
+          \@toodeep
+        \else
+          \global\advance\@listdepth\@ne
+        \fi
+        \rightmargin\z@
+        \listparindent\z@
+        \itemindent\z@
+        \csname @list\romannumeral\the\@listdepth\endcsname
+        ##2\relax
+        \renewcommand*{\item}[1][]{%
+          \mbox{}\\
+          \box\eqp at list@box\mbox{} \\
+          \sbox\@tempboxa{\makelabel{####1}}%
+          \ifdim\wd\@tempboxa>\labelwidth
+            \advance\eqp at list@indent by -\labelwidth
+            \advance\eqp at list@indent by \wd\@tempboxa
+          \fi
+          \hspace*{\eqp at list@indent}%
+        }%
+        \hspace*{-\eqp at list@indent}%
+        \advance\eqp at list@indent by \leftmargin
+        \advance\eqp at list@indent by \rightmargin
+        \advance\eqp at list@indent by \itemindent
+        \global\setbox\eqp at list@box=\hbox\bgroup
+        \begin{tabular}{@{}l@{}}%
+      }{%
+        \item[]%
+        \end{tabular}%
+        \egroup
+        \global\advance\@listdepth\m at ne
+      }%
+      \eqp at endings
+      \global\let\eqp at par=\par
+      \eqp at storefont
+      \begin{tabular}{@{}>{\eqp at restorefont}l<{\eqp at storefont}@{}}%
+        \global\@setpar{\\}%
+        #2%
+        \\ \box\eqp at list@box
+      \end{tabular}%
+      \global\@restorepar
+    }%
+  \endgroup
+  \settowidth{#1}{\box\eqp at tabular@box}%
+}
+\long\def\eqp at compute@width#1#2{%
+  \eqp at settowidth{\eqp at tempdimb}{#2}%
+  \@ifundefined{eqp at minwd@#1}{}{%
+    \ifdim\eqp at tempdimb<\csname eqp at minwd@#1\endcsname
+      \eqp at tempdimb=\csname eqp at minwd@#1\endcsname
+    \fi
+  }%
+  \@ifundefined{eqp at maxwd@#1}{}{%
+    \ifdim\eqp at tempdimb>\csname eqp at maxwd@#1\endcsname
+      \eqp at tempdimb=\csname eqp at maxwd@#1\endcsname
+    \fi
+  }%
+  \expandafter
+  \ifx\csname eqp at this@#1\endcsname\relax
+    \global\eqp at must@reruntrue
+    \expandafter\xdef\csname eqp at this@#1\endcsname{\the\eqp at tempdimb}%
+    \expandafter\xdef\csname eqp at next@#1\endcsname{\the\eqp at tempdimb}%
+  \else
+    \eqp at tempdima=\csname eqp at this@#1\endcsname\relax
+    \ifdim\eqp at tempdima<\eqp at tempdimb
+      \expandafter\xdef\csname eqp at this@#1\endcsname{\the\eqp at tempdimb}%
+      \global\eqp at must@reruntrue
+    \fi
+    \eqp at tempdima=\csname eqp at next@#1\endcsname\relax
+    \ifdim\eqp at tempdima<\eqp at tempdimb
+      \expandafter\xdef\csname eqp at next@#1\endcsname{\the\eqp at tempdimb}%
+    \fi
+  \fi
+  \@ifundefined{eqp at seen@#1}{%
+    \expandafter\gdef\csname eqp at seen@#1\endcsname{}%
+    \@cons\eqp at taglist{{#1}}%
+  }{}%
+  \eqp at tempdima=\csname eqp at this@#1\endcsname\relax
+  \eqp at produce@box{\eqp at tempdima}{#2}%
+}
+\DeclareRobustCommand{\eqparbox}{%
+  \@ifnextchar[%]
+    {\eqparbox at i}%
+    {\eqparbox at iii[c][\relax][s]}%
+}
+\def\eqparbox at i[#1]{%
+  \@ifnextchar[%]
+    {\eqparbox at ii[#1]}%
+    {\eqparbox at iii[#1][\relax][s]}%
+}
+\def\eqparbox at ii[#1][#2]{%
+  \@ifnextchar[%]
+    {\eqparbox at iii[#1][#2]}%
+    {\eqparbox at iii[#1][#2][#1]}%
+}
+\def\eqparbox at iii[#1][#2][#3]{%
+  \long\gdef\eqp at produce@box##1##2{%
+    \parbox[#1][#2][#3]{##1}{##2}%
+  }%
+  \eqp at compute@width
+}
+\DeclareRobustCommand{\eqminipage}{%
+  \@ifnextchar[%]
+    {\eqminipage at i}%
+    {\eqminipage at iii[c][\relax][s]}%
+}
+\let\endeqpminipage=\relax
+\long\def\eqminipage at i[#1]{%
+  \@ifnextchar[%]
+    {\eqminipage at ii[#1]}%
+    {\eqminipage at iii[#1][\relax][s]}%
+}
+\def\eqminipage at ii[#1][#2]{%
+  \@ifnextchar[%]
+    {\eqminipage at iii[#1][#2]}%
+    {\eqminipage at iii[#1][#2][#1]}%
+}
+\def\eqminipage at iii[#1][#2][#3]#4{%
+  \long\def\eqminipage at iv##1{%
+    \long\gdef\eqp at produce@box####1####2{%
+      \begin{minipage}[#1][#2][#3]{####1}%
+        ####2%
+      \end{minipage}%
+    }%
+    \eqp at compute@width{#4}{##1}%
+  }%
+  \Collect at Body\eqminipage at iv
+}
+\DeclareRobustCommand{\eqmakebox}{%
+  \@ifnextchar[%]
+    {\eqlrbox at i\makebox}%
+    {\makebox}%
+}
+\DeclareRobustCommand{\eqframebox}{%
+  \@ifnextchar[%]
+    {\eqlrbox at i\framebox}%
+    {\framebox}%
+}
+\DeclareRobustCommand{\eqsavebox}[1]{%
+  \@ifnextchar[%]
+    {\eqlrbox at i{\savebox{#1}}}%
+    {\savebox{#1}}%
+}
+\def\eqlrbox at i#1[#2]{%
+  \@ifnextchar[%]
+    {\eqlrbox at ii{#1}[#2]}%
+    {\eqlrbox at ii{#1}[#2][c]}%
+}
+\def\eqlrbox at ii#1[#2][#3]{%
+  \long\gdef\eqp at produce@box##1##2{%
+    #1[##1][#3]{##2}%
+  }%
+  \eqp at compute@width{#2}%
+}
+\newcommand*{\eqboxwidth}[1]{%
+  \@ifundefined{eqp at this@#1}{0pt}{\csname eqp at this@#1\endcsname}%
+}
+\newcommand{\eqsetminwidth}[2]{%
+  \@tempdima=#2\relax
+  \expandafter\xdef\csname eqp at minwd@#1\endcsname{\the\@tempdima}%
+}
+\newcommand{\eqsetmaxwidth}[2]{%
+  \@tempdima=#2\relax
+  \expandafter\xdef\csname eqp at maxwd@#1\endcsname{\the\@tempdima}%
+}
+\newcommand{\eqsetminwidthto}[2]{%
+  \eqp at settowidth{\@tempdima}{#2}%
+  \expandafter\xdef\csname eqp at minwd@#1\endcsname{\the\@tempdima}%
+}
+\newcommand{\eqsetmaxwidthto}[2]{%
+  \eqp at settowidth{\@tempdima}{#2}%
+  \expandafter\xdef\csname eqp at maxwd@#1\endcsname{\the\@tempdima}%
+}
+\AtEndDocument{%
+  \begingroup
+    \def\@elt#1{%
+      \@ifundefined{eqp at minwd@#1}{}{%
+        \@ifundefined{eqp at maxwd@#1}{}{%
+          \ifdim\csname eqp at minwd@#1\endcsname>\csname eqp at maxwd@#1\endcsname
+            \PackageWarning{eqparbox}{For tag `#1',
+              minimum width (\csname eqp at minwd@#1\endcsname) >
+              maximum width (\csname eqp at maxwd@#1\endcsname)}%
+          \fi
+        }%
+      }%
+      \eqp at tempdima\csname eqp at this@#1\endcsname\relax
+      \eqp at tempdimb\csname eqp at next@#1\endcsname\relax
+      \ifdim\eqp at tempdima=\eqp at tempdimb
+      \else
+        \@latex at warning@no at line{Rerun to correct the width of eqparbox `#1'}%
+      \fi
+      \immediate\write\@auxout{%
+        \string\expandafter\string\gdef\string\csname\space
+        eqp at this@#1\string\endcsname{%
+          \csname eqp at next@#1\endcsname
+        }%
+        ^^J%
+        \string\expandafter\string\gdef\string\csname\space
+         eqp at next@#1\string\endcsname{0pt}%
+      }%
+      \@ifundefined{eqp at minwd@#1}{}{%
+        \immediate\write\@auxout{%
+          \string\expandafter\string\gdef\string\csname\space
+          eqp at minwd@#1\string\endcsname{%
+            \csname eqp at minwd@#1\endcsname
+          }%
+        }%
+      }%
+      \@ifundefined{eqp at maxwd@#1}{}{%
+        \immediate\write\@auxout{%
+          \string\expandafter\string\gdef\string\csname\space
+          eqp at maxwd@#1\string\endcsname{%
+            \csname eqp at maxwd@#1\endcsname
+          }%
+        }%
+      }%
+    }%
+    \eqp at taglist
+  \endgroup
+  \ifeqp at must@rerun
+    \@latex at warning@no at line{Rerun to correct eqparbox widths}
+  \fi
+}
+\endinput
+%%
+%% End of file `eqparbox.sty'.
diff --git a/common/latex/ifplatform.sty b/common/latex/ifplatform.sty
new file mode 100644
index 0000000..7f59f61
--- /dev/null
+++ b/common/latex/ifplatform.sty
@@ -0,0 +1,151 @@
+%%
+%% This is file `ifplatform.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% ifplatform.dtx  (with options: `package')
+%%   ________________________________________________________
+%%   Copyright (C) 2007-2010  Will Robertson & Johannes Große
+%%   License information appended.
+\ProvidesPackage{ifplatform}
+  [2010/10/22 v0.4  Testing for the operating system]
+\RequirePackage{pdftexcmds,catchfile,ifluatex}
+\newif\ifshellescape
+\newif\ifwindows
+\newif\ifmacosx
+\newif\iflinux
+\newif\ifcygwin
+\newcommand\windowsname{Windows}
+\newcommand\notwindowsname{*NIX}
+\newcommand\linuxname{Linux}
+\newcommand\macosxname{Mac\,OS\,X}
+\newcommand\cygwinname{Cygwin}
+\newcommand\unknownplatform{[Unknown]}
+\edef\ip at file{\jobname.w18}
+\newif\if at ip@nix@
+\ifnum\pdf at shellescape=1\relax
+  \shellescapetrue
+\else
+  \ifluatex\else
+  \PackageWarningNoLine{ifplatform}{^^J \space\space\space
+    shell escape is disabled,
+    so I can only detect \@backslashchar ifwindows%
+  }
+  \fi
+\fi
+\def\ip at cantdecide{%
+  \PackageWarningNoLine{ifplatform}{^^J \space\space\space
+    I can't tell if this is Windows or *nix;
+    you appear to be both%
+  }%
+}
+\ifluatex
+  \csname\directlua{
+      if os.type == "unix" then
+        tex.sprint("@ip at nix@true")
+      elseif os.type == "windows" then
+        tex.sprint("windowstrue")
+      end
+    }\endcsname
+\else
+\IfFileExists{nul:}{\@ip at nix@false}{\@ip at nix@true}
+\IfFileExists{/dev/null}{\windowsfalse}{\windowstrue}
+\edef\ip at windows@echo at test{echo \string# > "\ip at file"}
+\def\ip at backupplan{%
+  \IfFileExists{\ip at file}{%
+    \PackageWarningNoLine{ifplatform}{^^J \space\space\space
+      Please delete the file "\ip at file" and try again%
+    }%
+    \ip at cantdecide
+  }{%
+    \immediate\write18{\ip at windows@echo at test}%
+    \IfFileExists{\ip at file}{%
+      \immediate\write18{del "\ip at file"}%
+      \windowstrue
+    }{%
+      \@ip at nix@true
+    }%
+  }%
+}
+\ifwindows
+  \if at ip@nix@
+    \PackageWarningNoLine{ifplatform}{^^J \space\space\space
+      I can't tell if this is Windows or *nix;
+      you appear to be neither%
+    }
+  \fi
+\else
+  \if at ip@nix@\else
+    \ifshellescape
+      \ip at backupplan
+    \else
+      \ip at cantdecide
+    \fi
+  \fi
+\fi
+\fi
+\def\ip at only@six#1#2#3#4#5#6#7\@nil{#1#2#3#4#5#6}
+\if at ip@nix@
+\ifshellescape
+  \ifwindows\else
+    \immediate\write18{uname -s > "\ip at file"}
+    \CatchFileDef\@tempa{\ip at file}{}
+    \immediate\write18{rm -- "\ip at file"}
+    \edef\@tempa{\expandafter\zap at space\@tempa\@empty}
+    \def\@tempb{Linux}
+    \ifx\@tempa\@tempb
+      \linuxtrue
+    \else
+      \def\@tempb{Darwin}
+      \ifx\@tempa\@tempb
+        \macosxtrue
+      \else
+        \def\@tempb{CYGWIN}
+        \edef\@tempc{\expandafter\ip at only@six\@tempa------\@nil}
+        \ifx\@tempb\@tempc
+          \cygwintrue
+        \else
+          \edef\unknownplatform{\@tempa}
+        \fi
+      \fi
+    \fi
+  \fi
+\fi\fi
+\edef\platformname{%
+  \ifwindows
+    \noexpand\windowsname
+  \else
+    \ifshellescape
+      \iflinux
+        \noexpand\linuxname
+      \else
+        \ifmacosx
+          \noexpand\macosxname
+        \else
+          \ifcygwin
+            \noexpand\cygwinname
+          \else
+            \noexpand\unknownplatform
+          \fi
+        \fi
+      \fi
+    \else
+      \noexpand\notwindowsname
+    \fi
+  \fi
+}
+%% Copyright (C) 2007-2010 by Will Robertson & Johannes Große
+%% 
+%% Distributable under the LaTeX Project Public License,
+%% version 1.3c or higher (your choice). The latest version of
+%% this license is at: http://www.latex-project.org/lppl.txt
+%% 
+%% This work is "author-maintained" by Will Robertson.
+%% 
+%% This work consists of the file  ifplatform.dtx
+%%           and the derived files ifplatform.pdf,
+%%                                 ifplatform.sty, and
+%%                                 ifplatform.ins.
+%%
+%% End of file `ifplatform.sty'.
diff --git a/common/latex/inconsolata.sty b/common/latex/inconsolata.sty
new file mode 100644
index 0000000..aeada49
--- /dev/null
+++ b/common/latex/inconsolata.sty
@@ -0,0 +1,92 @@
+% Copyright 2014 Michael Sharpe
+% Based initially on Karl Berry's inconsolata.sty.
+% You may freely use, modify and/or distribute this file.
+
+\def\fileversion{1.10}
+\def\filedate{2016/02/22}
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{inconsolata}[\filedate\space v\fileversion]
+\message{`inconsolata-zi4' v\fileversion, \filedate\space Text macros for Inconsolata (msharpe)}
+
+\RequirePackage{textcomp}
+\RequirePackage{keyval}
+
+\newcount\zifour at ocount
+\newif\ifzifour at altzero
+\newif\ifzifour at noupq
+\define at key{zifour}{scaled}[1.0]{\def\zifour at scaled{s*[#1]}}
+
+\DeclareOption*{%
+  \begingroup
+  \edef\x{\endgroup
+    \noexpand\setkeys{zifour}{\CurrentOption}}%
+  \x}
+
+% by default, change \tt to mean zi4.
+\newcommand*{\zifour at default}{%
+  \renewcommand*{\ttdefault}{zi4}%
+}
+
+% option [nott] to avoid changing tt.
+\DeclareOption{nott}{%
+  \renewcommand*{\zifour at default}{}%
+}
+% option [noupquote] to prevent loading upquote.
+\DeclareOption{noupquote}{%
+  \zifour at noupqtrue}%
+  
+% option var0---use unslashed zero (slashed is default)
+\DeclareOption{var0}{%
+  \zifour at altzerotrue\advance\zifour at ocount \tw@ %
+}
+\DeclareOption{varl}{%
+  \advance\zifour at ocount \@ne %
+}
+\DeclareOption{varqu}{%
+  \advance\zifour at ocount 4\relax %
+}
+
+\ProcessOptions*
+\zifour at default
+\edef\zifour at opt{\the\zifour at ocount}
+\ifzifour at altzero 
+  \advance\zifour at ocount -\tw@
+\else
+  \advance\zifour at ocount \tw@
+\fi
+\edef\zifour at altopt{\the\zifour at ocount}
+% define an \altzero macro which flips to slashed, unslashed
+\def\altzero{{\fontfamily{zi4}%
+ \fontshape{scit}%
+ \selectfont 0}}
+ 
+\def\zifour at T@ne at nc{T1}
+\def\zifour at OT@ne at nc{OT1}
+\def\zifour at LY@ne at nc{LY1}
+\def\zifour at QX@nc{QX}
+\def\zifour at TQS{%
+\UndeclareTextCommand{\textquotesingle}{\encodingdefault}
+\DeclareTextSymbol{\textquotesingle}{TS1}{39}}
+
+\ifzifour at noupq% do nothing
+  % Try to correct for wrong slots for QX
+  \ifx\encodingdefault\zifour at QX@nc
+    \zifour at TQS
+  \else
+    \ifx\encodingdefault\zifour at LY@ne at nc
+      \zifour at TQS
+    \fi
+  \fi     
+\else
+  \AtBeginDocument{%
+  \ifx\encodingdefault\zifour at T@ne at nc % do nothing
+  \else
+    \ifx\encodingdefault\zifour at OT@ne at nc % do nothing
+    \else
+      \zifour at TQS
+    \fi
+  \fi
+  \usepackage{upquote}}
+\fi
+
+\endinput
diff --git a/common/latex/lato.sty b/common/latex/lato.sty
new file mode 100644
index 0000000..ba947cc
--- /dev/null
+++ b/common/latex/lato.sty
@@ -0,0 +1,47 @@
+%% lato.sty
+%% Copyright 2011 Mohamed El Morabity
+%
+% This work may be distributed and/or modified under the conditions of the LaTeX
+% Project Public License, either version 1.3 of this license or (at your option)
+% any later version. The latest version of this license is in
+% http://www.latex-project.org/lppl.txt and version 1.3 or later is part of all
+% distributions of LaTeX version 2005/12/01 or later.
+%
+% This work has the LPPL maintenance status `maintained'.
+% 
+% The Current Maintainer of this work is Mohamed El Morabity
+%
+% This work consists of all files listed in manifest.txt.
+
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{lato}[2011/08/06 Lato]
+
+\RequirePackage{keyval}
+\RequirePackage{slantsc}
+
+% Taken from inconsolata.sty
+\define at key{lato}{scale}[1.0]{\def\lato at scale{s*[#1]}}
+\DeclareOption*{%
+  \begingroup%
+  \edef\x{\endgroup%
+    \noexpand\setkeys{lato}{\CurrentOption}}%
+  \x%
+}
+
+\DeclareOption{defaultsans}{%
+  \renewcommand*{\sfdefault}{fla}%
+}
+
+\DeclareOption{default}{%
+  \renewcommand*{\familydefault}{fla}%
+  \renewcommand*{\sfdefault}{fla}%
+}
+
+\ProcessOptions*
+
+\newcommand{\flafamily}{%
+  \fontfamily{fla}%
+  \selectfont%
+}
+
+\endinput
diff --git a/common/latex/slantsc.sty b/common/latex/slantsc.sty
new file mode 100644
index 0000000..d9139f6
--- /dev/null
+++ b/common/latex/slantsc.sty
@@ -0,0 +1,101 @@
+%%
+%% This is file `slantsc.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% slantsc.dtx  (with options: `package')
+%% 
+%%   slantsc package
+%% 
+%%   Copyright  2003, 2012 Harald Harders
+%% 
+%%   This program can be redistributed and/or modified under the terms
+%%   of the LaTeX Project Public License Distributed from CTAN
+%%   archives in directory macros/latex/base/lppl.txt; either
+%%   version 1 of the License, or any later version.
+%% 
+%%   harald.harders at gmx.de
+%% 
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{slantsc}
+  [2012/01/01  v2.11  Provide Slanted an Italic Small Caps]
+\RequirePackage{ifthen}
+\DeclareFontFamily{T1}{cmr}{}
+\DeclareFontShape{T1}{cmr}{m}{scsl}%
+{<5><6><7><8><9><10><10.95><12><14.4>%
+  <17.28><20.74><24.88><29.86><35.83>genb*ecsc}{}
+\DeclareFontShape{T1}{cmr}{bx}{scsl}%
+{<5><6><7><8><9><10><10.95><12><14.4>%
+  <17.28><20.74><24.88><29.86><35.83>genb*ecoc}{}
+\DeclareFontShape{T1}{cmr}{m}{scit}{<->ssub * cmr/m/scsl}{}
+\DeclareFontShape{T1}{cmr}{bx}{scit}{<->ssub * cmr/bx/scsl}{}
+\providecommand*\scitdefault{\scdefault\itdefault}
+\providecommand*\scsldefault{\scdefault\sldefault}
+\DeclareRobustCommand\upshape{%
+  \not at math@alphabet\upshape\relax
+  \ifthenelse{\equal{\f at shape}{\scdefault}\or
+    \equal{\f at shape}{\scitdefault}\or\equal{\f at shape}{\scsldefault}}{%
+    \fontshape\scdefault
+  }{%
+    \fontshape\updefault
+  }%
+  \selectfont
+}
+\DeclareRobustCommand\slshape{%
+  \not at math@alphabet\slshape\relax
+  \ifthenelse{\equal{\f at shape}{\scdefault}\or
+    \equal{\f at shape}{\scitdefault}\or\equal{\f at shape}{\scsldefault}}{%
+    \fontshape\scsldefault
+  }{%
+    \fontshape\sldefault
+  }%
+  \selectfont
+}
+\DeclareRobustCommand\itshape{%
+  \not at math@alphabet\itshape\relax
+  \ifthenelse{\equal{\f at shape}{\scdefault}\or
+    \equal{\f at shape}{\scitdefault}\or\equal{\f at shape}{\scsldefault}}{%
+    \fontshape\scitdefault
+  }{%
+    \fontshape\itdefault
+  }%
+  \selectfont
+}
+\DeclareRobustCommand\scshape{%
+  \not at math@alphabet\scshape\relax
+  \ifthenelse{\equal{\f at shape}{\scdefault}\or
+    \equal{\f at shape}{\scitdefault}\or\equal{\f at shape}{\scsldefault}}{%
+  }{%
+    \ifthenelse{\equal{\f at shape}{\itdefault}}{%
+      \fontshape\scitdefault
+    }{%
+      \ifthenelse{\equal{\f at shape}{\sldefault}}{%
+        \fontshape\scsldefault
+      }{%
+        \fontshape\scdefault
+      }%
+    }%
+  }%
+  \selectfont
+}
+\DeclareRobustCommand\noscshape{%
+  \not at math@alphabet\noscshape\relax
+  \ifthenelse{\equal{\f at shape}{\scdefault}\or
+    \equal{\f at shape}{\scitdefault}\or\equal{\f at shape}{\scsldefault}}{%
+    \ifthenelse{\equal{\f at shape}{\scitdefault}}{%
+      \fontshape\itdefault
+    }{%
+      \ifthenelse{\equal{\f at shape}{\scsldefault}}{%
+        \fontshape\sldefault
+      }{%
+        \fontshape\updefault
+      }%
+    }%
+  }{%
+  }%
+  \selectfont
+}
+\endinput
+%%
+%% End of file `slantsc.sty'.
diff --git a/common/latex/trimspaces.sty b/common/latex/trimspaces.sty
new file mode 100644
index 0000000..d576156
--- /dev/null
+++ b/common/latex/trimspaces.sty
@@ -0,0 +1,58 @@
+%% LaTeX2e file `trimspaces.sty'
+%% generated by the `filecontents' environment
+%% from source `trimspaces' on 2016/11/06.
+%%
+\ProvidesPackage{trimspaces}[2009/09/17 v1.1
+  Trim spaces around a token list]
+
+% Trimming surrounding spaces:
+\catcode`\Q=3
+\newcommand\trim at spaces[1]{%
+  \romannumeral-`\q\trim at trim@\noexpand#1Q Q%
+}
+\long\def\trim at trim@#1 Q{\trim at trim@@#1Q}
+\long\def\trim at trim@@#1Q#2{#1}
+\catcode`\Q=11
+
+\newcommand\trim at spaces@noexp[1]{%
+  \unexpanded\expandafter\expandafter\expandafter
+    {\trim at spaces{#1}}%
+}
+
+\newcommand\trim at spaces@in[1]{%
+  \edef#1{\expandafter\trim at spaces@noexp\expandafter{#1}}%
+}
+
+% Trimming preceding spaces:
+\newcommand\trim at pre@space[1]{%
+  \romannumeral-`\.\expandafter\noexpand#1%
+}
+
+\newcommand\trim at pre@space at noexp[1]{%
+  \unexpanded\expandafter{%
+    \romannumeral-`\.\expandafter\noexpand#1%
+  }%
+}
+
+\newcommand\trim at pre@space at in[1]{%
+  \expandafter\def\expandafter#1\expandafter{%
+    \romannumeral-`\.\expandafter\noexpand#1%
+  }%
+}
+
+% Trimming trailing space:
+\catcode`\Q=3
+\newcommand\trim at post@space[1]{\trim at trim@#1Q Q}
+\catcode`\Q=11
+
+\newcommand\trim at post@space at noexp[1]{%
+  \unexpanded\expandafter\expandafter\expandafter
+  \expandafter\expandafter\expandafter\expandafter
+    {\trim at post@space{#1}}%
+}
+
+\newcommand\trim at post@space at in[1]{%
+  \edef#1{\expandafter\trim at post@space at noexp\expandafter{#1}}%
+}
+
+% That's it.
diff --git a/common/latex/upquote.sty b/common/latex/upquote.sty
new file mode 100644
index 0000000..6b9d754
--- /dev/null
+++ b/common/latex/upquote.sty
@@ -0,0 +1,40 @@
+%%
+%% This is file `upquote.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% upquote.dtx  (with options: `package')
+%% 
+%% Copyright (C) 2000 by Michael A. Covington
+%% Copyright (C) 2003 by Frank Mittelbach
+%% Copyright (C) 2012 by Markus Kuhn (current maintainer)
+%% 
+%% Released under the LaTeX Project Public License v1.3c or later
+%% See http://www.latex-project.org/lppl.txt
+%% 
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{upquote}
+   [2012/04/19 v1.3 upright-quote and grave-accent glyphs in verbatim]
+\newcommand\upquote at cmtt{cmtt}
+\newcommand\upquote at OTone{OT1}
+\ifx\encodingdefault\upquote at OTone
+  \ifx\ttdefault\upquote at cmtt\else\RequirePackage{textcomp}\fi
+\else
+  \RequirePackage{textcomp}
+\fi
+\begingroup
+\catcode`'=\active
+\catcode``=\active
+\g at addto@macro\@noligs
+   {\let'\textquotesingle
+    \let`\textasciigrave
+    \ifx\encodingdefault\upquote at OTone
+    \ifx\ttdefault\upquote at cmtt
+    \def'{\char13 }%
+    \def`{\char18 }%
+    \fi\fi}
+\endgroup
+\endinput
+%%
+%% End of file `upquote.sty'.
diff --git a/common/waf.py b/common/waf.py
index 25f3d74..0086be0 100644
--- a/common/waf.py
+++ b/common/waf.py
@@ -1,6 +1,8 @@
 import sys, os, re
 from waflib.Build import BuildContext
 
+import latex
+
 sphinx_min_version = (1, 3)
 
 def cmd_spell(ctx):
@@ -86,6 +88,23 @@ def build_dir_setup(ctx, buildtype):
     doctrees = os.path.join(os.path.dirname(output_dir), 'doctrees', buildtype)
     return build_dir, output_node, output_dir, doctrees
 
+def pdf_resources(ctx, buildtype):
+    local_packages = latex.local_packages()
+    if local_packages is not None:
+        packages_base = ctx.path.parent.find_dir('common/latex')
+        if packages_base is None:
+            ctx.fatal('Latex package directory not found')
+        base = packages_base.path_from(ctx.path)
+        srcs = [os.path.join(base, p) for p in local_packages]
+        fnode = ctx.path.get_bld().make_node(buildtype)
+        fnode.mkdir()
+        ctx(
+            features = "subst",
+            is_copy  = True,
+            source   = srcs,
+            target   = [fnode.make_node(p) for p in local_packages]
+        )
+
 def html_resources(ctx, buildtype):
     for dir_name in ["_static", "_templates"]:
         files = ctx.path.parent.find_node("common").ant_glob("%s/*" % dir_name)
@@ -108,100 +127,6 @@ def html_resources(ctx, buildtype):
 #        target      = [x.srcpath().replace("../", "") for x in files]
 #    )
 
-def latex_configure_tests(conf):
-
-    #
-    # Using a hint from ita (thank you) :
-    #  https://github.com/waf-project/waf/blob/master/demos/tex/wscript
-    #
-    latex_test_preamble = ['\\newif\\ifsphinxKeepOldNames \\sphinxKeepOldNamestrue',
-                           '\documentclass[a4paper,11pt,english]{report}']
-    latex_test_postamble = ['\\begin{document} test \\end{document}']
-    latex_tests = {
-        'Bjarne'         : ['\\usepackage[Bjarne]{fncychap}'],
-        'alltt'          : ['\\usepackage{alltt}'],
-        'amsmath'        : ['\\usepackage{amsmath}'],
-        'amssymb'        : ['\\usepackage{amssymb}'],
-        'amstext'        : ['\\usepackage{amstext}'],
-        'array'          : ['\\usepackage{array}'],
-        'atbegshi'       : ['\\usepackage{atbegshi}'],
-        'babel'          : ['\\usepackage{babel}'],
-        'babel'          : ['\\usepackage{babel}'],
-        'calc'           : ['\\usepackage{calc}'],
-        'capt-of'        : ['\\usepackage{capt-of}'],
-        'charter'        : ['\\usepackage{charter}'],
-        'cmap'           : ['\\usepackage{cmap}'],
-        'color'          : ['\\usepackage{color}'],
-        'eqparbox'       : ['\\usepackage{eqparbox}'],
-        'etoolbox'       : ['\\usepackage{etoolbox}'],
-        'fancybox'       : ['\\usepackage{fancybox}'],
-        'fancyhdr'       : ['\\usepackage{fancyhdr}'],
-        'fancyvrb'       : ['\\usepackage{fancyvrb}'],
-        'float'          : ['\\usepackage{float}'],
-        'fncychap'       : ['\\usepackage{fncychap}'],
-        'fontenc'        : ['\\usepackage[T1]{fontenc}'],
-        'footnote'       : ['\\usepackage{footnote}'],
-        'framed'         : ['\\usepackage{framed}'],
-        'graphicx'       : ['\\usepackage{graphicx}'],
-        'hypcap'         : ['\\usepackage{hyperref}',
-                            '\\usepackage{hypcap}'],
-        'hyperref'       : ['\\usepackage{hyperref}'],
-        'ifplatform'     : ['\\usepackage{ifplatform}'],
-        'ifthen'         : ['\\usepackage{ifthen}'],
-        'inconsolata'    : ['\\usepackage{inconsolata}'],
-        'inputenc'       : ['\\usepackage{inputenc}'],
-        'keyval'         : ['\\usepackage{keyval}'],
-        'kvoptions'      : ['\\usepackage{kvoptions}'],
-        'lato'           : ['\\usepackage{lato}'],
-        'lineno'         : ['\\usepackage{lineno}'],
-        'longtable'      : ['\\usepackage{longtable}'],
-        'makeidx'        : ['\\usepackage{makeidx}'],
-        'multirow'       : ['\\usepackage{multirow}'],
-        'parskip'        : ['\\usepackage{parskip}'],
-        'pdftexcmds'     : ['\\usepackage{pdftexcmds}'],
-        'textcomp'       : ['\\usepackage{textcomp}'],
-        'threeparttable' : ['\\usepackage{threeparttable}'],
-        'times'          : ['\\usepackage{times}'],
-        'titlesec'       : ['\\usepackage{titlesec}'],
-        'upquote'        : ['\\usepackage{upquote}'],
-        'utf8'           : ['\\usepackage[utf8]{inputenc}'],
-        'wrapfig'        : ['\\usepackage{wrapfig}'],
-        'xcolor'         : ['\\usepackage{xcolor}'],
-        'xstring'        : ['\\usepackage{xstring}'],
-    }
-
-    def build_latex_test(bld):
-        def create_tex(test_data):
-            return os.linesep.join(latex_test_preamble +
-                                   test_data +
-                                   latex_test_postamble)
-        def write_tex_test(tsk):
-            tex = create_tex(tsk.env.TEST_DATA)
-            tsk.outputs[0].write(tex)
-
-        test = bld.kw['tex_test']
-        bld.env.TEST = test
-        bld.env.TEST_DATA = latex_tests[test]
-
-        bld.to_log('%s.tex %s' % (test, '=' * (40 - len(test) + 5)))
-        bld.to_log(create_tex(latex_tests[test]))
-        bld.to_log('=' * 40)
-
-        bld(rule = write_tex_test, target = 'main.tex')
-        bld(features = 'tex', type = 'pdflatex', source = 'main.tex', prompt = 0)
-
-    fails = 0
-    for t in sorted(latex_tests.keys()):
-        r = conf.test(build_fun = build_latex_test,
-                      msg = "Checking for Tex package '%s'" % (t),
-                      tex_test = t,
-                      okmsg = 'ok',
-                      errmsg = 'not found (please install)',
-                      mandatory = False)
-        if r is None:
-            fails += 1
-    if fails > 0:
-        conf.fatal('There are %d Tex package failures. Please fix.' % (fails))
 
 def cmd_configure(ctx):
     ctx.find_program("sphinx-build", var="BIN_SPHINX_BUILD", mandatory = True)
@@ -232,7 +157,7 @@ def cmd_configure(ctx):
             if 'PDFLATEXFLAGS' not in ctx.env or \
                '-shell-escape' not in ctx.env['PDFLATEXFLAGS']:
                 ctx.env.append_value('PDFLATEXFLAGS', '-shell-escape')
-            latex_configure_tests(ctx)
+            latex.configure_tests(ctx)
         else:
             ctx.msg('Check for Tex packages', 'skipping, already checked')
         ctx.env.BUILD_PDF = 'yes'
@@ -248,6 +173,7 @@ def cmd_configure(ctx):
 def doc_pdf(ctx, source_dir, conf_dir):
     buildtype = 'latex'
     build_dir, output_node, output_dir, doctrees = build_dir_setup(ctx, buildtype)
+    pdf_resources(ctx, buildtype)
     rule = "${BIN_SPHINX_BUILD} %s -b %s -c %s -d %s %s %s" % \
            (sphinx_verbose(ctx), buildtype, conf_dir,
             doctrees, source_dir, output_dir)



More information about the vc mailing list