diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/auto-pst-pdf-lua |
Initial commit
Diffstat (limited to 'macros/latex/contrib/auto-pst-pdf-lua')
-rw-r--r-- | macros/latex/contrib/auto-pst-pdf-lua/Changes | 6 | ||||
-rw-r--r-- | macros/latex/contrib/auto-pst-pdf-lua/README | 18 | ||||
-rw-r--r-- | macros/latex/contrib/auto-pst-pdf-lua/doc/auto-pst-pdf-lua-doc.pdf | bin | 0 -> 69340 bytes | |||
-rw-r--r-- | macros/latex/contrib/auto-pst-pdf-lua/doc/auto-pst-pdf-lua-doc.tex | 92 | ||||
-rw-r--r-- | macros/latex/contrib/auto-pst-pdf-lua/latex/auto-pst-pdf-lua.sty | 189 |
5 files changed, 305 insertions, 0 deletions
diff --git a/macros/latex/contrib/auto-pst-pdf-lua/Changes b/macros/latex/contrib/auto-pst-pdf-lua/Changes new file mode 100644 index 0000000000..079913f77e --- /dev/null +++ b/macros/latex/contrib/auto-pst-pdf-lua/Changes @@ -0,0 +1,6 @@ +auto-pst-pdf-lua.sty ---------------- + +v 0.03 2018-12-08 fix bug with auto-pst-lua, which should be auto-pst-pdf +v 0.02 2018-03-19 added test for luatex run +v 0.01 2018-03-17 first CTAN version + diff --git a/macros/latex/contrib/auto-pst-pdf-lua/README b/macros/latex/contrib/auto-pst-pdf-lua/README new file mode 100644 index 0000000000..f0888346e1 --- /dev/null +++ b/macros/latex/contrib/auto-pst-pdf-lua/README @@ -0,0 +1,18 @@ +This package is a slightly modified version of auto-pst-pdf +from Will Robertson which itself is a wrapper for pst-pdf +from Rolf Niepraschk. + +auto.pst-pdf-lua allows the use of lualatex +together with PostScript related code, eg. PSTricks + + +%% It 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. + + +Herbert Voß, hvoss@tug.org
\ No newline at end of file diff --git a/macros/latex/contrib/auto-pst-pdf-lua/doc/auto-pst-pdf-lua-doc.pdf b/macros/latex/contrib/auto-pst-pdf-lua/doc/auto-pst-pdf-lua-doc.pdf Binary files differnew file mode 100644 index 0000000000..42a34363b3 --- /dev/null +++ b/macros/latex/contrib/auto-pst-pdf-lua/doc/auto-pst-pdf-lua-doc.pdf diff --git a/macros/latex/contrib/auto-pst-pdf-lua/doc/auto-pst-pdf-lua-doc.tex b/macros/latex/contrib/auto-pst-pdf-lua/doc/auto-pst-pdf-lua-doc.tex new file mode 100644 index 0000000000..ccc6983c15 --- /dev/null +++ b/macros/latex/contrib/auto-pst-pdf-lua/doc/auto-pst-pdf-lua-doc.tex @@ -0,0 +1,92 @@ +\listfiles +\documentclass[english]{article} + +\usepackage{pst-poker} +\usepackage[cleanup={}]{auto-pst-pdf-lua} +\ifpdf + \usepackage{fontspec} + \usepackage{dejavu-otf} +\else + \usepackage[T1]{fontenc} + \usepackage[utf8]{inputenc} + \usepackage{dejavu} +\fi + +\usepackage{babel} +\usepackage[a4paper,tmargin=1cm,bmargin=1.5cm,includeheadfoot]{geometry} +\usepackage{listings} +\title{\texttt{auto-pst-pdf-lua}, v. 0.03\\ using Lua\LaTeX\ with PSTricks} +\author{Herbert Voß} +\begin{document} +\maketitle + +The package is based on \texttt{auto-pst-pdf} and uses for the \texttt{latex} run the +program \texttt{dvilualatex}. The package can have all optional arguments which are +possible for \texttt{auto-pst-pdf}. + + +\section{The example code} + +\lstset{basicstyle=\ttfamily\small,language={[LaTeX]TeX},frame=lrtb} +\begin{lstlisting} +\documentclass{article} +\usepackage{pst-poker} +\usepackage{auto-pst-pdf-lua} +\ifpdf + \usepackage{fontspec} + \usepackage{dejavu-otf} +\else + \usepackage[T1]{fontenc} + \usepackage[utf8]{inputenc} + \usepackage{dejavu} +\fi + +\begin{document} + +An example for using Luacode: +$\pi^{\pi}=\directlua{tex.print(math.pi^math.pi)}$ + +An example for PostScript code: + +\bigskip +\begin{postscript} +\As~\Ad~\Ac~\Ah~\crdAs~\crdAd~\crdAc~\crdAh +\end{postscript} +\end{document} +\end{lstlisting} + +\section{The output} + +And here comes the output when running with \verb|lualatex --shell-escape <file>|: + + +An example for using Luacode: +$\pi^{\pi}=\directlua{tex.print(math.pi^math.pi)}$ + +An example for PostScript code: + +\bigskip +\begin{postscript} +\As~\Ad~\Ac~\Ah~\crdAs~\crdAd~\crdAc~\crdAh +\end{postscript} + + +\section{Caveats} + +When running \texttt{dvilualatex} the package \texttt{fontspec} cannot be active. If you +need it, then just just the \texttt{\textbackslash ifpdf} switch: + +\begin{verbatim} +\ifpdf + \usepackage{fontspec}%% for the lualatex run(s) + \usepackage{dejavu-otf} +\else + \usepackage[T1]{fontenc}% for the dvilualatex run + \usepackage[utf8]{inputenc} + \usepackage{dejavu} +\fi +\end{verbatim} + + + +\end{document}
\ No newline at end of file diff --git a/macros/latex/contrib/auto-pst-pdf-lua/latex/auto-pst-pdf-lua.sty b/macros/latex/contrib/auto-pst-pdf-lua/latex/auto-pst-pdf-lua.sty new file mode 100644 index 0000000000..e75e2f76d1 --- /dev/null +++ b/macros/latex/contrib/auto-pst-pdf-lua/latex/auto-pst-pdf-lua.sty @@ -0,0 +1,189 @@ +%% +%% This is file `auto-pst-pdf-lua.sty', a modified version of +%% auto-pst-pdf from Will Robertson +%% +%% Copyright (C) 2018 Herbert Voss +%% +%% It 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. +%% +%% +\ProvidesPackage{auto-pst-pdf-lua}[2018/12/09 v0.03 using auto-pst-pdf for LuaLaTeX] +\RequirePackage{ifpdf,xkeyval,ifplatform,ifluatex} +\newif\if@app@off@ +\newif\if@app@crop@ +\newcounter{app@runs} +\def\app@suffix{autopp} +\edef\app@jobname{\jobname-\app@suffix} +\edef\app@pics{\jobname-pics.pdf} +\DeclareOptionX{off}[]{\@app@off@true} +\define@choicekey{auto-pst-pdf-lua.sty}{crop}[\@tempa\@tempb]{on,off}{% + \ifcase\@tempb\relax + \@app@crop@true + \or + \@app@crop@false + \fi} +\DeclareOptionX{on}[]{\@app@off@false} +\DeclareOptionX{ext}{\def\app@ext{#1}} +\DeclareOptionX{latex}{% + \def\app@latex@opts{% + \ifwindows + -disable-write18 + \else + -no-shell-escape + \fi + -jobname="\app@jobname" + -interaction=batchmode + #1}} +\DeclareOptionX{dvips}{\def\app@dvips@opts{#1}} +\DeclareOptionX{pspdf}{\def\app@pspdf@opts{#1}} +\DeclareOptionX{pdfcrop}{\def\app@pdfcrop@opts{#1}} + +\DeclareOptionX{cleanup}{% + \let\app@rm@files\@empty + \@for\@ii:=#1\do{% + \edef\app@rm@files{\app@rm@files,\app@jobname.\@ii}}} + +\DeclareOptionX{runs}{% + \setcounter{app@runs}{#1}% support calc + \ifnum\c@app@runs > \z@ + \else + \app@PackageWarning{The number of runs must be at least one.}% + \c@app@runs\@ne + \fi} + +\DeclareOptionX*{\PassOptionsToPackage{\CurrentOption}{auto-pst-pdf}} + +\ExecuteOptionsX{% + ext=tex, + crop=on, + latex={}, + dvips={-Ppdf}, + pdfcrop={}, + cleanup={log,aux,dvi,ps,pdf}, + runs=1 +} +\ifluatex\else + \PackageWarning{auto-pst-pdf-lua}% + {^^J No LuaTeX running! + ^^J Package auto-pst-pdf-lua falls back to auto-pst-pdf!}% +\fi +\ifwindows + \ExecuteOptionsX{pspdf={}} +\else + \ExecuteOptionsX{pspdf={-dAutoRotatePages=/None}} +\fi +\ProcessOptionsX +\def\app@exe{\immediate\write18} +\def\app@nl{^^J\space\space\space\space} +\newcommand\app@PackageError[2]{% + \PackageError{auto-pst-pdf-lua}{\app@nl #1^^J}{#2}} +\newcommand\app@PackageWarning[1]{% + \PackageWarning{auto-pst-pdf-lua}{\app@nl #1^^JThis warning occured}} +\newcommand\app@PackageInfo[1]{\PackageInfo{auto-pst-pdf-lua}{#1}} +\newcommand\OnlyIfFileExists[2]{\IfFileExists{#1}{#2}{}} +\newcommand\NotIfFileExists[2]{\IfFileExists{#1}{}{#2}} +\def\app@convert#1#2#3{% + \OnlyIfFileExists{#2}{% + \app@exe{\csname app@cmd@#1\endcsname{#2}{#3}}% + \NotIfFileExists{#3}{\app@PackageWarning{Creation of #3 failed.}}}} +\def\app@compile{% + \app@cleanup + \app@remove@container + \loop\ifnum\c@app@runs > \@ne + \app@convert{extralatex}{\jobname.\app@ext}{\app@jobname.dvi}% + \advance\c@app@runs\m@ne + \repeat + \app@convert{latex}{\jobname.\app@ext}{\app@jobname.dvi}% + \app@convert{dvips}{\app@jobname.dvi}{\app@jobname.ps}% + \if@app@crop@ + \app@convert{pstopdf}{\app@jobname.ps}{\app@jobname.pdf}% + \app@convert{pdfcrop}{\app@jobname.pdf}{\app@pics}% + \else + \app@convert{pstopdf}{\app@jobname.ps}{\app@pics}% + \fi + \IfFileExists{\app@pics} + {\app@cleanup} + {\app@PackageWarning{Could not create \app@pics. + Auxiliary files not deleted.}}} +\edef\app@rm{\ifwindows del \else rm -- \fi} +\newcommand\app@try@rm[1]{% + \@for\@tempa:=#1\do{% + \OnlyIfFileExists{\@tempa}{\app@exe{\app@rm "\@tempa"}}}} +\def\app@remove@container{\app@try@rm{\app@pics}} +\def\app@cleanup{\app@try@rm{\app@rm@files}} +\ifluatex + \def\app@cmd@latex#1#2{dvilualatex \app@latex@opts\space + "\unexpanded{\let\APPmakepictures\empty\input} #1"} + \def\app@cmd@extralatex#1#2{dvilualatex \app@latex@opts\space + "\unexpanded{\let\APPmakepictures\undefined\input} #1"} +\else + \def\app@cmd@latex#1#2{latex \app@latex@opts\space + "\unexpanded{\let\APPmakepictures\empty\input} #1"} + \def\app@cmd@extralatex#1#2{latex \app@latex@opts\space + "\unexpanded{\let\APPmakepictures\undefined\input} #1"} +\fi +\def\app@cmd@dvips#1#2{dvips \app@dvips@opts\space -o "#2" "#1"} +\def\app@cmd@pstopdf#1#2{ps2pdf \app@pspdf@opts\space "#1" "#2"} +\def\app@cmd@pdfcrop#1#2{pdfcrop \app@pdfcrop@opts\space "#1" "#2"} +\ifpdf + \if@app@off@\else + \ifshellescape + \app@exe{echo " "} + \app@exe{echo "-------------------------------------------------"} + \app@exe{echo "auto-pst-pdf-lua: Auxiliary LaTeX compilation"} + \app@exe{echo "-------------------------------------------------"} + \app@compile + \app@exe{echo "-------------------------------------------------"} + \app@exe{echo "auto-pst-pdf-lua: End auxiliary LaTeX compilation"} + \app@exe{echo "-------------------------------------------------"} + \else + \app@PackageError{% + "shell escape" (or "write18") is not enabled:\app@nl + auto-pst-pdf-lua will not work!} + {You need to run LaTeX with the equivalent of + "lualatex -shell-escape"\app@nl + Or turn off auto-pst-pdf-lua.}% + \fi + \fi + \if@app@crop@ + \PassOptionsToPackage{notightpage}{pst-pdf} + \fi +\else + \ifx\APPmakepictures\@undefined + \PassOptionsToPackage{inactive}{pst-pdf} + \else + \if@app@crop@ + \PassOptionsToPackage{notightpage}{pst-pdf} + \fi + \fi +\fi +\RequirePackage{pst-pdf} +\let\app@ig\includegraphics +\newcommand\matlabfig[2][]{% + \begin{postscript} + \renewcommand\resizebox[3]{##3}% + \renewcommand\includegraphics[2][]{\app@ig[#1]{##2}}% + \input{#2}% + \end{postscript}} +\newcommand\mathfig[2][]{% + \begin{postscript} + \input{#2-psfrag}% + \includegraphics[#1]{#2-psfrag}% + \end{postscript}} +\newcommand\psfragfig[2][]{% + \@ifnextchar[ + {\app@psfragfig[#1]{#2}} + {\app@psfragfig[#1]{#2}[]}} +\def\app@psfragfig[#1]#2[#3]{% + \begin{postscript} + \InputIfFileExists{#2-psfrag}{}{}% + #3 + \includegraphics[#1]{#2}% + \end{postscript}} +\InputIfFileExists{\jobname-psfrag}{}{} |