1

I am new to LateX. I am trying to use an example found here: Making TikZ nodes hyperlinkable to create a button with a hyperlink. I am wondering if anyone could tell me how to allow for rounded corners? Currently, the highlight upon mouseover is falling outside the button border at the corners in my MWE. Please see my editable MWE at OverLeaf: https://www.overleaf.com/8987688858pxfhygschhmk I am wondering if there is a way to make the highlight conform to the button border?

Here is another MWE:


\documentclass{article}

\usepackage{tikz, pgfplots} \pgfplotsset{compat=1.18} \usetikzlibrary{fit, shapes, automata, backgrounds, positioning, shadows, patterns, calc, arrows.meta, shapes.geometric, decorations.shapes, decorations.fractals, decorations.markings, decorations.pathmorphing}

\usepackage[hidelinks]{hyperref}

\tikzset{ test highlight/.style={draw=black, draw opacity=0.8}, hyperlink node/.style={ alias=sourcenode, append after command={ let \n0={\pgfkeysvalueof{/pgf/outer xsep}}, \n1={\pgfkeysvalueof{/pgf/outer ysep}}, \p1=([shift={(\n0, -\n1)}] sourcenode.north west), \p2=([shift={(-\n0, \n1)}] sourcenode.south east), \n2={\x2-\x1}, \n3={\y1-\y2} in node [inner sep=0pt, outer sep=0pt, anchor=north west, at=(\p1), test highlight] {\hyperlink{#1}{\XeTeXLinkBox{\phantom{\rule{\n2}{\n3}}}}} } } }

\begin{document}

\begin{tikzpicture}[overlay, button/.style={fit={(0cm,0cm) (6.3cm,1.5cm)}, fill=blue, draw=none, drop shadow, text=white, rounded corners=.75cm, inner sep=0pt, outer sep=0pt, label=center:\textcolor{white}{\huge\textsc{Read Me}}}] \node[button, hyperlink node=bottom] at (0cm,0cm) {}; \end{tikzpicture}

\vfill \hypertarget{bottom}{{Bottom of Page}} \end{document}

Steven
  • 317
  • 1
    Please copy (and reduce to its essential) the code posted in your link: I can't and won't access that site. – MS-SPO May 31 '23 at 07:13
  • 1
    Arbitrarily shaped links are, in principle, possible using PDF Quadpoints. But their support, beyond Acrobat Reader, is rare. For example see: https://tex.stackexchange.com/a/415756 or https://tex.stackexchange.com/a/417546 – AlexG May 31 '23 at 07:15
  • 1
    you should test examples that you copy here. Your code errors as test highlight is not defined. – Ulrike Fischer May 31 '23 at 08:18
  • @Ulrike Fischer Thank you! It should be working now. I tested the above code on OverLeaf.com at this editable link: https://www.overleaf.com/8987688858pxfhygschhmk – Steven May 31 '23 at 18:56
  • If there is a way to just suppress the down appearance of the button, I could live with that. Just not sure how I would go about doing that? – Steven Jun 04 '23 at 06:11

0 Answers0