I have a document that contains many syntax trees that I've typeset using the pst-jtree package. I would greatly prefer to not convert all of them to another tree-making package's format (i.e., I do not want to use qtree, tikz-qtree, forest, etc., as that would involve redoing all of these trees).
However, I am running into an issue when I compile this document: so far, every time I have compiled it, there has always been some weird error in rendering the trees. For instance:
This tree was made with the following code:
\newcommand{\abar}[1]{\ensuremath{\overline{\text{#1}}}}
\jtree[scaleby=0.75 1]
! = {AP}
:{DP}(<vert>{\abar{D}}(<vert>{D}(<vert>{him))
{\abar{A}}(<vert>{A}(<vert>{honest})).
\endjtree
When I compile this tree on its own, it looks as expected (using a MWE with a different font):
\documentclass{article}
\usepackage{pstricks}
\usepackage{pst-jtree}
\newcommand{\abar}[1]{\ensuremath{\overline{\text{#1}}}}
\begin{document}
\jtree[scaleby=0.75 1]
! = {AP}
:{DP}(<vert>{\abar{D}}(<vert>{D}(<vert>{him))
{\abar{A}}(<vert>{A}(<vert>{honest})).
\endjtree
\end{document}
Something odd about this error is that it is not consistent when compiling the document with many trees. For instance, the tree above just happened to have the particular error shown above when I grabbed the screenshot. But if I try recompiling the document, it may well end up fine, while one of the other trees will have a similar sort of issue. Or it might have a different error. So far as I can tell, these random errors only seem to occur when the document contains a large number of trees (mine has 38).
Is there any way to solve this error? What is especially confusing is the random nature of it—different errors occur each time I try compiling, and it seems to be a matter of luck whether everything looks right. I've tried compiling using xelatex directly, as well as xelatex -no-pdf and then xdvipdfmx, but it doesn't seem to make a difference.
Another thing I've tried is saving each tree in a standalone document and compiling them separately, then including the PDFs. A problem with this, though, is that the bounding box doesn't seem to be calculated in the same way as it is when the tree is created directly in the actual document, and so the included images end up misaligned with example numbers, or movement arrows get cut off, etc.
The topic seems related to something posted about here, which suggests it may be a pstricks issue (though I couldn't replicate the error discussed there). Unfortunately, there wasn't any reliable solution offered at that link, and I share that poster's confusion about why a deterministic algorithm would display different random errors every time it is run.
Here's an attempt at a MWE, that just repeats drawing the same tree, using some code from here. Though, of course, the random nature of the error means that it may end up working as intended sometimes.
\documentclass{article}
\usepackage{pstricks}
\usepackage{pst-jtree}
\usepackage{amsmath}
\newcommand{\abar}[1]{\ensuremath{\overline{\text{#1}}}}
\usepackage{expl3}
\ExplSyntaxOn
\cs_new_eq:NN \Repeat \prg_replicate:nn
\ExplSyntaxOff
\begin{document}
\Repeat{38}{%
\jtree[scaleby=1.5 1]
! = {IP}
:{DP}(<vartri>{this tree}) {\abar{I}}
:{I}(<vert>{might}) {VP} "{\psset{scaleby=1}}
:{AdvP}(<vartri>{not}) {\abar{V}}
:{\abar{V}}(<vert>{V}(<vert>{work})) {AdvP}(<vartri>{correctly}).
\endjtree\
}
\end{document}
Edit: I've just confirmed that the MWE can indeed produce similar errors. For me, the following happened on page 10 (replications 31–33 of the tree):


