[Tex/LaTex] Use TeX Gyre fonts with latex+dvips+ps2pdf

dvipsfontsluatexpstrickstex-gyre-math

I want to use the TeX Gyre fonts (especially the Pagella and Pagella Math) with LaTeX+dvips+ps2pdf. In the future I want to use this for PSTricks but first I've to solve my font problems.

I use this code for LaTeX+dvips+ps2pdf

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{tgpagella}
\begin{document}
Test in Pagella

\[\sum_{k=1}^n k=\frac{n(n+1)}{2}\]
\end{document}

It produces a PDF file with the text in TeX Gyre Pagella but the mathematics in Computer Modern (see screenshot)

Screenshot produced by sourcefile

When changing the code to the following

\documentclass{article}
\usepackage{fontenc,unicode-math}
\setmainfont[Ligatures=TeX]{TeX Gyre Pagella}
\setmathfont[Ligatures=TeX]{TeX Gyre Pagella Math}
\begin{document}
Test in Pagella

\[\sum_{k=1}^n k=\frac{n(n+1)}{2}\]
\end{document}

and processing it with LuaLaTeX in DVI-mode works well. But running dvips afterwards produces the following errors

This is dvips(k) 5.992 Copyright 2012 Radical Eye Software (www.radicaleye.com)
' LuaTeX output 2013.04.01:1811' -> template-pstricks.ps
kpathsea: Invalid fontname `name:TeXGyrePagella:mode=node;script=latn;language=DFLT;+tlig;+trep;', contains ':'
dvips: Font name:TeXGyrePagella:mode=node;script=latn;language=DFLT;+tlig;+trep; not found; using cmr10

</usr/local/texlive/2012/texmf-dist/fonts/pk/ljfour/public/cm/dpi600/cmr10.pk>kpathsea: Invalid fontname `name:TeXGyrePagellaMath:mode=base;script=math;language=DFLT;+tlig;+trep;+ssty=1;', contains ':'

dvips: Font name:TeXGyrePagellaMath:mode=base;script=math;language=DFLT;+tlig;+trep;+ssty=1; not found; using cmr10

</usr/local/texlive/2012/texmf-dist/fonts/pk/ljfour/public/cm/dpi600/cmr10.pk>
dvips: ! invalid char 119899 from font name:TeXGyrePagellaMath:mode=base;script=math;language=DFLT;+tlig;+trep;+ssty=1;

I understand that dvips can't handle OpenType fonts, but how can I use the TeX Gyre Pagella and especially TeX Gyre Pagella Math together with PSTricks? Either LaTeX or LuaLaTeX solutions would be a great help.

Best Answer

I've now solved the problem with adding auto-pst-pdf to the code

\documentclass{article}
\usepackage{auto-pst-pdf}
\usepackage{fontenc,unicode-math}
\setmainfont[Ligatures=TeX]{TeX Gyre Pagella}
\setmathfont[Ligatures=TeX]{TeX Gyre Pagella Math}
\begin{document}
Test in Pagella

\[\sum_{k=1}^n k=\frac{n(n+1)}{2}\]
\end{document}

And compiling it with lualatex -shell-escape file.tex produces the following out put containing just TeX Gyre Pagella and TeX Gyre Pagella Math.

Screenshot of correct result

Great thanks to @egreg for providing this hint.

Improved due to @Ulrike Fischer's comment

There is obiously no way to solve the problem as I wanted, so I edited my code once again

\documentclass{article}
\usepackage{pstricks}
\usepackage{xltxtra}
\usepackage{xunicode}
\usepackage{fontenc}
\usepackage{unicode-math}
\setromanfont[Ligatures=TeX]{texgyrepagella-regular.otf}
\setmathfont[Ligatures=TeX]{texgyrepagella-math.otf}
\begin{document}
Test in Pagella

\[\sum_{k=1}^n k=\frac{n(n+1)}{2}\]

\begin{pspicture}(3,3)
  \psline{->}(1,1)(3,2)
  \psline{->}(1,1)(3,1)
  \rput(2,2){$x$}
\end{pspicture}
\end{document}

Processing it with xelatex file.tex produces the wanted PDF-file, containing the TeX Gyre Pagella and Pagella Math

Screenshot of processed code with xelatex

Thanks to @egreg and @Ulrike Fischer for their hints. More improvement is welcome, I think there's a lot to learn for me.