From 91cb42bff9c7b199df5a79da4622ed072385d2f3 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 8 Mar 2011 00:13:24 +0000 Subject: gincltex (7mar11) git-svn-id: svn://tug.org/texlive/trunk@21635 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/gincltex/gincltex.sty | 136 ++++++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100644 Master/texmf-dist/tex/latex/gincltex/gincltex.sty (limited to 'Master/texmf-dist/tex') diff --git a/Master/texmf-dist/tex/latex/gincltex/gincltex.sty b/Master/texmf-dist/tex/latex/gincltex/gincltex.sty new file mode 100644 index 00000000000..b31d169fb0e --- /dev/null +++ b/Master/texmf-dist/tex/latex/gincltex/gincltex.sty @@ -0,0 +1,136 @@ +%% +%% This is file `gincltex.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% gincltex.dtx (with options: `package') +%% +%% Copyright (C) 2011 by Martin Scharrer +%% +%% 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 2008/05/04 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 gincltex.dtx, gincltex.ins +%% and the derived file gincltex.sty. +%% +\RequirePackage{svn-prov} +\ProvidesPackage{gincltex} + [2011/03/06 v0.1 Include external LaTeX files like graphics] +\newif\if@gincltex@bbfile +\DeclareOption{bb=file}{\@gincltex@bbfiletrue} +\DeclareOption{bb=aux}{\@gincltex@bbfilefalse} +\ProcessOptions*\relax +\RequirePackage{graphics} +\RequirePackage{pgf} +\DeclareGraphicsRule{.tex}{tex}{.tex}{} +\newsavebox\gincltex@box +\def\gincltex@input#1{% + {\let\Gin@ext\relax\input{#1}}% +} +\def\Ginclude@tex#1{% + \begingroup + \ifvoid\gincltex@box + \sbox\gincltex@box{{\gincltex@input{#1}}}% + \fi + \def\Gin@llx{0}% + \Gin@defaultbp\Gin@lly{-\dp\gincltex@box}% + \Gin@defaultbp\Gin@urx{\wd\gincltex@box}% + \Gin@defaultbp\Gin@ury{\ht\gincltex@box}% + \Gscale@@box\totalheight{\Gin@req@width}{\Gin@req@height}{% + \begin{pgfpicture}% + \pgfkeys{/pgf/.cd,inner sep=0pt,outer sep=0pt}% + \pgfpathmoveto{\pgfqpoint{\Gin@llx bp}{\Gin@lly bp}}% + \pgfpathlineto{\pgfqpoint{\Gin@urx bp}{\Gin@lly bp}}% + \pgfpathlineto{\pgfqpoint{\Gin@urx bp}{\Gin@ury bp}}% + \pgfpathlineto{\pgfqpoint{\Gin@llx bp}{\Gin@ury bp}}% + \pgfpathclose + \expandafter + \pgfusepath\ifGin@clip{clip}\else{use as bounding box}\fi + \pgfnode{rectangle}{base west}{\usebox\gincltex@box}{}{}% + \end{pgfpicture}% + }% + \endgroup +} +\if@gincltex@bbfile +\@ifundefined{gincltex@bbout}{\newwrite\gincltex@bbout}{} +\def\Gread@tex#1{% + \IfFileExists{#1.bb}% + {% + \edef\Gread@BBox{\@percentchar\@percentchar HiResBoundingBox}% + \Gread@eps{#1.bb}% + }% + {% + \sbox\gincltex@box{{\gincltex@input{#1}}}% + \def\Gin@llx{0}% + \Gin@defaultbp\Gin@lly{-\dp\gincltex@box}% + \Gin@defaultbp\Gin@urx{\wd\gincltex@box}% + \Gin@defaultbp\Gin@ury{\ht\gincltex@box}% + \expandafter\xdef\csname gincltex@bb@#1\endcsname + {{\Gin@llx}{\Gin@lly}{\Gin@urx}{\Gin@ury}}% + \if@filesw + \immediate\write\@auxout{\string\gincltex@bb{#1}% + \csname gincltex@bb@#1\endcsname}% + \fi + }% +} +\def\gincltex@bb#1#2#3#4#5{} +\AtBeginDocument{\let\gincltex@bb\gincltex@@bb} +\def\gincltex@@bb#1#2#3#4#5{% + \begingroup + \immediate\openout\gincltex@bbout=#1.bb\relax + %\pgfmathtruncatemacro\llx{ceil(#2)}% + %\pgfmathtruncatemacro\lly{ceil(#3)}% + %\pgfmathtruncatemacro\urx{ceil(#4)}% + %\pgfmathtruncatemacro\ury{ceil(#5)}% + %\immediate\write\gincltex@bbout{\@percentchar + % \@percentchar BoundingBox: \llx\space\lly\space\urx\space\ury}% + \immediate\write\gincltex@bbout{\@percentchar + \@percentchar HiResBoundingBox: #2 #3 #4 #5}% + \immediate\closeout\gincltex@bbout + \endgroup +} +\else +\def\Gread@tex@setbb#1#2#3#4{% + \def\Gin@llx{#1}% + \def\Gin@lly{#2}% + \def\Gin@urx{#3}% + \def\Gin@ury{#4}% +} +\def\Gread@tex#1{% + \ifcase0\ifGin@draft\@ifundefined{gincltex@bb@#1}{0}{1}\fi\relax + \sbox\gincltex@box{{\gincltex@input{#1}}}% + \def\Gin@llx{0}% + \Gin@defaultbp\Gin@lly{-\dp\gincltex@box}% + \Gin@defaultbp\Gin@urx{\wd\gincltex@box}% + \Gin@defaultbp\Gin@ury{\ht\gincltex@box}% + \expandafter\xdef\csname gincltex@bb@#1\endcsname + {{\Gin@llx}{\Gin@lly}{\Gin@urx}{\Gin@ury}}% + \else + \expandafter\expandafter\expandafter\Gread@tex@setbb + \csname gincltex@bb@#1\endcsname + \setbox\gincltex@box=\box\voidb@x + \fi + \if@filesw + \immediate\write\@auxout{\string\gincltex@bb{#1}% + \csname gincltex@bb@#1\endcsname}% + \fi +} +\def\gincltex@bb#1#2#3#4#5{% + \global\@namedef{gincltex@bb@#1}{{#2}{#3}{#4}{#5}}% +} +\fi +\endinput +%% +%% End of file `gincltex.sty'. -- cgit v1.2.3