4

When I compile the following mwe with LaTeX, the clickable surface that leads me to the video is only around the blue image. When I compile with XeLaTeX, clicking anywhere on the page leads me to the video.

How can I make the XeLaTeX output behave like the LaTeX output?

\documentclass{article}

\usepackage{pstricks}
\usepackage{hyperref}  

\newcommand{\mypic}{
    \psset{unit=0.055}
    \begin{pspicture}(-5,-5)(5,5)
    \pscircle[linewidth=1.2, linecolor=blue](0,0){4.3}
    \rput{-90}(-1.4,2.5){\pspolygon[linearc=0.4, fillstyle=solid, fillcolor=blue, linecolor=blue](0,0)(5,0)(5;60)}
    \end{pspicture}
}

\begin{document}
Some text 
\begin{center}
\href{https://www.youtube.com/watch?v=mxI9ba6Rexc}{\mypic}
\end{center}
More text
\end{document}
  • Try \XeTeXLinkBox{\mypic} in the link. – Ulrike Fischer Mar 6 '18 at 10:28
  • @UlrikeFischer Thanks, unfortunately that doesn't have any effect. – Michael Mar 6 '18 at 10:33
  • 1
    Hm. Sorry I misread your question, I thought you had no click area and not too much. I don't know why this happens with pspictures. But you could redraw your picture with tikz (and there you need \XeTeXLinkBox). – Ulrike Fischer Mar 6 '18 at 10:42
  • It does indeed work with tikz. – Michael Mar 6 '18 at 12:53
  • tikz graphics are inserted already in the tex->xdv step. So there is no problem for xdvipdfmx to determine their sizes. pstricks is handled later. I asked on the texlive list if this can be corrected in xdvipdfmx. If not one could perhaps do something in hyperref. – Ulrike Fischer Mar 6 '18 at 14:19
3

Create it first as image. Needs only xelatex --shell-escape <file>:

\documentclass{article}
\usepackage{fontspec}
\usepackage{fancyvrb}
\usepackage{graphicx}
\usepackage{hyperref}

\begin{document}
\begin{VerbatimOut}{HR.tex}
\documentclass[pstricks]{standalone}
\begin{document}
\psset{unit=0.055cm}
\begin{pspicture}(-5,-5)(5,5)
\pscircle[linewidth=1.2, linecolor=blue](0,0){4.3}
\rput{-90}(-1.4,2.5){\pspolygon*[linearc=0.4,linecolor=blue](0,0)(5,0)(5;60)}
\end{pspicture}
\end{document}
\end{VerbatimOut}

\immediate\write18{xelatex HR}%% 

Some text 
\begin{center}
\href{https://www.youtube.com/watch?v=mxI9ba6Rexc}{\includegraphics{HR}}
\end{center}    
More text

\end{document}

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.