# Using a PS-specific package with XeTeX

I've a package I'd much like to use, MayaPS (for typesetting Mayan glyphs, with many features that make glyph composition easy), but the package comes only as a PostScript thing, and the authors have no intent of porting it for pdftex, xetex or the like. The standard process I seem to've cobbled together thus far is to just use pure latex to compile the individual blocks via LaTeX to dvi>ps>pdf and then include them one by one as PDF graphics, but surely there must be a better way.

The package itself is available for download from http://www.math.univ-toulouse.fr/~orevkov/mayaps.html and the tarball has an example file included.

A (near-)minimal working example, cobbled together from the documentation source, would be:

\documentclass{article}
\input epsf
\input mayaps
\mayaFont\codex=codex-d
\codex
\mayaFont\typeone=T1example
\mayaFont\thtwo=thompson2

\begin{document}
\mayaRGB{0 0 0.8}c \mayaRGB{0.9 0.6 0}{orange}
{\mayaUndefine{314/314}
\maya{451.452orange  026.(314/314)c  (570/014r.267.024)c}.
}
{\mayaSize{20pt}
$\quad L=$\maya{504.001}
$\quad U=$\maya{504:001}
$\quad R=$\maya{001.504}
$\quad D=$\maya{001:504}
$\quad S=$\hskip-8pt\maya{504}
}

\end{document}

The document it produces is looks like:

The programs invoked, in order, were latex>dvips>ps2pdf, on a MikTeX distribution.

• is the package available, can you post an example document? – David Carlisle Oct 23 '17 at 22:55
• @DavidCarlisle it's available (just edited the question with a link) and the example document provided with the package is too large to post but can be found in the download. – Darkgamma Oct 23 '17 at 22:59
• I have doubts that one could fully move this to xetex. But perhaps one could at least automate the creation of the graphics e.g. with the tikzexternalize library or auto-ps-pdf. Do you have an example of a simple document that creates one of your graphics? – Ulrike Fischer Oct 24 '17 at 9:27
• the cotrace program, if you use it without -c will make eps files rather than fragments of a font, so you could modify the makefont script to make eps of each, and to use eps2pdf to get pdf from there, but there is still a lot of raw postscript in the tex support. It may work to try to convert the existing dvips usage to work via pstricks rather than raw \special and then see if the pstricks support in xetex/xdvipdfmx is enough to cover this. – David Carlisle Oct 24 '17 at 10:57
• @UlrikeFischer I have included it in the question, and specified the exact path I took. I'm not sure how to automate any of this, or how to use pstricks as a replacement, as I'm not proficient enough, and I don't see a decent way of doing this short of rewriting the entire package on its own. – Darkgamma Oct 24 '17 at 13:10

This is not perfect, but could at least reduce the work a bit.

Create a stand alone document called mayaglyphs.tex, add the glyphs you want to use (at best in the correct size) and give them sensible labels:

\documentclass[multi]{standalone}

\input epsf
\input mayaps
\mayaFont\codex=codex-d
\codex
\mayaFont\typeone=T1example
\mayaFont\thtwo=thompson2

\standaloneenv{mayaglyph}

\begin{document}

\begin{mayaglyph}\label{A}
\mayaRGB{0 0 0.8}c \mayaRGB{0.9 0.6 0}{orange}
{\mayaUndefine{314/314}
\maya{451.452orange  026.(314/314)c  (570/014r.267.024)c}.
}
\end{mayaglyph}

\begin{mayaglyph}\label{B}
\maya{504.001}
\end{mayaglyph}

\begin{mayaglyph}\label{C}
\maya{001.504}
\end{mayaglyph}

\end{document}

Compile it with latex, dvips, pspdf. Move the pdf and the aux-file to the folder of your main document.

In your main document you can then do this:

\documentclass{article}
\usepackage{graphicx,xr,refcount}
\externaldocument[ma-]{mayaglyphs}
\newcommand\mayaglyph[1]{\includegraphics[page=\getpagerefnumber{ma-#1}]{mayaglyphs}}
\begin{document}
blblb \mayaglyph{A}
blbl  \mayaglyph{B}
blblb \mayaglyph{C}
\end{document}

• This is the workflow I seem to be forced into, if I want to avoid severely tampering with many of the package's contents. A properly comprehensive answer, with the best possible ratio of convenience to usability, I think. – Darkgamma Oct 24 '17 at 14:46