diff options
Diffstat (limited to 'macros/latex/contrib/incgraph/incgraph.sty')
-rw-r--r-- | macros/latex/contrib/incgraph/incgraph.sty | 502 |
1 files changed, 502 insertions, 0 deletions
diff --git a/macros/latex/contrib/incgraph/incgraph.sty b/macros/latex/contrib/incgraph/incgraph.sty new file mode 100644 index 0000000000..09bde04275 --- /dev/null +++ b/macros/latex/contrib/incgraph/incgraph.sty @@ -0,0 +1,502 @@ +%% The LaTeX package incgraph - version 1.12 (2015/03/12) +%% incgraph.sty: Graphics inclusion page +%% +%% ------------------------------------------------------------------------------------------- +%% Copyright (c) 2012-2015 by Prof. Dr. Dr. Thomas F. Sturm <thomas dot sturm at unibw dot 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 `author-maintained'. +%% +%% This work consists of all files listed in README +%% +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{incgraph}[2015/03/12 version 1.12 LaTeX special graphics inclusion] + +\DeclareOption{pgf}{\def\igrreq@pgf{\RequirePackage{pgf}[2008/01/15]\RequirePackage{pgffor}}}% +\DeclareOption{nopgf}{\def\igrreq@pgf{}}% +\DeclareOption{graphicx}{\def\igrreq@graphicx{\RequirePackage{graphicx}}}% +\DeclareOption{nographicx}{\def\igrreq@graphicx{}}% +\DeclareOption{bookmark}{\def\igrreq@bookmark{\RequirePackage{bookmark}}}% +\DeclareOption{nobookmark}{\def\igrreq@bookmark{}}% + +\ExecuteOptions{pgf,graphicx,bookmark} +\ProcessOptions\relax + +\RequirePackage{pgfkeys} +\igrreq@pgf +\igrreq@graphicx +\igrreq@bookmark + +% key management +\pgfkeys{/igr/.is family} + +\def\igrset{\pgfqkeys{/igr}} + +\newbox\igrbox +\newdimen\igr@length +\newcounter{igrtarget} + +\AtBeginDocument{% + \edef\igrOrginalPageWidth{\the\pdfpagewidth}% + \edef\igrOrginalPageHeight{\the\pdfpageheight}% +} + +\def\igr@target@auto{% + \xdef\igrAutoTarget{igr-\theigrtarget}% +} + +\def\igr@target@user{% + \xdef\igrAutoTarget{\igr@usertarget}% + \global\let\igr@target@next=\igr@target@auto% +} + +\let\igr@target@next=\igr@target@auto + +\def\igrtargetset#1{% + \def\igr@usertarget{#1}% + \let\igr@target@next=\igr@target@user% +} + +\def\igr@nextAutoTarget{% + \refstepcounter{igrtarget}% + \igr@target@next% +} + +\def\igr@do@rebox{% + \setbox\igrbox\hbox{% + \kern\igr@left@border% + \vbox{% + \kern\igr@top@border% + \box\igrbox% + \kern\igr@bottom@border% + }% + \kern\igr@right@border}% +} + +\def\igr@rebox{% + \ifdim\igr@top@border=0pt\relax% + \ifdim\igr@bottom@border=0pt\relax% + \ifdim\igr@left@border=0pt\relax% + \ifdim\igr@right@border=0pt\relax% + \else% + \igr@do@rebox% + \fi% + \else% + \igr@do@rebox% + \fi% + \else% + \igr@do@rebox% + \fi% + \else% + \igr@do@rebox% + \fi% +} + +\long\def\igrboxset#1{% + \igr@nextAutoTarget% + \setbox\igrbox\color@hbox#1\color@endbox% + \igr@rebox% + \igr@length=\wd\igrbox% + \edef\igrBoxWidth{\the\igr@length}% + \igr@length=\ht\igrbox% + \edef\igrBoxht{\the\igr@length}% + \igr@length=\dp\igrbox% + \edef\igrBoxdp{\the\igr@length}% + \advance\igr@length by \igrBoxht% + \edef\igrBoxHeight{\the\igr@length}% +} + + +\def\igr@hyper{\hypertarget{\igrAutoTarget}{}} +\def\igr@empty{} + +\def\igrboxcenter{% + \thispagestyle{\igrpagestyle}% + % + \igr@length=-1in% + \advance\igr@length by -\voffset% + \advance\igr@length by -\topmargin% + \advance\igr@length by -\headheight% + \advance\igr@length by -\headsep% + \edef\igr@offy@top{\the\igr@length}% + % + \igr@length=\pdfpageheight% + \advance\igr@length by -\igrBoxHeight% + \divide\igr@length by 2% + \edef\igr@offy@abs{\the\igr@length}% + % + \igr@length=-1in% + \advance\igr@length by -\hoffset% + \if@twoside + \ifodd\c@page + \advance\igr@length by -\oddsidemargin% + \else + \advance\igr@length by -\evensidemargin% + \fi + \else + \advance\igr@length by -\oddsidemargin% + \fi% + \edef\igr@offx@left{\the\igr@length}% + % + \igr@length=\pdfpagewidth% + \advance\igr@length by -\igrBoxWidth% + \divide\igr@length by 2% + \advance\igr@length by \igr@offx@left% + \edef\igr@offx{\the\igr@length}% + % + \vbox to \vsize{% + \kern\igr@offy@top\hbox{\kern\igr@offx@left\igr@hypertarget\hss}% + \nointerlineskip\kern\igr@offy@abs% + \hbox to \hsize{\kern\igr@offx\box\igrbox\hss}% + \vss}% + \break% +} + +\def\igrboxtikz{% + \path[use as bounding box] (0,0) rectangle (\igrBoxWidth,\igrBoxHeight); + \node[line width=0mm,inner sep=0,rectangle,above right] (box) at (0,0) {\box\igrbox}; + \node[minimum width=\igrBoxWidth,minimum height=\igrBoxHeight,line width=0mm,inner sep=0mm,above right] (page) at (0,0) {};% +} + +\let\igrboxtikzpage=\igrboxtikz + +\def\igrboxtikzcenter{% + \path[use as bounding box] (0,0) rectangle (\pdfpagewidth,\pdfpageheight); + \node[line width=0mm,inner sep=0,rectangle,above right] (box) at ({(\pdfpagewidth-\igrBoxWidth)/2},{(\pdfpageheight-\igrBoxHeight)/2}) {\box\igrbox}; + \edef\igrBoxWidth{\the\pdfpagewidth}% + \edef\igrBoxHeight{\the\pdfpageheight}% + \node[minimum width=\igrBoxWidth,minimum height=\igrBoxHeight,line width=0mm,inner sep=0mm,above right] (page) at (0,0) {};% +} + +\def\igr@overlay@on{% + \igrboxset{\begin{tikzpicture}\igrboxtikzcenter\igr@tikz@hook\end{tikzpicture}}} + +\def\igr@overlay@off{} + +\let\igr@overlay=\igr@overlay@off + +% Output macros + +\def\igr@out@resize#1#2{% + \edef\igrCurrentPageWidth{\the\pdfpagewidth}% + \edef\igrCurrentPageHeight{\the\pdfpageheight}% + \eject% + \pdfpagewidth=#1% + \pdfpageheight=#2% + \igr@overlay% + \edef\theigrpage{\thepage}% + \igrboxcenter% + \pdfpagewidth=\igrCurrentPageWidth% + \pdfpageheight=\igrCurrentPageHeight% +} + +\def\igr@out@center@fit@port{% + \igr@out@resize{\igr@target@width}{\igr@target@height}% +} + +\def\igr@out@center@fit@land{% + \igr@out@resize{\igr@target@height}{\igr@target@width}% +} + +\def\igr@out@center@fit{% + \csname igr@out@center@fit@\igr@turn\endcsname% +} + +\def\igr@out@page{% + \igr@out@resize{\igrBoxWidth}{\igrBoxHeight}% +} + +\def\igr@out@center@port{% + \clearpage% + \igr@overlay% + \edef\theigrpage{\thepage}% + \igrboxcenter% +} + +\def\igr@out@center@land{% + \edef\igr@temp@w{\the\pdfpagewidth}\edef\igr@temp@h{\the\pdfpageheight}% + \igr@out@resize{\igr@temp@h}{\igr@temp@w}% +} + +\def\igr@out@center{% + \csname igr@out@center@\igr@turn\endcsname% +} + +% Toolbox output + +\long\def\igrcenterfit#1#2#3{% + \igrboxset{#3}% + \igr@out@resize{#1}{#2}% +} + +\long\def\igrpage#1{% + \igrboxset{#1}% + \igr@out@page% +} + +\long\def\igrcenter#1{% + \igrboxset{#1}% + \igr@out@center@port% +} + + +% include macros + +\def\incgraph{% + \@ifnextchar[{\inc@graph}{\inc@graph[]}} + +\def\inc@graph[#1]{% + \@ifnextchar[{\inc@@graph[#1]}{\inc@@graph[#1][]}} + +\long\def\inc@@graph[#1][#2]#3{% + \begingroup% + \def\nt{#3}% + \igr@if@file@exists{\nt}{% + \igrset{#1}% + \igr@match@hook% + \edef\igr@incgraph{\noexpand\igr@include@graphics[\igr@options,#2]}% + \igrboxset{\igr@incgraph{\nt}\ifx\igr@label@text\igr@empty\else\label{\igr@label@text}\fi}% + \igr@output% + \ifx\igr@bookmark@text\igr@empty\else% + \edef\igr@bookmark{\noexpand\bookmark[\igr@bookmark@options,dest=\noexpand\igrAutoTarget]}% + \igr@bookmark{\igr@bookmark@text}\fi% + }{}% + \endgroup% +} + +\def\igr@bookmark@heading{% + \global\let\igr@process@label=\igr@empty% + \ifx\igr@bookmark@heading@text\igr@empty\else% + \edef\igr@bookmark{\noexpand\bookmark[\igr@bookmark@heading@options,dest=\noexpand\igrAutoTarget]}% + \igr@bookmark{\igr@bookmark@heading@text}\fi% + \global\let\igr@process@bookmark@heading=\igr@empty% +} + +\def\incmultigraph{% + \@ifnextchar[{\inc@multigraph}{\inc@multigraph[]}} + +\def\inc@multigraph[#1]{% + \@ifnextchar[{\inc@@multigraph[#1]}{\inc@@multigraph[#1][]}} + +\long\def\inc@@multigraph[#1][#2]#3#4{% + \begingroup% + \igrset{#1}% + \ifx\igr@label@text\igr@empty\global\let\igr@process@label=\igr@empty\else% + \global\def\igr@process@label{\label{\igr@label@text}}\fi% + \global\let\igr@process@bookmark@heading=\igr@bookmark@heading% + \foreach \n [count=\ni] in {#4} {% + \edef\nn{\igr@zero@fill{\n}}% + \def\nt{#3}% + \igr@if@file@exists{\nt}{% + \igr@match@hook% + \edef\igr@incgraph{\noexpand\igr@include@graphics[\igr@options,#2]}% + \igrboxset{\igr@incgraph{\nt}\igr@process@label}% + \igr@output% + \igr@process@bookmark@heading% + \ifx\igr@bookmark@text\igr@empty\else% + \edef\igr@bookmark{\noexpand\bookmark[\igr@bookmark@options,dest=\noexpand\igrAutoTarget]}% + \igr@bookmark{\igr@bookmark@text}\fi% + }{}}\endgroup% +} + + +\newenvironment{inctext}[1][]{% + \igrset{#1}% + \igr@match@hook% + \igr@nextAutoTarget% + \clearpage\begin{lrbox}{\igrbox}% +}{% + \unskip\ifx\igr@label@text\igr@empty\else\label{\igr@label@text}\fi\end{lrbox}% + \igr@rebox% + \igr@length=\wd\igrbox% + \edef\igrBoxWidth{\the\igr@length}% + \igr@length=\ht\igrbox% + \edef\igrBoxht{\the\igr@length}% + \igr@length=\dp\igrbox% + \edef\igrBoxdp{\the\igr@length}% + \advance\igr@length by \igrBoxht% + \edef\igrBoxHeight{\the\igr@length}% + \igr@output% + \ifx\igr@bookmark@text\igr@empty\else% + \edef\igr@bookmark{\noexpand\bookmark[\igr@bookmark@options,dest=\noexpand\igrAutoTarget]}% + \igr@bookmark{\igr@bookmark@text}\fi% +} + + +\def\igr@make@zerofill#1#2#3#4#5#6#7#8#9{% + \def\igr@zerofill##1{% + \ifnum##1<10 #1% + \else\ifnum##1<100 #2% + \else\ifnum##1<1000 #3% + \else\ifnum##1<10000 #4% + \else\ifnum##1<100000 #5% + \else\ifnum##1<1000000 #6% + \else\ifnum##1<10000000 #7% + \else\ifnum##1<100000000 #8% + \else\ifnum##1<1000000000 #9% + \fi\fi\fi\fi\fi\fi\fi\fi\fi% + ##1% + }% +} + +\def\igrmakezerofill#1#2{% + \def\igr@zerofill##1{##1}% + \ifcase#2\or\or\igr@make@zerofill{0}{}{}{}{}{}{}{}{}% + \or\igr@make@zerofill{00}{0}{}{}{}{}{}{}{}% + \or\igr@make@zerofill{000}{00}{0}{}{}{}{}{}{}% + \or\igr@make@zerofill{0000}{000}{00}{0}{}{}{}{}{}% + \or\igr@make@zerofill{00000}{0000}{000}{00}{0}{}{}{}{}% + \or\igr@make@zerofill{000000}{00000}{0000}{000}{00}{0}{}{}{}% + \or\igr@make@zerofill{0000000}{000000}{00000}{0000}{000}{00}{0}{}{}% + \or\igr@make@zerofill{00000000}{0000000}{000000}{00000}{0000}{000}{00}{0}{}% + \else\igr@make@zerofill{000000000}{00000000}{0000000}{000000}{00000}{0000}{000}{00}{0}% + \fi% + \let#1=\igr@zerofill% +} + +\newcommand{\igrsetmatchvalue}[2]{% + \pgfkeyssetvalue{/igrmatch/#1}{#2}% +} + +\newcommand{\igrifmatch}[3]{% + \pgfkeysifdefined{/igrmatch/#1}{% + \pgfkeysgetvalue{/igrmatch/#1}{\igrmatchvalue}#2}{#3}% +} + +\pgfkeys{% + /igrsetmatch/.unknown/.code={% + \let\igrmatchkey=\pgfkeyscurrentname% + \igrsetmatchvalue{\igrmatchkey}{#1}% + }% +} + +\newcommand{\igrsetmatches}[1]{\pgfkeys{/igrsetmatch/.cd,#1}} + +\newcommand{\igr@no@existence@check}[3]{#2} + + +\igrset{% + options/.store in=\igr@options, + options add/.code={% + \toks0=\expandafter{\igr@options}% + \def\temp{#1}\toks1=\expandafter{\temp}% + \edef\igr@options{\the\toks0,\the\toks1}}, + bookmark/.store in=\igr@bookmark@text, + bookmark options/.store in=\igr@bookmark@options, + bookmark heading/.store in=\igr@bookmark@heading@text, + bookmark heading options/.store in=\igr@bookmark@heading@options, + label/.store in=\igr@label@text, + zerofill/.code={\igrmakezerofill{\igr@zero@fill}{#1}}, + set matches/.code=\igrsetmatches{#1}, + hyper/.code={\let\igr@hypertarget=\igr@hyper}, + no hyper/.code={\let\igr@hypertarget=\igr@empty}, + if match code/.code args={#1#2#3}{\def\igr@match@hook{\igrifmatch{#1}{#2}{#3}}}, + if match set/.style args={#1#2#3}{if match code={#1}{\igrset{#2}}{\igrset{#3}}}, + if match set bookmark/.style args={#1#2#3}{if match code={#1}{\igrset{bookmark={#2}}}{\igrset{bookmark={#3}}}}, + disable match/.code={\let\igr@match@hook=\igr@empty}, + include command/.code={\let\igr@include@graphics=#1}, + include command/.default=\includegraphics, + existence check/.code={\let\igr@if@file@exists=#1}, + fail on not found/.style={existence check=\igr@no@existence@check}, + ignore on not found/.style={existence check=\IfFileExists}, + pagestyle/.store in=\igrpagestyle, + target/.code={\igrtargetset{#1}}, + overlay@code/.store in=\igr@tikz@hook, + overlay/.code={\let\igr@overlay=\igr@overlay@on\igrset{overlay@code={#1}}}, + overlay page number at/.style={overlay={\node[fill opacity=0.35,draw opacity=0.5,text opacity=1, + inner xsep=1em,rounded corners,fill=white,draw=black] at (#1) {\thepage};}}, + overlay page number at top/.style={overlay page number at={\igrBoxWidth/2,\igrBoxHeight-#1}}, + overlay page number at top/.default=1.5cm, + overlay page number at bottom/.style={overlay page number at={\igrBoxWidth/2,#1}}, + overlay page number at bottom/.default=1.5cm, + no overlay/.code={\let\igr@overlay=\igr@overlay@off}, + portrait/.code={\def\igr@turn{port}}, + landscape/.code={\def\igr@turn{land}}, + paper size/.code args={#1:#2}{\def\igr@target@width{#1}\def\igr@target@height{#2}\let\igr@output=\igr@out@center@fit}, + a0paper/.style={paper size=841mm:1189mm}, + a1paper/.style={paper size=594mm:841mm}, + a2paper/.style={paper size=420mm:594mm}, + a3paper/.style={paper size=297mm:420mm}, + a4paper/.style={paper size=210mm:297mm}, + a5paper/.style={paper size=148mm:210mm}, + a6paper/.style={paper size=105mm:148mm}, + a7paper/.style={paper size=74mm:105mm}, + a8paper/.style={paper size=52mm:74mm}, + a9paper/.style={paper size=37mm:52mm}, + a10paper/.style={paper size=26mm:37mm}, + b0paper/.style={paper size=1000mm:1414mm}, + b1paper/.style={paper size=707mm:1000mm}, + b2paper/.style={paper size=500mm:707mm}, + b3paper/.style={paper size=353mm:500mm}, + b4paper/.style={paper size=250mm:353mm}, + b5paper/.style={paper size=176mm:250mm}, + b6paper/.style={paper size=125mm:176mm}, + b7paper/.style={paper size=88mm:125mm}, + b8paper/.style={paper size=62mm:88mm}, + b9paper/.style={paper size=44mm:62mm}, + b10paper/.style={paper size=31mm:44mm}, + c0paper/.style={paper size=917mm:1297mm}, + c1paper/.style={paper size=648mm:917mm}, + c2paper/.style={paper size=648mm:917mm}, + c3paper/.style={paper size=324mm:458mm}, + c4paper/.style={paper size=229mm:324mm}, + c5paper/.style={paper size=162mm:229mm}, + c6paper/.style={paper size=114mm:162mm}, + c7paper/.style={paper size=81mm:114mm}, + c8paper/.style={paper size=57mm:81mm}, + c9paper/.style={paper size=40mm:57mm}, + c10paper/.style={paper size=28mm:40mm}, + d0paper/.style={paper size=771mm:1091mm}, + d1paper/.style={paper size=545mm:771mm}, + d2paper/.style={paper size=385mm:545mm}, + d3paper/.style={paper size=272mm:385mm}, + d4paper/.style={paper size=192mm:272mm}, + d5paper/.style={paper size=136mm:192mm}, + d6paper/.style={paper size=96mm:136mm}, + d7paper/.style={paper size=68mm:96mm}, + executivepaper/.style={paper size=7.25in:10.5in}, + letterpaper/.style={paper size=8.5in:11in}, + legalpaper/.style={paper size=8.5in:14in}, + ledgerpaper/.style={paper size=17in:11in}, + currentpaper/.code={\let\igr@output=\igr@out@center}, + documentpaper/.style={paper size=\igrOrginalPageWidth:\igrOrginalPageHeight}, + graphicspaper/.code={\let\igr@output=\igr@out@page}, + paper/.style={#1paper}, + center/.style=currentpaper, + page/.style=graphicspaper, + left border/.store in=\igr@left@border, + bottom border/.store in=\igr@bottom@border, + right border/.store in=\igr@right@border, + top border/.store in=\igr@top@border, + horizontal border/.style={left border=#1,right border=#1}, + vertical border/.style={bottom border=#1,top border=#1}, + border/.style={left border=#1,bottom border=#1,right border=#1,top border=#1}, +% + graphicspaper, + options=, + bookmark=, + bookmark options=, + bookmark heading=, + bookmark heading options=, + label=, + zerofill=0, + hyper, + disable match, + include command, + ignore on not found, + pagestyle=empty, + overlay@code=, + no overlay, + portrait, + border=0pt, +} + + |