Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

share|improve this question
1  
    
Thanks! That works now. All Packages for lualatex must be put into after ifluatex right? –  Niklas Feb 24 '13 at 15:19
    
What do you mean with "after ifluatex"? To specify your question you should provide a minimal working example (MWE). –  Marco Daniel Feb 24 '13 at 15:57
    
Packages like pstricks or auto-pst-pdf are independent from the test ifluatex. Normally the test is used for fontspec or polyglossia. –  Marco Daniel Feb 24 '13 at 17:36
    
Did you get it to work? If so, how? You can answer your own question, then... –  nutty about natty Jul 3 '13 at 16:14
add comment

1 Answer

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-pdt 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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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