11

Is there the possibility to produce PSTricks graphics in LuaLaTeX?

I tried it, but i get

    ! Undefined control sequence.
    <recently read> \c@lor@to@ps 

    l.9 \psline(
        -5,2)(5,4)

With auto-pst-pdf I get a warning to use pdflatex.

So how can i use pstricks in LuaLaTeX?

Edit:@Marco Daniel

I asked where to pack packages for specified for lualatex, "normal packages", and pstricks packages: Maybe something like this:

    \RequirePackage{ifluatex}
    \documentclass{scrartcl}
    \usepackage{amsmath}

    \ifluatex
        \usepackage{fontspec}
        \defaultfontfeatures{Ligatures=TeX}
        \usepackage{lua-visual-debug}
    \else
         \usepackage{pstricks}
         \usepackage{pst-plot}
    \fi
         \usepackage{auto-pst-pdf}
    \begin{document}
    Here text...
    \end{document}

Niklas

7

You can't use PSTricks directly with LuaTeX as even in DVI mode you can't get the 'correct' output. As detailed on the PSTricks website, the way around this is to do a conditional compilation using auto-pst-pdf to generate the required graphical elements using pdfTeX in DVI mode:

\RequirePackage{ifluatex}
\documentclass{article}

\ifluatex
  \usepackage{fontspec}
  \setmainfont{TeX Gyre Pagella}
\else
  \usepackage{tgpagella}
  \usepackage{pstricks}
\fi
  \usepackage{auto-pst-pdf}

\begin{document}

\paragraph{Hier ein pstricks-Bild}
\begin{pspicture}(5,3)
  \pspolygon[fillstyle=vlines](0,0)(5,3)(3,0)
\end{pspicture}

\end{document} 

To see how this works, note that when auto-pst-pdf runs the auxiliary compiles, it always uses pdfTeX (in DVI mode). Thus the \ifluatex conditional will be false and any LuaTeX-specific stuff will be skipped. To get as close as possible appearance-wise, there is therefore a need to use a 'similar' font in the standard run route. Also note that anything to do with PSTricks goes in the 'else' branch: that includes additional PSTricks packages and anything else that needs DVI mode.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.