\listfiles
\documentclass[english]{article}

\usepackage{pst-poker}
\usepackage[cleanup={},pspdf={-dALLOWPSTRANSPARENCY -dNOSAFER}]{auto-pst-pdf-lua}
\ifpdf
  \usepackage{fontspec}
  \usepackage{dejavu-otf}
\else
  \usepackage[T1]{fontenc}
  \usepackage{dejavu}
\fi

\usepackage{babel}
\usepackage[a4paper,tmargin=1cm,bmargin=1.5cm,includeheadfoot]{geometry}
\usepackage{listings}
\title{\texttt{auto-pst-pdf-lua}, v. 0.03a\\ 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}. For all PSTricks examples the package should be
loaded with the following optional arguments:

\lstset{basicstyle=\ttfamily\small,language={[LaTeX]TeX},frame=lrtb}
\begin{lstlisting}
\usepackage[cleanup={},pspdf={-dALLOWPSTRANSPARENCY -dNOSAFER}]{auto-pst-pdf-lua}
\end{lstlisting}

The possible options are preset to

\begin{lstlisting}
\ExecuteOptionsX{%
    ext=tex,
    crop=on,
    latex={},
    dvips={-Ppdf},
    pdfcrop={},
    cleanup={log,aux,dvi,ps,pdf},
    runs=1,
}
\end{lstlisting}



\section{The example code}

\begin{lstlisting}
\documentclass{article}
\usepackage{pst-poker}
\usepackage{auto-pst-pdf-lua}
\ifpdf
  \usepackage{fontspec}
  \usepackage{dejavu-otf}
\else
  \usepackage[T1]{fontenc}
  \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{dejavu}
\fi
\end{verbatim}



\end{document}