mirror of
https://github.com/moparisthebest/xeps
synced 2024-11-21 08:45:04 -05:00
Include adjustbox.sty package as dependency. Fix gen.py to include xep# in inline image filenames.
This commit is contained in:
parent
9ac65af823
commit
90be88d98e
155
deps/adjcalc.sty
vendored
Normal file
155
deps/adjcalc.sty
vendored
Normal file
@ -0,0 +1,155 @@
|
|||||||
|
%% Copyright (C) 2011-2012 by Martin Scharrer <martin@scharrer-online.de>
|
||||||
|
%% ----------------------------------------------------------------------
|
||||||
|
%% 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 Martin Scharrer.
|
||||||
|
%%
|
||||||
|
%% This work consists of the files adjcalc.dtx, adjustbox.ins
|
||||||
|
%% and the derived file adjcalc.sty.
|
||||||
|
%% It is part of the larger adjustbox bundle.
|
||||||
|
%%
|
||||||
|
\ProvidesPackage{adjcalc}[%
|
||||||
|
2012/05/16
|
||||||
|
v1.1
|
||||||
|
Provides advanced setlength with multiple back-ends (calc, etex, pgfmath)]
|
||||||
|
\RequirePackage{xkeyval}
|
||||||
|
\def\adjcalc@atend{%
|
||||||
|
\begingroup
|
||||||
|
\expandafter\ifx\csname glueexpr\endcsname\relax
|
||||||
|
\endgroup
|
||||||
|
\RequirePackage{calc}%
|
||||||
|
\adjcalc@calc
|
||||||
|
\def\adjcalc@etex{\PackageError{adjcalc}{e-TeX not available for current compiler!}}%
|
||||||
|
\else
|
||||||
|
\endgroup
|
||||||
|
\adjcalc@etex
|
||||||
|
\fi
|
||||||
|
}
|
||||||
|
\def\adjcalc@pgfmath{\AtEndOfPackage{\RequirePackage{pgf}}\def\adjcalc@atend{\adjcalc@pgfmath}}
|
||||||
|
\def\adjcalc@etex{\def\adjcalc@atend{\adjcalc@etex}}
|
||||||
|
\def\adjcalc@calc{\AtEndOfPackage{\RequirePackage{calc}}\def\adjcalc@atend{\adjcalc@calc}}
|
||||||
|
\def\adjcalc@overwrite{\AtEndOfPackage{\adjcalc@overwrite}}
|
||||||
|
\def\adjcalc@defaultunit{bp}%
|
||||||
|
\DeclareOptionX<adjcalc>{pgfmath}{\adjcalc@pgfmath}
|
||||||
|
\DeclareOptionX<adjcalc>{etex}{\adjcalc@etex}
|
||||||
|
\DeclareOptionX<adjcalc>{calc}{\adjcalc@calc}
|
||||||
|
\DeclareOptionX<adjcalc>{none}{%
|
||||||
|
\let\adjcalc@atend\relax
|
||||||
|
\let\adjcalc@overwrite\relax
|
||||||
|
\def\adjsetlength{\setlength}%
|
||||||
|
\def\adjaddtolength{\addtolength}%
|
||||||
|
\def\adjsetcounter{\setcounter}%
|
||||||
|
\def\adjaddtocounter{\addtocounter}%
|
||||||
|
}
|
||||||
|
\DeclareOptionX<adjcalc>{overwrite}{\adjcalc@overwrite}
|
||||||
|
\DeclareOptionX<adjcalc>{defaultunit}[bp]{%
|
||||||
|
\begingroup
|
||||||
|
\def\@tempa{#1}%
|
||||||
|
\def\@tempb{none}%
|
||||||
|
\ifx\@tempa\@tempb% 'none':
|
||||||
|
\endgroup
|
||||||
|
\def\adjsetlengthdefault{\adjsetlength}%
|
||||||
|
\else
|
||||||
|
\ifx\@tempb\adjcalc@defaultunit
|
||||||
|
\endgroup
|
||||||
|
% was 'none' before
|
||||||
|
\let\adjsetlengthdefault\adjsetlengthdefault@
|
||||||
|
\else
|
||||||
|
\endgroup
|
||||||
|
\fi
|
||||||
|
\fi
|
||||||
|
\def\adjcalc@defaultunit{#1}%
|
||||||
|
}
|
||||||
|
\ProcessOptionsX*<adjcalc>
|
||||||
|
\disable@keys{adjcalc}{none}
|
||||||
|
\def\adjcalcset{%
|
||||||
|
\setkeys{adjcalc}%
|
||||||
|
}
|
||||||
|
\def\adjcalc@etex{%
|
||||||
|
\protected\def\adjsetlength##1##2{%
|
||||||
|
##1=\glueexpr(##2)\relax
|
||||||
|
}%
|
||||||
|
\protected\def\adjaddtolength##1##2{%
|
||||||
|
\advance##1 by \glueexpr(##2)\relax
|
||||||
|
}%
|
||||||
|
\protected\def\adjsetcounter##1##2{%
|
||||||
|
\@ifundefined{c@##1}%
|
||||||
|
{\@nocounterr{##1}}%
|
||||||
|
{\global\csname c@##1\endcsname\numexpr(##2)\relax}%
|
||||||
|
}%
|
||||||
|
\protected\def\adjaddtocounter##1##2{%
|
||||||
|
\@ifundefined{c@##1}%
|
||||||
|
{\@nocounterr{##1}}%
|
||||||
|
{\global\advance\csname c@##1\endcsname\numexpr(##2)\relax}%
|
||||||
|
}%
|
||||||
|
\def\adjsetlengthdefault@##1##2{%
|
||||||
|
\@defaultunits##1=\glueexpr##2 \adjcalc@defaultunit\relax\@nnil
|
||||||
|
}%
|
||||||
|
\let\adjsetlengthdefault\adjsetlengthdefault@
|
||||||
|
}
|
||||||
|
\newif\if@adjcalc@needsdefault
|
||||||
|
\def\adjcalc@calc{%
|
||||||
|
\DeclareRobustCommand\adjsetlength{\calc@assign@skip}%
|
||||||
|
\DeclareRobustCommand\adjaddtolength[1]{\calc@assign@skip{\advance ##1}}%
|
||||||
|
\DeclareRobustCommand\adjsetcounter[2]{\@ifundefined{c@##1}{\@nocounterr{##1}}{\calc@assign@count{\global\csname c@##1\endcsname}{##2}}}%
|
||||||
|
\DeclareRobustCommand\adjaddtocounter[2]{\@ifundefined{c@##1}{\@nocounterr{##1}}{\calc@assign@count{\global\advance\csname c@##1\endcsname}{##2}}}%
|
||||||
|
\def\adjsetlengthdefault@##1##2{%
|
||||||
|
\begingroup
|
||||||
|
\def\calc@post@scan####1!{%
|
||||||
|
\def\@tempa{####1}%
|
||||||
|
\ifx\@tempa\@empty
|
||||||
|
\endgroup% to end calc processing
|
||||||
|
% is number only
|
||||||
|
\global\@adjcalc@needsdefaulttrue
|
||||||
|
\else
|
||||||
|
\endgroup% to end calc processing
|
||||||
|
% full expression
|
||||||
|
\global\@adjcalc@needsdefaultfalse
|
||||||
|
\fi
|
||||||
|
}%
|
||||||
|
\calc@assign@skip{##1}{##2 \adjcalc@defaultunit}%
|
||||||
|
\endgroup
|
||||||
|
\if@adjcalc@needsdefault
|
||||||
|
##1=##2 \adjcalc@defaultunit\relax
|
||||||
|
\else
|
||||||
|
\calc@assign@skip{##1}{##2}%
|
||||||
|
\fi
|
||||||
|
}%
|
||||||
|
\def\adjcalc@checkdefault##1\@nnil##2##3{%
|
||||||
|
\ifx\relax##1\relax\else
|
||||||
|
\calc@assign@skip{##2}{##3}%
|
||||||
|
\fi
|
||||||
|
}%
|
||||||
|
\let\adjsetlengthdefault\adjsetlengthdefault@
|
||||||
|
}
|
||||||
|
\def\adjcalc@pgfmath{%
|
||||||
|
\DeclareRobustCommand\adjsetlength{\pgfmathsetlength}%
|
||||||
|
\DeclareRobustCommand\adjaddtolength{\pgfmathaddtolength}%
|
||||||
|
\DeclareRobustCommand\adjsetcounter{\pgfmathsetcounter}%
|
||||||
|
\DeclareRobustCommand\adjaddtocounter{\pgfmathaddtocounter}%
|
||||||
|
\def\adjsetlengthdefault@##1##2{%
|
||||||
|
\edef\pgfmathresultunitscale{1\adjcalc@defaultunit}%
|
||||||
|
\let\pgfmathpostparse\pgfmathscaleresult
|
||||||
|
\pgfmathparse{##2}%
|
||||||
|
##1=\pgfmathresult pt\relax
|
||||||
|
}%
|
||||||
|
\let\adjsetlengthdefault\adjsetlengthdefault@
|
||||||
|
}
|
||||||
|
\def\adjcalc@overwrite{%
|
||||||
|
\let\setlength\adjsetlength
|
||||||
|
\let\addtolength\adjaddtolength
|
||||||
|
\let\setcounter\adjsetcounter
|
||||||
|
\let\addtocounter\adjaddtocounter
|
||||||
|
}
|
||||||
|
\adjcalc@atend
|
||||||
|
\endinput
|
||||||
|
%%
|
||||||
|
%% End of file `adjcalc.sty'.
|
1241
deps/adjustbox.sty
vendored
Normal file
1241
deps/adjustbox.sty
vendored
Normal file
File diff suppressed because it is too large
Load Diff
45
deps/tc-dvips.def
vendored
Normal file
45
deps/tc-dvips.def
vendored
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
%% Copyright (C) 2011-2012 by Martin Scharrer <martin@scharrer-online.de>
|
||||||
|
%% ----------------------------------------------------------------------
|
||||||
|
%% 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 Martin Scharrer.
|
||||||
|
%%
|
||||||
|
%% This work consists of the files trimclip.dtx, adjustbox.ins
|
||||||
|
%% and the derived files trimclip.sty,
|
||||||
|
%% tc-dvips.def, tc-pdftex.def, tc-pgf.def and tc-xetex.def.
|
||||||
|
%% Further author information are located in the .def files.
|
||||||
|
%%
|
||||||
|
\ProvidesFile{tc-dvips.def}[2012/05/13 v1.0 Clipping driver for dvips]
|
||||||
|
\def\@cliptoboxdim#1{%
|
||||||
|
\setbox#1=\hbox{%
|
||||||
|
\adjsetlength\@tempdima{\ht#1+\dp#1}%
|
||||||
|
\edef\TOTALHEIGHT{-\strip@pt\@tempdima\space}%
|
||||||
|
\edef\DEPTH{\strip@pt\dp#1\space}%
|
||||||
|
\edef\WIDTH{\strip@pt\wd#1\space}%
|
||||||
|
\special{%
|
||||||
|
ps:
|
||||||
|
/mtrxc matrix currentmatrix def
|
||||||
|
currentpoint gsave
|
||||||
|
translate
|
||||||
|
Resolution 72 div VResolution 72 div
|
||||||
|
scale
|
||||||
|
newpath
|
||||||
|
0 \DEPTH \WIDTH \TOTALHEIGHT rectclip
|
||||||
|
newpath
|
||||||
|
mtrxc setmatrix
|
||||||
|
}%
|
||||||
|
\box#1%
|
||||||
|
\special{ps: grestore }%
|
||||||
|
}%
|
||||||
|
}
|
||||||
|
\endinput
|
||||||
|
%%
|
||||||
|
%% End of file `tc-dvips.def'.
|
39
deps/tc-pdftex.def
vendored
Normal file
39
deps/tc-pdftex.def
vendored
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
%% Copyright (C) 2011-2012 by Martin Scharrer <martin@scharrer-online.de>
|
||||||
|
%% ----------------------------------------------------------------------
|
||||||
|
%% 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 Martin Scharrer.
|
||||||
|
%%
|
||||||
|
%% This work consists of the files trimclip.dtx, adjustbox.ins
|
||||||
|
%% and the derived files trimclip.sty,
|
||||||
|
%% tc-dvips.def, tc-pdftex.def, tc-pgf.def and tc-xetex.def.
|
||||||
|
%% Further author information are located in the .def files.
|
||||||
|
%%
|
||||||
|
\ProvidesFile{tc-pdftex.def}[2012/05/13 v1.0 Clipping driver for pdftex]
|
||||||
|
\def\@cliptoboxdim#1{%
|
||||||
|
\setbox#1=\hbox{%
|
||||||
|
\Gin@defaultbp\WIDTH{\wd#1}%
|
||||||
|
\Gin@defaultbp\DEPTH{\dp#1}%
|
||||||
|
\@tempdima\ht#1%
|
||||||
|
\advance\@tempdima\dp#1%
|
||||||
|
\Gin@defaultbp\TOTALHEIGHT{\@tempdima}%
|
||||||
|
\pdfsave
|
||||||
|
\pdfliteral direct {%
|
||||||
|
0 -\DEPTH\space \WIDTH\space \TOTALHEIGHT\space re W n
|
||||||
|
}%
|
||||||
|
\hbox to 0pt{\copy#1\hss}%
|
||||||
|
\pdfrestore
|
||||||
|
\hskip \wd#1
|
||||||
|
}%
|
||||||
|
}
|
||||||
|
\endinput
|
||||||
|
%%
|
||||||
|
%% End of file `tc-pdftex.def'.
|
37
deps/tc-pgf.def
vendored
Normal file
37
deps/tc-pgf.def
vendored
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
%% Copyright (C) 2011-2012 by Martin Scharrer <martin@scharrer-online.de>
|
||||||
|
%% ----------------------------------------------------------------------
|
||||||
|
%% 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 Martin Scharrer.
|
||||||
|
%%
|
||||||
|
%% This work consists of the files trimclip.dtx, adjustbox.ins
|
||||||
|
%% and the derived files trimclip.sty,
|
||||||
|
%% tc-dvips.def, tc-pdftex.def, tc-pgf.def and tc-xetex.def.
|
||||||
|
%% Further author information are located in the .def files.
|
||||||
|
%%
|
||||||
|
\ProvidesFile{tc-pgf.def}[2012/05/13 v1.0 trimclip fall-back clipping driver using PGF]
|
||||||
|
\RequirePackage{pgf}
|
||||||
|
\def\@cliptoboxdim#1{%
|
||||||
|
\setbox#1\hbox{\begin{pgfpicture}%
|
||||||
|
\pgfpathmoveto{\pgfqpoint\z@{-\dp#1}}%
|
||||||
|
\pgfpathlineto{\pgfqpoint\z@{\ht#1}}%
|
||||||
|
\pgfpathlineto{\pgfqpoint{\wd#1}{\ht#1}}%
|
||||||
|
\pgfpathlineto{\pgfqpoint{\wd#1}{-\dp#1}}%
|
||||||
|
\pgfpathclose
|
||||||
|
\pgfusepathqclip
|
||||||
|
\pgfset{inner sep=\z@,outer sep=\z@,minimum size=\z@}%
|
||||||
|
\pgfnode{rectangle}{base west}{\usebox#1}{}{}%
|
||||||
|
\pgfsetbaselinepointnow{\pgfpoint\z@\z@}%
|
||||||
|
\end{pgfpicture}}%
|
||||||
|
}
|
||||||
|
\endinput
|
||||||
|
%%
|
||||||
|
%% End of file `tc-pgf.def'.
|
41
deps/tc-xetex.def
vendored
Normal file
41
deps/tc-xetex.def
vendored
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
%% Copyright (C) 2011-2012 by Martin Scharrer <martin@scharrer-online.de>
|
||||||
|
%% ----------------------------------------------------------------------
|
||||||
|
%% 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 Martin Scharrer.
|
||||||
|
%%
|
||||||
|
%% This work consists of the files trimclip.dtx, adjustbox.ins
|
||||||
|
%% and the derived files trimclip.sty,
|
||||||
|
%% tc-dvips.def, tc-pdftex.def, tc-pgf.def and tc-xetex.def.
|
||||||
|
%% Further author information are located in the .def files.
|
||||||
|
%%
|
||||||
|
\ProvidesFile{tc-xetex.def}[2012/05/13 v1.0 Clipping driver for xetex]
|
||||||
|
\def\@cliptoboxdim#1{%
|
||||||
|
\setbox#1=\hbox{%
|
||||||
|
\Gin@defaultbp\WIDTH{\wd#1}%
|
||||||
|
\Gin@defaultbp\DEPTH{\dp#1}%
|
||||||
|
\@tempdima\ht#1%
|
||||||
|
\advance\@tempdima\dp#1%
|
||||||
|
\Gin@defaultbp\TOTALHEIGHT{\@tempdima}%
|
||||||
|
\special{pdf:bcontent }%
|
||||||
|
\special{%
|
||||||
|
pdf:literal direct
|
||||||
|
0 -\DEPTH\space \WIDTH\space \TOTALHEIGHT\space re
|
||||||
|
}%
|
||||||
|
\special{pdf:literal direct W }%
|
||||||
|
\special{pdf:literal direct n }%
|
||||||
|
\box#1%
|
||||||
|
\special{pdf:econtent }%
|
||||||
|
}%
|
||||||
|
}
|
||||||
|
\endinput
|
||||||
|
%%
|
||||||
|
%% End of file `tc-xetex.def'.
|
260
deps/trimclip.sty
vendored
Normal file
260
deps/trimclip.sty
vendored
Normal file
@ -0,0 +1,260 @@
|
|||||||
|
%% Copyright (C) 2011-2012 by Martin Scharrer <martin@scharrer-online.de>
|
||||||
|
%% ----------------------------------------------------------------------
|
||||||
|
%% 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 Martin Scharrer.
|
||||||
|
%%
|
||||||
|
%% This work consists of the files trimclip.dtx, adjustbox.ins
|
||||||
|
%% and the derived files trimclip.sty,
|
||||||
|
%% tc-dvips.def, tc-pdftex.def, tc-pgf.def and tc-xetex.def.
|
||||||
|
%% Further author information are located in the .def files.
|
||||||
|
%%
|
||||||
|
\ProvidesPackage{trimclip}[%
|
||||||
|
2012/05/16
|
||||||
|
v1.0
|
||||||
|
Trim and clip general TeX material]
|
||||||
|
\def\tc@driver{tc-\Gin@driver}
|
||||||
|
\DeclareOption{pgf}{\def\tc@driver{tc-pgf.def}\PassOptionsToPackage{pgf}{graphicx}}
|
||||||
|
\DeclareOption{pdftex}{\def\tc@driver{tc-pdftex.def}\PassOptionsToPackage{pdftex}{graphicx}}
|
||||||
|
\DeclareOption{xetex}{\def\tc@driver{tc-xetex.def}\PassOptionsToPackage{xetex}{graphicx}}
|
||||||
|
\DeclareOption{dvips}{\def\tc@driver{tc-dvips.def}\PassOptionsToPackage{dvips}{graphicx}}
|
||||||
|
\DeclareOption{dvipdfm}{\def\tc@driver{tc-xetex.def}\PassOptionsToPackage{xetex}{graphicx}}
|
||||||
|
\DeclareOption{dvipdf}{\def\tc@driver{tc-xetex.def}\PassOptionsToPackage{xetex}{graphicx}}
|
||||||
|
\DeclareOption*{%
|
||||||
|
\@ifpackageloaded{graphics}{%
|
||||||
|
\edef\tc@driver{tc-\CurrentOption.def}%
|
||||||
|
\begingroup
|
||||||
|
\edef\@tempa{\CurrentOption.def}%
|
||||||
|
\ifx\@tempa\Gin@driver\else
|
||||||
|
\let\on@line\@gobble
|
||||||
|
\PackageWarning{trimclip}{%
|
||||||
|
A different clipping driver was requested than the\MessageBreak
|
||||||
|
one used for 'graphics/x'! This is not recommended\MessageBreak
|
||||||
|
and can lead to defect output files.%
|
||||||
|
}%
|
||||||
|
\fi
|
||||||
|
\endgroup
|
||||||
|
}{%
|
||||||
|
\def\tc@driver{tc-\Gin@driver}%
|
||||||
|
\PassOptionsToPackage\CurrentOption{graphicx}%
|
||||||
|
}%
|
||||||
|
}
|
||||||
|
\ProcessOptions*\relax
|
||||||
|
\RequirePackage{graphicx}[1999/02/16]
|
||||||
|
\RequirePackage{collectbox}[2011/08/22]
|
||||||
|
\RequirePackage{adjcalc}
|
||||||
|
\def\tc@readvalues#1{%
|
||||||
|
\tc@@readvalues#1 {} {} {} \\%
|
||||||
|
}
|
||||||
|
\def\tc@@readvalues#1 #2 #3 #4 #5\\{%
|
||||||
|
\adjsetlengthdefault\tc@llx{#1}%
|
||||||
|
\ifx\@nnil#2\@nnil
|
||||||
|
\tc@lly\tc@llx
|
||||||
|
\tc@urx\tc@llx
|
||||||
|
\tc@ury\tc@llx
|
||||||
|
\else
|
||||||
|
\adjsetlengthdefault\tc@lly{#2}%
|
||||||
|
\ifx\@nnil#3\@nnil
|
||||||
|
\tc@urx\tc@llx
|
||||||
|
\tc@ury\tc@lly
|
||||||
|
\else
|
||||||
|
\adjsetlengthdefault\tc@urx{#3}%
|
||||||
|
\adjsetlengthdefault\tc@ury{#4}%
|
||||||
|
\fi
|
||||||
|
\fi
|
||||||
|
}%
|
||||||
|
\newdimen\tc@llx
|
||||||
|
\newdimen\tc@lly
|
||||||
|
\newdimen\tc@urx
|
||||||
|
\newdimen\tc@ury
|
||||||
|
\newcommand\trimbox{%
|
||||||
|
\collectboxcheckenv{trimbox}%
|
||||||
|
\@ifstar
|
||||||
|
\trimbox@s
|
||||||
|
\trimbox@
|
||||||
|
}
|
||||||
|
\def\trimbox@#1{%
|
||||||
|
\collectbox{\@trimclip\@trimbox{#1}}%
|
||||||
|
}
|
||||||
|
\def\trimbox@s#1{%
|
||||||
|
\collectbox{\@trimclip\@viewportbox{#1}}%
|
||||||
|
}
|
||||||
|
\expandafter\newcommand\expandafter*\csname trimbox*\endcsname{%
|
||||||
|
\@collectboxisenv{trimbox*}%
|
||||||
|
\trimbox@s
|
||||||
|
}
|
||||||
|
\newcommand\clipbox{%
|
||||||
|
\collectboxcheckenv{clipbox}%
|
||||||
|
\@ifstar
|
||||||
|
\clipbox@s
|
||||||
|
\clipbox@
|
||||||
|
}
|
||||||
|
\def\clipbox@#1{%
|
||||||
|
\collectbox{\@trimclip\@clipbox{#1}}%
|
||||||
|
}
|
||||||
|
\def\clipbox@s#1{%
|
||||||
|
\collectbox{\@trimclip\@clipvpbox{#1}}%
|
||||||
|
}
|
||||||
|
\expandafter\newcommand\expandafter*\csname clipbox*\endcsname{%
|
||||||
|
\@collectboxisenv{clipbox*}%
|
||||||
|
\clipbox@s
|
||||||
|
}
|
||||||
|
\newcommand\marginbox{%
|
||||||
|
\collectboxcheckenv{marginbox}%
|
||||||
|
\@ifstar
|
||||||
|
\marginbox@s
|
||||||
|
\marginbox@
|
||||||
|
}
|
||||||
|
\def\marginbox@#1{%
|
||||||
|
\@collectbox{\@trimclip\@marginbox{#1}}%
|
||||||
|
}
|
||||||
|
\def\marginbox@s#1{%
|
||||||
|
\@collectbox{\@trimclip\@marginraisebox{#1}}%
|
||||||
|
}
|
||||||
|
\expandafter\newcommand\expandafter*\csname marginbox*\endcsname{%
|
||||||
|
\@collectboxisenv{marginbox*}%
|
||||||
|
\marginbox@s
|
||||||
|
}
|
||||||
|
\def\@trimclip#1#2{%
|
||||||
|
\tc@readvalues{#2}%
|
||||||
|
#1%
|
||||||
|
\collectedbox
|
||||||
|
\tc@llx
|
||||||
|
\tc@lly
|
||||||
|
\tc@urx
|
||||||
|
\tc@ury
|
||||||
|
\usebox\collectedbox
|
||||||
|
}
|
||||||
|
\def\tc@correctbaseline#1{%
|
||||||
|
\ifdim\dp#1<\z@
|
||||||
|
\raise\dp#1%
|
||||||
|
\else
|
||||||
|
\ifdim\ht#1<\z@
|
||||||
|
\lower\ht#1%
|
||||||
|
\fi\fi
|
||||||
|
\box#1%
|
||||||
|
}%
|
||||||
|
\def\tc@correctdims#1{%
|
||||||
|
\ifdim\dp#1<\z@ \dp#1=\z@ \fi
|
||||||
|
\ifdim\wd#1<\z@ \wd#1=\z@ \fi
|
||||||
|
\ifdim\ht#1<\z@ \ht#1=\z@ \fi
|
||||||
|
}
|
||||||
|
\def\@trimbox#1#2#3#4#5{%
|
||||||
|
\setbox#1=\hbox{%
|
||||||
|
%
|
||||||
|
\tc@llx=#2\relax
|
||||||
|
\tc@lly=#3\relax
|
||||||
|
\advance\tc@lly-\dp#1%
|
||||||
|
\tc@urx=#4\relax
|
||||||
|
\advance\tc@urx-\wd#1%
|
||||||
|
\tc@ury=#5\relax
|
||||||
|
\advance\tc@ury-\ht#1%
|
||||||
|
%
|
||||||
|
% Set dimensions now.
|
||||||
|
% This allows that the arguments can refer
|
||||||
|
% to the original dimensions without issues.
|
||||||
|
\hskip-\tc@llx
|
||||||
|
\dp#1-\tc@lly
|
||||||
|
\wd#1-\tc@urx
|
||||||
|
\ht#1-\tc@ury
|
||||||
|
%
|
||||||
|
\tc@correctbaseline{#1}%
|
||||||
|
}%
|
||||||
|
\tc@correctdims{#1}%
|
||||||
|
}
|
||||||
|
\def\@marginbox#1#2#3#4#5{%
|
||||||
|
\setbox#1=\hbox{%
|
||||||
|
%
|
||||||
|
\tc@llx=#2\relax
|
||||||
|
\tc@lly=#3\relax
|
||||||
|
\advance\tc@lly\dp#1%
|
||||||
|
\tc@urx=#4\relax
|
||||||
|
\advance\tc@urx\wd#1%
|
||||||
|
\tc@ury=#5\relax
|
||||||
|
\advance\tc@ury\ht#1%
|
||||||
|
%
|
||||||
|
% Set dimensions now.
|
||||||
|
% This allows that the arguments can refer
|
||||||
|
% to the original dimensions without issues.
|
||||||
|
\hskip\tc@llx
|
||||||
|
\dp#1\tc@lly
|
||||||
|
\wd#1\tc@urx
|
||||||
|
\ht#1\tc@ury
|
||||||
|
%
|
||||||
|
\box#1%
|
||||||
|
}%
|
||||||
|
\tc@correctdims{#1}%
|
||||||
|
}
|
||||||
|
\def\@marginraisebox#1#2#3#4#5{%
|
||||||
|
\setbox#1=\hbox{%
|
||||||
|
%
|
||||||
|
\tc@llx=#2\relax
|
||||||
|
\tc@lly=#3\relax
|
||||||
|
\tc@urx=#4\relax
|
||||||
|
\advance\tc@urx\wd#1%
|
||||||
|
\tc@ury=#5\relax
|
||||||
|
\advance\tc@ury\ht#1%
|
||||||
|
%
|
||||||
|
% Set dimensions now.
|
||||||
|
% This allows that the arguments can refer
|
||||||
|
% to the original dimensions without issues.
|
||||||
|
\hskip\tc@llx
|
||||||
|
\wd#1\tc@urx
|
||||||
|
\ht#1\tc@ury
|
||||||
|
% Copy original tty values (ury is taken as temp dimension)
|
||||||
|
\tc@ury=\tc@lly
|
||||||
|
\advance\tc@lly\dp#1%
|
||||||
|
\dp#1\tc@lly
|
||||||
|
% Raise bu original tty value (now in ury)
|
||||||
|
\raise\tc@ury\box#1%
|
||||||
|
}%
|
||||||
|
\tc@correctdims{#1}%
|
||||||
|
}
|
||||||
|
\def\@viewportbox#1#2#3#4#5{%
|
||||||
|
\setbox#1=\hbox{%
|
||||||
|
%
|
||||||
|
% Assign values
|
||||||
|
\tc@llx=#2\relax
|
||||||
|
\tc@lly=#3\relax
|
||||||
|
\tc@urx=#4\relax
|
||||||
|
\tc@ury=#5\relax
|
||||||
|
%
|
||||||
|
% Set dimensions now.
|
||||||
|
% This allows that the arguments can refer
|
||||||
|
% to the original dimensions without issues.
|
||||||
|
\hskip-\tc@llx
|
||||||
|
\dp#1-\tc@lly
|
||||||
|
\wd#1\tc@urx
|
||||||
|
\ht#1\tc@ury
|
||||||
|
%
|
||||||
|
\tc@correctbaseline{#1}%
|
||||||
|
}%
|
||||||
|
\tc@correctdims{#1}%
|
||||||
|
}
|
||||||
|
\def\@clipbox#1#2#3#4#5{%
|
||||||
|
\@trimbox{#1}{#2}{#3}{#4}{#5}%
|
||||||
|
\@cliptoboxdim{#1}%
|
||||||
|
}
|
||||||
|
\def\@clipvpbox#1#2#3#4#5{%
|
||||||
|
\@viewportbox{#1}{#2}{#3}{#4}{#5}%
|
||||||
|
\@cliptoboxdim{#1}%
|
||||||
|
}
|
||||||
|
\InputIfFileExists{\tc@driver}{%
|
||||||
|
{\let\on@line\@gobble
|
||||||
|
\PackageInfo{trimclip}{Using driver '\tc@driver'.}}%
|
||||||
|
}{%
|
||||||
|
\input{tc-pgf.def}%
|
||||||
|
{\let\on@line\@gobble
|
||||||
|
\PackageInfo{trimclip}{No clipping driver '\tc@driver' available.\MessageBreak Using fall-back PGF driver.}}%
|
||||||
|
}
|
||||||
|
\endinput
|
||||||
|
%%
|
||||||
|
%% End of file `trimclip.sty'.
|
12
gen.py
12
gen.py
@ -58,7 +58,7 @@ last_build = {}
|
|||||||
|
|
||||||
files_to_delete = [];
|
files_to_delete = [];
|
||||||
|
|
||||||
def serializeInlineImage(output_dir, no, attrValue):
|
def serializeInlineImage(output_dir, xep_nr, no, attrValue):
|
||||||
up = urlparse.urlparse(attrValue)
|
up = urlparse.urlparse(attrValue)
|
||||||
head, data = up.path.split(',')
|
head, data = up.path.split(',')
|
||||||
bits = head.split(';')
|
bits = head.split(';')
|
||||||
@ -76,14 +76,14 @@ def serializeInlineImage(output_dir, no, attrValue):
|
|||||||
# Do something smart with mime_type
|
# Do something smart with mime_type
|
||||||
if mime_type in ('image/png', 'image/jpeg'):
|
if mime_type in ('image/png', 'image/jpeg'):
|
||||||
file_ext = mime_type.split('/')[1]
|
file_ext = mime_type.split('/')[1]
|
||||||
f = open(output_dir + '/' + 'inlineimage-' + str(no) + '.' + file_ext, 'wb')
|
f = open(output_dir + '/' + 'inlineimage-' + xep_nr + '-' + str(no) + '.' + file_ext, 'wb')
|
||||||
f.write(plaindata)
|
f.write(plaindata)
|
||||||
|
|
||||||
def serializeXEPInlineImages(output_dir, filename):
|
def serializeXEPInlineImages(output_dir, xep_nr, filename):
|
||||||
dom = parse(filename)
|
dom = parse(filename)
|
||||||
imgs = dom.getElementsByTagName('img')
|
imgs = dom.getElementsByTagName('img')
|
||||||
for (no, img) in enumerate(imgs):
|
for (no, img) in enumerate(imgs):
|
||||||
serializeInlineImage(output_dir, no, img.attributes["src"].value)
|
serializeInlineImage(output_dir, xep_nr, no, img.attributes["src"].value)
|
||||||
|
|
||||||
def getText(nodelist):
|
def getText(nodelist):
|
||||||
thisText = ""
|
thisText = ""
|
||||||
@ -270,7 +270,7 @@ def buildXHTML( file, nr ):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
def buildPDF( file, nr ):
|
def buildPDF( file, nr ):
|
||||||
serializeXEPInlineImages("/tmp/xepbuilder", file)
|
serializeXEPInlineImages("/tmp/xepbuilder", nr, file)
|
||||||
|
|
||||||
error, desc = executeCommand("xsltproc -o /tmp/xepbuilder/xep-" + nr + ".tex.xml xep2texml.xsl " + file)
|
error, desc = executeCommand("xsltproc -o /tmp/xepbuilder/xep-" + nr + ".tex.xml xep2texml.xsl " + file)
|
||||||
if not checkError(error, desc):
|
if not checkError(error, desc):
|
||||||
@ -402,7 +402,7 @@ def main(argv):
|
|||||||
executeCommand("mkdir /tmp/xepbuilder")
|
executeCommand("mkdir /tmp/xepbuilder")
|
||||||
executeCommand("cp ../images/xmpp.pdf /tmp/xepbuilder/xmpp.pdf")
|
executeCommand("cp ../images/xmpp.pdf /tmp/xepbuilder/xmpp.pdf")
|
||||||
executeCommand("cp ../images/xmpp-text.pdf /tmp/xepbuilder/xmpp-text.pdf")
|
executeCommand("cp ../images/xmpp-text.pdf /tmp/xepbuilder/xmpp-text.pdf")
|
||||||
executeCommand("cp deps/tabu.sty /tmp/xepbuilder/tabu.sty")
|
executeCommand("cp -r deps /tmp/xepbuilder")
|
||||||
|
|
||||||
executeCommand("cp xep.ent /tmp/xep.ent")
|
executeCommand("cp xep.ent /tmp/xep.ent")
|
||||||
files_to_delete.append("/tmp/xep.ent")
|
files_to_delete.append("/tmp/xep.ent")
|
||||||
|
@ -409,8 +409,7 @@
|
|||||||
<xsl:template match="img">
|
<xsl:template match="img">
|
||||||
<env name="figure"><opt>H</opt>
|
<env name="figure"><opt>H</opt>
|
||||||
<cmd name="centering" />
|
<cmd name="centering" />
|
||||||
<!--<cmd name="includegraphics"><opt><TeXML escape="0">width=.9\textwidth</TeXML></opt><parm>inlineimage-<xsl:value-of select="count(preceding::img)" /></parm></cmd>-->
|
<cmd name="adjustimage"><parm><TeXML escape="0">max size={.9\textwidth}{.9\textheight}</TeXML></parm><parm>inlineimage-<xsl:value-of select="/xep/header/number" />-<xsl:value-of select="count(preceding::img)" /></parm></cmd>
|
||||||
<cmd name="adjustimage"><parm><TeXML escape="0">max size={.9\textwidth}{.9\textheight}</TeXML></parm><parm>inlineimage-<xsl:value-of select="count(preceding::img)" /></parm></cmd>
|
|
||||||
</env>
|
</env>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user