7

I am honestly at my wits end with this, it has been exhausting trying to track down this bug but I am out of options. I am writing a document that requires extensive diagrams of go boards (a game) for which only the package psgo is really suitable. Since I also include png files, I've had to go to xelatex. Using auto-pst-pdf isn't an option, it just doesn't work, so xelatex is all I have.

When including the hyperref package, any numbered stones in the diagram move out of alignment and ruin the diagram. This is seen in the MWE below.

\documentclass{report}
\usepackage[]{pstricks}
\usepackage{psgo}
\usepackage[xetex]{hyperref}

\begin{document}
\begin{psgopartialboard*}{(8,6)(14,12)}
        \stone{black}{k}{10}
        \stone{black}{l}{11}
        \stone{black}{k}{11}
        \stone{black}{l}{10}
        \stone{white}{l}{8}
        \stone{white}{k}{9}
        \stone{white}{l}{9}
        \setcounter{gomove}{0}
        \move{j}{10}
        \move{j}{9}
        \move{j}{8}
        \move{j}{7}
\end{psgopartialboard*}
\end{document}

I've been using latexmk -xelatex main.tex --enable-write18 to compile this.

If you duplicate the psgo partial board shown, then it will show xdvipdfmx:warning: Object @gomove.1 already defined. as a warning when compiling, but it still works.

I have narrowed it down to an issue (I think) with the way hyperref interfaces with counters, as the counter is necessarily reset with each board. Any static stones, placed without a counter, work just fine. The frustrating thing is that it works perfectly fine through dvipdf but I can't use that for this project.

Is there a way to fix this without losing functionality? I'm in the process of rewriting psgo, is there some trick that I can use in there? Hyperref is required by a bunch of other stuff so I don't know what to do here.

Any help with this would be much, much appreciated, please!

2
  • Is there a difference, when you change the order of packages? (6 combinations are possible)
    – MS-SPO
    May 13 at 9:01
  • 1
    @MS-SPO No difference at all. And only three combinations, since pstricks needs to be loaded before psgo. Regardless, the problem persists.
    – Serenical
    May 13 at 9:05

1 Answer 1

8

psgo uses \refstepcounter (imho unnecessarly) and with hyperref this adds destinations which changes the spacing.

You can suppress the destinations with a boolean. In a current texlive you can use lualatex for the pstricks. It is much faster than xelatex but for some effects like opacity it requires the new pdfmanagement.

%for lualalatex:
\RequirePackage{pdfmanagement-testphase} %loading no longer needed in the next latex
\DocumentMetadata{} %required to activate the pdfmanagement
\documentclass{report}
\usepackage[]{pstricks}
\usepackage{psgo}
\usepackage{hyperref}

\makeatletter
\AddToHook{env/psgopartialboard*/before}{\@skiphyperreftrue} %\LinkTargetOff in the next hyperref
\makeatother
\begin{document}


\begin{psgopartialboard*}{(8,6)(14,12)}
        \stone{black}{k}{10}
        \stone{black}{l}{11}
        \stone{black}{k}{11}
        \stone{black}{l}{10}
        \stone{white}{l}{8}
        \stone{white}{k}{9}
        \stone{white}{l}{9}
        \setcounter{gomove}{0}
        \move{j}{10}
        \move{j}{9}
        \move{j}{8}
        \move{j}{7}
\end{psgopartialboard*}

\end{document}

enter image description here

1
  • Perfect! Thank you, this was driving me insane. And thanks for the tip about lualatex, that makes the compiling much much faster
    – Serenical
    May 13 at 11:24

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.