diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/hvextern')
-rw-r--r-- | Master/texmf-dist/tex/latex/hvextern/hvextern.sty | 101 |
1 files changed, 77 insertions, 24 deletions
diff --git a/Master/texmf-dist/tex/latex/hvextern/hvextern.sty b/Master/texmf-dist/tex/latex/hvextern/hvextern.sty index 0b6eafa6c6d..8b0fa75f1f4 100644 --- a/Master/texmf-dist/tex/latex/hvextern/hvextern.sty +++ b/Master/texmf-dist/tex/latex/hvextern/hvextern.sty @@ -11,11 +11,12 @@ %% and version 1.3c or later is part of all distributions of LaTeX %% version 2005/12/01 or later. -\def\hvexternFileversion{0.25} -\ProvidesFile{hvextern}[2022/05/19 v\hvexternFileversion: package for running external documents (HV)] +\def\hvexternFileversion{0.26} +\ProvidesFile{hvextern}[2022/05/23 v\hvexternFileversion: package for running external documents (HV)] \RequirePackage{shellesc,xkeyval,graphicx} \RequirePackage{fancyvrb,tikz,listings,ifplatform} +\RequirePackage{ifoddpage} \RequirePackage{tcolorbox,xparse} \tcbuselibrary{skins,breakable} @@ -39,6 +40,7 @@ \newlength\hv@extern@belowpreambleskip \newlength\hv@extern@belowbodyskip \newlength\hv@extern@belowskip +\newlength\hv@extern@shiftFN \AtBeginDocument{\setlength\hv@LineWidth{\dimexpr\linewidth-2\fboxsep-2\fboxrule}} \newlength\hv@extern@mpwidth \setlength\hv@extern@mpwidth{\z@} @@ -72,6 +74,8 @@ \define@boolkey{hv}[hv@extern@]{redirect}[true]{} \define@boolkey{hv}[hv@extern@]{usefancyvrb}[true]{} \define@boolkey{hv}[hv@extern@]{showFilename}[true]{} +\define@boolkey{hv}[hv@extern@]{outerFN}[true]{} +\define@key{hv}{shiftFN}[0pt]{\setlength\hv@extern@shiftFN{#1}} \define@boolkey{hv}[hv@extern@]{code}[true]{} \define@boolkey{hv}[hv@extern@]{force}[true]{} \define@boolkey{hv}[hv@extern@]{crop}[true]{} @@ -98,7 +102,6 @@ \define@boolkey{hv}[hv@extern@]{eps}[true]{} \define@boolkey{hv}[hv@extern@]{verbose}[true]{} \def\hv@typeout#1{\ifhv@extern@verbose\typeout{#1}\fi} -%\define@key{hv}{compiler}[pdflatex]{\def\hv@extern@compiler{#1}} \define@choicekey*+{hv}{compiler}[\val\nr]{mpost,tex,latex,luatex,python3,perl,lua,java,% xetex,pdflatex,lualatex,xelatex,context,sh,texlua}[pdflatex]{% \hv@typeout{>>>> Compiler type \nr}% @@ -113,9 +116,13 @@ \define@key{hv}{belowbodyskip}[\smallskipamount]{\setlength\hv@extern@belowbodyskip{#1}} \define@key{hv}{belowskip}[\medskipamount]{\setlength\hv@extern@belowskip{#1}} +\def\hvExternSetKeys#1{\setkeys{hv}{#1}} + \def\ResetKeys{% \setkeys{hv}{% showFilename=false,% Dateinamen im Rand angeben + outerFN=false,% use fullwidth in twocolumn mode (starred floats) + shiftFN=\z@,% raise printed filename ext=tex,% file extension code=false,% show Code crop=false,% erzeugte PDF "croppen" @@ -164,6 +171,7 @@ }% } + \ResetKeys {\catcode`\%=12 @@ -195,7 +203,39 @@ \tcbset{breakable,left=2pt,right=2pt,top=2pt,bottom=2pt,boxsep=0pt} \def\hv@marginpar#1{% - \makebox[\dimexpr\hv@TextWidth+\marginparsep-1ex][r]{\makebox(0,0){\rotatebox[origin=lb]{90}{#1}}}% + \leavevmode\checkoddpage + \sbox\hv@extern@box{\rotatebox[origin=C]{90}{\rule{2\hv@extern@shiftFN}{0pt}#1}}% + \ht\hv@extern@box=\z@ \wd\hv@extern@box=\z@ \dp\hv@extern@box=\z@ + \noindent + \ifoddpage% we have a right page + \if@twocolumn + \ifhv@extern@outerFN + \makebox[\dimexpr\hv@TextWidth+\marginparsep-1.5ex][r]{\usebox\hv@extern@box}% + \else + \if@firstcolumn + \llap{\usebox\hv@extern@box\rule{2.5ex}{0pt}}% + \else + \makebox[\dimexpr\hv@TextWidth+\marginparsep-1.5ex][r]{\usebox\hv@extern@box}% + \fi + \fi + \else + \makebox[\dimexpr\hv@TextWidth+\marginparsep-1.5ex][r]{\usebox\hv@extern@box}% + \fi + \else% we have an even page (left page) + \if@twocolumn + \ifhv@extern@outerFN + \llap{\usebox\hv@extern@box\rule{2.5ex}{0pt}}% left page left side + \else + \if@firstcolumn + \llap{\usebox\hv@extern@box\rule{2.5ex}{0pt}}% left page left side + \else + \makebox[\dimexpr\hv@TextWidth+\marginparsep-1.5ex][r]{\usebox\hv@extern@box}% left page right side + \fi + \fi + \else + \llap{\usebox\hv@extern@box\rule{2.5ex}{0pt}}% onecolumn left page left side + \fi + \fi } \newcommand\PreambleVerbatim[2][]{% @@ -353,8 +393,10 @@ %% %% [#1]: Optionen #2: Dateiname %% -\newenvironment{externalDocument}[2][]{% +\newenvironment{externalDocument}[2][] + {% \xdef\hvExternDateiname{#2-\arabic{hv@example@counter}}% + \gdef\hv@extern@savePara{#1}% \setkeys{hv}{#1}% \begin \hv@typeout{External filename: \hvExternDateiname}% \expandafter\IfFileExists\expandafter{\hv@extern@ExamplesDir\hvExternDateiname.pdf}{}{% @@ -369,6 +411,8 @@ \hv@typeout{>>> ... done}% \global\stepcounter{hv@example@counter}% \endgroup + \expandafter\hvExternSetKeys\expandafter{\hv@extern@savePara}% + \xdef\hv@extern@fullPath{\hv@extern@ExamplesDir\hvExternDateiname}% \ifhv@extern@force \ifx\hv@extern@runsequence\@empty \hv@typeout{>>>> force=true: running \hv@extern@progpath\hv@extern@compiler~ \hvExternDateiname\hv@extern@ext ...}% @@ -417,7 +461,15 @@ \ifhv@extern@code%-------------- Code Part \hv@typeout{>>>>Starting Code part with preamble ...}% \begingroup - \hv@TextWidth=\textwidth + \if@twocolumn + \ifhv@extern@outerFN + \hv@TextWidth=\textwidth + \else + \hv@TextWidth=\columnwidth + \fi + \else + \hv@TextWidth=\textwidth + \fi \ifdim\hv@extern@mpwidth>\z@ \noindent \minipage[\hv@extern@mpvalign]{\hv@extern@mpwidth} @@ -477,12 +529,12 @@ \ifhv@extern@moveToExampleDir % \ShellEscape{mkdir\space\hv@extern@ExamplesDir/}% \hv@typeout{>>>> Move file into example dir}% - \hv@typeout{>>>>>>\hvExternDateiname ---- \hv@extern@ExamplesDir}% + \hv@typeout{>>>>>>\hvExternDateiname ----> \hv@extern@ExamplesDir}% \ShellEscape{\hv@move \hvExternDateiname.*\space \hv@extern@ExamplesDir}% \fi \ifhv@extern@includegraphic \ifhv@extern@inline - \expandafter\includegraphics\expandafter[\hv@extern@grfOptions]{\hv@extern@ExamplesDir\hvExternDateiname}% + \expandafter\includegraphics\expandafter[\hv@extern@grfOptions]{\hv@extern@fullPath}% \else \ifhv@extern@float \hv@typeout{>>>> Floating environment}% @@ -498,19 +550,21 @@ \fi \fi \hv@extern@align - \hv@typeout{>>>> Input image \hv@extern@ExamplesDir\hvExternDateiname}% + \hv@typeout{>>>> Input image \hv@extern@fullPath}% \ifhv@extern@frame \begingroup \fboxsep=\hv@extern@framesep \expandafter\@for\expandafter\next\expandafter:\expandafter=\hv@extern@pages\do{% + \hv@typeout{>>>> Image loop: next=\next\space \hv@extern@fullPath}% \fbox{\expandafter\includegraphics\expandafter[\hv@extern@grfOptions,page=\next]% - {\hv@extern@ExamplesDir\hvExternDateiname}}\hspace{\hv@extern@pagesep}}% + {\hv@extern@fullPath}}\hspace{\hv@extern@pagesep}}% \hspace*{-\hv@extern@pagesep}% \endgroup \else \expandafter\@for\expandafter\next\expandafter:\expandafter=\hv@extern@pages\do{% + \hv@typeout{>>>> Image loop: next=\next\space \hv@extern@fullPath}% \expandafter\includegraphics\expandafter[\hv@extern@grfOptions,page=\next]% - {\hv@extern@ExamplesDir\hvExternDateiname}\hspace{\hv@extern@pagesep}}% + {\hv@extern@fullPath}\hspace{\hv@extern@pagesep}}% \hspace*{-\hv@extern@pagesep}% \fi \ifx\hv@extern@caption\@empty\else\caption{\hv@extern@caption}\fi @@ -518,25 +572,25 @@ \ifhv@extern@float \endfigure \else - \ifdim\hv@extern@mpwidth>\z@ \endminipage\else\par\endgroup\fi + \ifdim\hv@extern@mpwidth>\z@ \endminipage\else\unskip\strut\par\endgroup\fi \fi \fi \else% no graphic, only text \ifdim\hv@extern@mpwidth>\z@ \hfill\minipage[t]{\dimexpr\linewidth-\hv@extern@mpwidth-\hv@extern@mpsep\relax}\vspace{0pt} \ifhv@extern@usefancyvrb - \expandafter\VerbatimInput\expandafter[\hv@extern@textOptions]{\hv@extern@ExamplesDir\hvExternDateiname.txt}% + \expandafter\VerbatimInput\expandafter[\hv@extern@textOptions]{\hv@extern@fullPath.txt}% \else - \expandafter\lstinputlisting\expandafter[\hv@extern@textOptions]{\hv@extern@ExamplesDir\hvExternDateiname.txt}% + \expandafter\lstinputlisting\expandafter[\hv@extern@textOptions]{\hv@extern@fullPath.txt}% \fi \endminipage \else \vspace{\hv@extern@belowbodyskip} \noindent \ifhv@extern@usefancyvrb - \expandafter\VerbatimInput\expandafter[\hv@extern@textOptions]{\hv@extern@ExamplesDir\hvExternDateiname.txt}% + \expandafter\VerbatimInput\expandafter[\hv@extern@textOptions]{\hv@extern@fullPath.txt}% \else - \expandafter\lstinputlisting\expandafter[\hv@extern@textOptions]{\hv@extern@ExamplesDir\hvExternDateiname.txt}% + \expandafter\lstinputlisting\expandafter[\hv@extern@textOptions]{\hv@extern@fullPath.txt}% \fi \fi \fi @@ -548,6 +602,7 @@ \begingroup \setkeys{hv}{code=false,includegraphic=false,#1}% \xdef\hvExternDateiname{#3-\arabic{hv@example@counter}}% + \xdef\hv@extern@fullPath{\hv@extern@ExamplesDir\hvExternDateiname}% \hv@typeout{>>>> running #2}% \ifhv@extern@redirect \ShellEscape{\hv@extern@progpath#2 > \hv@extern@ExamplesDir\hvExternDateiname.txt}% @@ -573,13 +628,12 @@ \begingroup \fboxsep=\hv@extern@framesep \expandafter\@for\expandafter\next\expandafter:\expandafter=\hv@extern@pages\do{% - \fbox{\expandafter\includegraphics\expandafter[\hv@extern@grfOptions,page=\next]{\hv@extern@ExamplesDir\hvExternDateiname}}% + \fbox{\expandafter\includegraphics\expandafter[\hv@extern@grfOptions,page=\next]{\hv@extern@fullPath}}% \hspace{5pt}}\hspace*{-5pt}% \endgroup \else \expandafter\@for\expandafter\next\expandafter:\expandafter=\hv@extern@pages\do{% - \expandafter\includegraphics\expandafter[\hv@extern@grfOptions,page=\next]% - {\hv@extern@ExamplesDir\hvExternDateiname}% + \expandafter\includegraphics\expandafter[\hv@extern@grfOptions,page=\next]{\hv@extern@fullPath}% \hspace{5pt}}\hspace*{-5pt}% \fi \ifx\hv@extern@caption\@empty\else\caption{\hv@extern@caption}\fi @@ -595,9 +649,9 @@ \hv@typeout{>>>> Floating environment}% \expandafter\figure\expandafter[!htb] \ifhv@extern@usefancyvrb - \expandafter\BodyVerbatim\expandafter[\hv@extern@lstOptions]{\hv@extern@ExamplesDir\hvExternDateiname.txt} + \expandafter\BodyVerbatim\expandafter[\hv@extern@lstOptions]{\hv@extern@fullPath.txt} \else - \expandafter\BodyListing\expandafter[\hv@extern@lstOptions]{\hv@extern@ExamplesDir\hvExternDateiname.txt} + \expandafter\BodyListing\expandafter[\hv@extern@lstOptions]{\hv@extern@fullPath.txt} \fi \ifx\hv@extern@caption\@empty\else\caption{\hv@extern@caption}\fi \ifx\hv@extern@label\@empty\else\label{\hv@extern@label}\fi @@ -605,9 +659,9 @@ \else \noindent \ifhv@extern@usefancyvrb - \expandafter\BodyVerbatim\expandafter[\hv@extern@lstOptions]{\hv@extern@ExamplesDir\hvExternDateiname.txt} + \expandafter\BodyVerbatim\expandafter[\hv@extern@lstOptions]{\hv@extern@fullPath.txt} \else - \expandafter\BodyListing\expandafter[\hv@extern@lstOptions]{\hv@extern@ExamplesDir\hvExternDateiname.txt} + \expandafter\BodyListing\expandafter[\hv@extern@lstOptions]{\hv@extern@fullPath.txt} \fi \fi \fi @@ -616,7 +670,6 @@ } \stepcounter{hv@example@counter}% - % %% \endinput |