Hyperlink boxes not sized correctly in tikzpicture
I'm having very weird behavior with hyperlinks in a tikzpicture. Here's a code snippet:
documentclass{article}
usepackage{tikz}
usepackage[linktocpage=true]{hyperref}
usepackage[capitalize]{cleveref}
usetikzlibrary{arrows}
tikzstyle{rect} = [rectangle, rounded corners, minimum width=8em,%
minimum height=3em, text width=8em, text centered, draw=black]
tikzstyle{rect2} = [rectangle, rounded corners, minimum width=5.5em,%
minimum height=3em, text width=5.5em, text centered, draw=black]
tikzstyle{anch} = [inner sep=0em, outer sep=0em]
tikzstyle{arrow} = [thick,->,>=stealth]
% Create a spacer to make sure box around link isn't too close to text.
newcommand{spacerrule}[3][0 em]{textcolor{white}{rule[#2]{#1}{#3}}}
begin{document}
% So the hyperlinks link to something.
label{signedranktest}
label{ranksumtest}
% Verify that the commands work outside of tikzpicture
hyperref[signedranktest]{parbox{9em}{centervspace{-1 em}spacerrule{.1 em}{1 em}%
textbf{Wilcoxon Signed Rank Test}spacerrule{-.4 em}{1 em}}}
vspace{1 em}
hyperref[ranksumtest]{parbox{9em}{centervspace{-1 em}spacerrule{.1 em}{1 em}%
textbf{Wilcoxon Rank Sum Test}spacerrule{-.4 em}{1 em}}}
begin{center}
begin{tikzpicture}[node distance=3 em]
node (samp2) [rect] {2 groups};
node (lev2b) [anch, below of=samp2]{};
node (paired1) [rect, below left of=lev2b, xshift=-3 em, yshift=-1.5 em]{Paired/matched samples};
node (indep1) [rect, below right of=lev2b, xshift=3 em, yshift=-1.5 em]{Independent samples};
node (pairtest) [below of=paired1, yshift=-2 em, text width=9em, text centered]%
{hyperref[signedranktest]{parbox{9em}{centervspace{-1 em}spacerrule{.1 em}{1 em}%
textbf{Wilcoxon Signed Rank Test}spacerrule{-.4 em}{1 em}}}};
node (indtest) [below of=indep1, yshift=-2 em, text width=9em, text centered]%
{hyperref[ranksumtest]{parbox{9em}{centervspace{-1 em}spacerrule{.1 em}{1 em}%
textbf{Wilcoxon Rank Sum Test}spacerrule{-.4 em}{1 em}}}};
draw [arrow] (samp2) -- (lev2b);
draw [arrow] (lev2b) -| (paired1);
draw [arrow] (lev2b) -| (indep1);
draw [arrow] (paired1) -- (pairtest);
draw [arrow] (indep1) -- (indtest);
end{tikzpicture}
end{center}
end{document}
When I run this, the box around "Wilcoxon Signed Rank Test" is mis-sized, with the program thinking it is only one line high instead of two. The really weird thing is that if you comment out the line starting with "node (pairtest)", then the "Wilcoxon Rank Sum Test" box is mis-sized in the same way as the other one used to be; and if you switch the order of the lines starting with "node (pairtest)" and "node (indtest)", then the WRST box is mis-sized and the WSRT box is correct! So it seems it's always the first one it encounters that is mis-sized.
Any thoughts?
tikz-pgf hyperref
add a comment |
I'm having very weird behavior with hyperlinks in a tikzpicture. Here's a code snippet:
documentclass{article}
usepackage{tikz}
usepackage[linktocpage=true]{hyperref}
usepackage[capitalize]{cleveref}
usetikzlibrary{arrows}
tikzstyle{rect} = [rectangle, rounded corners, minimum width=8em,%
minimum height=3em, text width=8em, text centered, draw=black]
tikzstyle{rect2} = [rectangle, rounded corners, minimum width=5.5em,%
minimum height=3em, text width=5.5em, text centered, draw=black]
tikzstyle{anch} = [inner sep=0em, outer sep=0em]
tikzstyle{arrow} = [thick,->,>=stealth]
% Create a spacer to make sure box around link isn't too close to text.
newcommand{spacerrule}[3][0 em]{textcolor{white}{rule[#2]{#1}{#3}}}
begin{document}
% So the hyperlinks link to something.
label{signedranktest}
label{ranksumtest}
% Verify that the commands work outside of tikzpicture
hyperref[signedranktest]{parbox{9em}{centervspace{-1 em}spacerrule{.1 em}{1 em}%
textbf{Wilcoxon Signed Rank Test}spacerrule{-.4 em}{1 em}}}
vspace{1 em}
hyperref[ranksumtest]{parbox{9em}{centervspace{-1 em}spacerrule{.1 em}{1 em}%
textbf{Wilcoxon Rank Sum Test}spacerrule{-.4 em}{1 em}}}
begin{center}
begin{tikzpicture}[node distance=3 em]
node (samp2) [rect] {2 groups};
node (lev2b) [anch, below of=samp2]{};
node (paired1) [rect, below left of=lev2b, xshift=-3 em, yshift=-1.5 em]{Paired/matched samples};
node (indep1) [rect, below right of=lev2b, xshift=3 em, yshift=-1.5 em]{Independent samples};
node (pairtest) [below of=paired1, yshift=-2 em, text width=9em, text centered]%
{hyperref[signedranktest]{parbox{9em}{centervspace{-1 em}spacerrule{.1 em}{1 em}%
textbf{Wilcoxon Signed Rank Test}spacerrule{-.4 em}{1 em}}}};
node (indtest) [below of=indep1, yshift=-2 em, text width=9em, text centered]%
{hyperref[ranksumtest]{parbox{9em}{centervspace{-1 em}spacerrule{.1 em}{1 em}%
textbf{Wilcoxon Rank Sum Test}spacerrule{-.4 em}{1 em}}}};
draw [arrow] (samp2) -- (lev2b);
draw [arrow] (lev2b) -| (paired1);
draw [arrow] (lev2b) -| (indep1);
draw [arrow] (paired1) -- (pairtest);
draw [arrow] (indep1) -- (indtest);
end{tikzpicture}
end{center}
end{document}
When I run this, the box around "Wilcoxon Signed Rank Test" is mis-sized, with the program thinking it is only one line high instead of two. The really weird thing is that if you comment out the line starting with "node (pairtest)", then the "Wilcoxon Rank Sum Test" box is mis-sized in the same way as the other one used to be; and if you switch the order of the lines starting with "node (pairtest)" and "node (indtest)", then the WRST box is mis-sized and the WSRT box is correct! So it seems it's always the first one it encounters that is mis-sized.
Any thoughts?
tikz-pgf hyperref
2
Try removingbegin{center}
andend{center}
. Then putcentering
immediately afterbegin{tikzpicture}[node distance=3 em]
. Does that fix it for you?
– whatisit
Jan 4 at 6:39
add a comment |
I'm having very weird behavior with hyperlinks in a tikzpicture. Here's a code snippet:
documentclass{article}
usepackage{tikz}
usepackage[linktocpage=true]{hyperref}
usepackage[capitalize]{cleveref}
usetikzlibrary{arrows}
tikzstyle{rect} = [rectangle, rounded corners, minimum width=8em,%
minimum height=3em, text width=8em, text centered, draw=black]
tikzstyle{rect2} = [rectangle, rounded corners, minimum width=5.5em,%
minimum height=3em, text width=5.5em, text centered, draw=black]
tikzstyle{anch} = [inner sep=0em, outer sep=0em]
tikzstyle{arrow} = [thick,->,>=stealth]
% Create a spacer to make sure box around link isn't too close to text.
newcommand{spacerrule}[3][0 em]{textcolor{white}{rule[#2]{#1}{#3}}}
begin{document}
% So the hyperlinks link to something.
label{signedranktest}
label{ranksumtest}
% Verify that the commands work outside of tikzpicture
hyperref[signedranktest]{parbox{9em}{centervspace{-1 em}spacerrule{.1 em}{1 em}%
textbf{Wilcoxon Signed Rank Test}spacerrule{-.4 em}{1 em}}}
vspace{1 em}
hyperref[ranksumtest]{parbox{9em}{centervspace{-1 em}spacerrule{.1 em}{1 em}%
textbf{Wilcoxon Rank Sum Test}spacerrule{-.4 em}{1 em}}}
begin{center}
begin{tikzpicture}[node distance=3 em]
node (samp2) [rect] {2 groups};
node (lev2b) [anch, below of=samp2]{};
node (paired1) [rect, below left of=lev2b, xshift=-3 em, yshift=-1.5 em]{Paired/matched samples};
node (indep1) [rect, below right of=lev2b, xshift=3 em, yshift=-1.5 em]{Independent samples};
node (pairtest) [below of=paired1, yshift=-2 em, text width=9em, text centered]%
{hyperref[signedranktest]{parbox{9em}{centervspace{-1 em}spacerrule{.1 em}{1 em}%
textbf{Wilcoxon Signed Rank Test}spacerrule{-.4 em}{1 em}}}};
node (indtest) [below of=indep1, yshift=-2 em, text width=9em, text centered]%
{hyperref[ranksumtest]{parbox{9em}{centervspace{-1 em}spacerrule{.1 em}{1 em}%
textbf{Wilcoxon Rank Sum Test}spacerrule{-.4 em}{1 em}}}};
draw [arrow] (samp2) -- (lev2b);
draw [arrow] (lev2b) -| (paired1);
draw [arrow] (lev2b) -| (indep1);
draw [arrow] (paired1) -- (pairtest);
draw [arrow] (indep1) -- (indtest);
end{tikzpicture}
end{center}
end{document}
When I run this, the box around "Wilcoxon Signed Rank Test" is mis-sized, with the program thinking it is only one line high instead of two. The really weird thing is that if you comment out the line starting with "node (pairtest)", then the "Wilcoxon Rank Sum Test" box is mis-sized in the same way as the other one used to be; and if you switch the order of the lines starting with "node (pairtest)" and "node (indtest)", then the WRST box is mis-sized and the WSRT box is correct! So it seems it's always the first one it encounters that is mis-sized.
Any thoughts?
tikz-pgf hyperref
I'm having very weird behavior with hyperlinks in a tikzpicture. Here's a code snippet:
documentclass{article}
usepackage{tikz}
usepackage[linktocpage=true]{hyperref}
usepackage[capitalize]{cleveref}
usetikzlibrary{arrows}
tikzstyle{rect} = [rectangle, rounded corners, minimum width=8em,%
minimum height=3em, text width=8em, text centered, draw=black]
tikzstyle{rect2} = [rectangle, rounded corners, minimum width=5.5em,%
minimum height=3em, text width=5.5em, text centered, draw=black]
tikzstyle{anch} = [inner sep=0em, outer sep=0em]
tikzstyle{arrow} = [thick,->,>=stealth]
% Create a spacer to make sure box around link isn't too close to text.
newcommand{spacerrule}[3][0 em]{textcolor{white}{rule[#2]{#1}{#3}}}
begin{document}
% So the hyperlinks link to something.
label{signedranktest}
label{ranksumtest}
% Verify that the commands work outside of tikzpicture
hyperref[signedranktest]{parbox{9em}{centervspace{-1 em}spacerrule{.1 em}{1 em}%
textbf{Wilcoxon Signed Rank Test}spacerrule{-.4 em}{1 em}}}
vspace{1 em}
hyperref[ranksumtest]{parbox{9em}{centervspace{-1 em}spacerrule{.1 em}{1 em}%
textbf{Wilcoxon Rank Sum Test}spacerrule{-.4 em}{1 em}}}
begin{center}
begin{tikzpicture}[node distance=3 em]
node (samp2) [rect] {2 groups};
node (lev2b) [anch, below of=samp2]{};
node (paired1) [rect, below left of=lev2b, xshift=-3 em, yshift=-1.5 em]{Paired/matched samples};
node (indep1) [rect, below right of=lev2b, xshift=3 em, yshift=-1.5 em]{Independent samples};
node (pairtest) [below of=paired1, yshift=-2 em, text width=9em, text centered]%
{hyperref[signedranktest]{parbox{9em}{centervspace{-1 em}spacerrule{.1 em}{1 em}%
textbf{Wilcoxon Signed Rank Test}spacerrule{-.4 em}{1 em}}}};
node (indtest) [below of=indep1, yshift=-2 em, text width=9em, text centered]%
{hyperref[ranksumtest]{parbox{9em}{centervspace{-1 em}spacerrule{.1 em}{1 em}%
textbf{Wilcoxon Rank Sum Test}spacerrule{-.4 em}{1 em}}}};
draw [arrow] (samp2) -- (lev2b);
draw [arrow] (lev2b) -| (paired1);
draw [arrow] (lev2b) -| (indep1);
draw [arrow] (paired1) -- (pairtest);
draw [arrow] (indep1) -- (indtest);
end{tikzpicture}
end{center}
end{document}
When I run this, the box around "Wilcoxon Signed Rank Test" is mis-sized, with the program thinking it is only one line high instead of two. The really weird thing is that if you comment out the line starting with "node (pairtest)", then the "Wilcoxon Rank Sum Test" box is mis-sized in the same way as the other one used to be; and if you switch the order of the lines starting with "node (pairtest)" and "node (indtest)", then the WRST box is mis-sized and the WSRT box is correct! So it seems it's always the first one it encounters that is mis-sized.
Any thoughts?
tikz-pgf hyperref
tikz-pgf hyperref
asked Jan 4 at 6:26
bad_platypusbad_platypus
61
61
2
Try removingbegin{center}
andend{center}
. Then putcentering
immediately afterbegin{tikzpicture}[node distance=3 em]
. Does that fix it for you?
– whatisit
Jan 4 at 6:39
add a comment |
2
Try removingbegin{center}
andend{center}
. Then putcentering
immediately afterbegin{tikzpicture}[node distance=3 em]
. Does that fix it for you?
– whatisit
Jan 4 at 6:39
2
2
Try removing
begin{center}
and end{center}
. Then put centering
immediately after begin{tikzpicture}[node distance=3 em]
. Does that fix it for you?– whatisit
Jan 4 at 6:39
Try removing
begin{center}
and end{center}
. Then put centering
immediately after begin{tikzpicture}[node distance=3 em]
. Does that fix it for you?– whatisit
Jan 4 at 6:39
add a comment |
2 Answers
2
active
oldest
votes
Your code dates from the first versions of TikZ and is now deprecated.
The extra boxes you've added everywhere are disrupting TikZ's normal work. The easiest way here is to do everything with the new 3.0.1a's TikZ version and without having to go through additional commands that complicate his work.
So, I deleted theses boxes and updated the code.
Thus, your personal macro spacerrule
is useless and to solve all your problems, just load the positioning
library (read section 17.5.3 from page 229 of the manual 3.0.1a).
The tikzstyle
is depreciated in favor of the tikzset
.
For arrows, the library is now called arrows.meta
documentclass{article}
usepackage{tikz}
usepackage[linktocpage=true]{hyperref}
usepackage[capitalize]{cleveref}
usetikzlibrary{arrows}
usetikzlibrary{arrows.meta}
usetikzlibrary{positioning}
tikzset{rect/.style={rectangle, rounded corners, minimum width=8em,%
minimum height=3em, text width=8em, text centered, draw=black},
rect2/.style={rectangle, rounded corners, minimum width=5.5em,%
minimum height=3em, text width=5.5em, text centered, draw=black},
anch/.style={inner sep=0em, outer sep=0em}
}
% Create a spacer to make sure box around link isn't too close to text.
%newcommand{spacerrule}[3][0 em]{textcolor{white}{rule[#2]{#1}{#3}}}
begin{document}
% So the hyperlinks link to something.
label{signedranktest}
label{ranksumtest}
% Verify that the commands work outside of tikzpicture
hyperref[signedranktest]{parbox{9em}{centervspace{-1 em}%
textbf{Wilcoxon Signed Rank Test}}}
vspace{1 em}
hyperref[ranksumtest]{parbox{9em}{centervspace{-1 em}%
textbf{Wilcoxon Rank Sum Test}}}
begin{center}
begin{tikzpicture}[node distance=3 em,>={Stealth}]
node (samp2) [rect] {2 groups};
node (lev2b) [anch, below of=samp2]{};
node (paired1) [rect, below left= of lev2b]{Paired/matched samples};
node (indep1) [rect, below right= of lev2b]{Independent samples};
node (pairtest) [below = of paired1, text width=9em, text centered]%
{hyperref[signedranktest]{textbf{Wilcoxon Signed Rank Test}}};
node (indtest) [below = of indep1, text width=9em, text centered]%
{hyperref[ranksumtest]{parbox{9em}{textbf{Wilcoxon Rank Sum Test}}}};
draw [->] (samp2) -- (lev2b);
draw [->] (lev2b) -| (paired1);
draw [->] (lev2b) -| (indep1);
draw [->] (paired1) -- (pairtest);
draw [->] (indep1) -- (indtest);
end{tikzpicture}
end{center}
end{document}
A deprecated version! That didn't occur to me. Thanks! That being said, your code didn't quite work for me, although it did give me the starting point to fix everything. Note, for example, that in your output, WRST is left-justified instead of centered. Also, I explicitly want the red boxes around the hyperlinks that hyperref provides by default (in my setup, at least), and when I run your code as-is, the hyperlink box is around each line of WSRT in the normal way of hyperlinks with line breaks in them, instead of being a single box around the whole thing, which is what I want.
– bad_platypus
Jan 4 at 23:16
Here are the corrections I made: (1) put my spacing macro back in (because otherwise the red box touches the words inside, which I don't want); (2) Replaced "centervspace{-1 em} from my original code with "centering"; (3) added "arrow/.style={thick,->,>=stealth}" to the tikzset command. Those changes made everything work. (Although I have no doubt there's a more elegant way to handle everything.)
– bad_platypus
Jan 4 at 23:17
With the code you gave in the question, there is no red box after compilation. As for the fact that a text is justified on the left, it's because I forgot to delete the box you addedparbox{9em}{textbf{Wilcoxon Rank Sum Test}}
and which prevents TikZ from centering normally as it does with the other.
– AndréC
Jan 5 at 8:07
With TikZ, to separate the text from the sides of the box, simply use theinner sep
key
– AndréC
Jan 5 at 8:10
AndréC: I appreciate your input, but in my version of TeX I get the red boxes. I'm using MikTeX with the most current versions of all the packages and the default settings (other than what's changed in the posted code). I don't know if you're using different settings or if your defaults are somehow different, but for some reason we're getting different results. As I said, while your code didn't work directly for me, you gave me the hint I needed to fix things, so thanks! When I'm back on my other computer, I'll post the code that I ended up with.
– bad_platypus
Jan 6 at 21:22
|
show 3 more comments
As promised, here's the final code that worked for me; thanks to AndréC for pointing me in the right direction. I removed my spacing macro from the WRST box to illustrate why I used it. For those of you not following our comment thread, you need to create a PDF to see the boxes around the links.
documentclass{article}
usepackage{tikz}
usepackage[linktocpage=true,linkbordercolor={0 0 1}]{hyperref} % Makes blue box in PDF
usepackage[capitalize]{cleveref}
%usetikzlibrary{arrows}
usetikzlibrary{arrows.meta}
usetikzlibrary{positioning}
tikzset{rect/.style={rectangle, rounded corners, minimum width=8em,%
minimum height=3em, text width=8em, text centered, draw=black},
rect2/.style={rectangle, rounded corners, minimum width=5.5em,%
minimum height=3em, text width=5.5em, text centered, draw=black},
anch/.style={inner sep=0em, outer sep=0em}
}
% Create a spacer to make sure box around link in PDF isn't too close to text.
newcommand{spacerrule}[3][0 em]{textcolor{white}{rule[#2]{#1}{#3}}}
begin{document}
% So the hyperlinks link to something.
label{signedranktest}
label{ranksumtest}
begin{center}
begin{tikzpicture}[node distance=3 em,>={Stealth}]
node (samp2) [rect] {2 groups};
node (lev2b) [anch, below of=samp2]{};
node (paired1) [rect, below left= of lev2b]{Paired/matched samples};
node (indep1) [rect, below right= of lev2b]{Independent samples};
% With spacing macro:
node (pairtest) [below = of paired1, text width=9em, text centered]%
{hyperref[signedranktest]{parbox{9em}{centeringspacerrule{.1 em}{1 em}textbf{Wilcoxon Signed Rank Test}spacerrule{-.4 em}{1 em}}}};
% Without spacing macro:
node (indtest) [below = of indep1, text width=9em, text centered]%
{hyperref[ranksumtest]{parbox{9em}{centeringtextbf{Wilcoxon Rank Sum Test}}}};
draw [->] (samp2) -- (lev2b);
draw [->] (lev2b) -| (paired1);
draw [->] (lev2b) -| (indep1);
draw [->] (paired1) -- (pairtest);
draw [->] (indep1) -- (indtest);
end{tikzpicture}
end{center}
end{document}
New contributor
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f468517%2fhyperlink-boxes-not-sized-correctly-in-tikzpicture%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Your code dates from the first versions of TikZ and is now deprecated.
The extra boxes you've added everywhere are disrupting TikZ's normal work. The easiest way here is to do everything with the new 3.0.1a's TikZ version and without having to go through additional commands that complicate his work.
So, I deleted theses boxes and updated the code.
Thus, your personal macro spacerrule
is useless and to solve all your problems, just load the positioning
library (read section 17.5.3 from page 229 of the manual 3.0.1a).
The tikzstyle
is depreciated in favor of the tikzset
.
For arrows, the library is now called arrows.meta
documentclass{article}
usepackage{tikz}
usepackage[linktocpage=true]{hyperref}
usepackage[capitalize]{cleveref}
usetikzlibrary{arrows}
usetikzlibrary{arrows.meta}
usetikzlibrary{positioning}
tikzset{rect/.style={rectangle, rounded corners, minimum width=8em,%
minimum height=3em, text width=8em, text centered, draw=black},
rect2/.style={rectangle, rounded corners, minimum width=5.5em,%
minimum height=3em, text width=5.5em, text centered, draw=black},
anch/.style={inner sep=0em, outer sep=0em}
}
% Create a spacer to make sure box around link isn't too close to text.
%newcommand{spacerrule}[3][0 em]{textcolor{white}{rule[#2]{#1}{#3}}}
begin{document}
% So the hyperlinks link to something.
label{signedranktest}
label{ranksumtest}
% Verify that the commands work outside of tikzpicture
hyperref[signedranktest]{parbox{9em}{centervspace{-1 em}%
textbf{Wilcoxon Signed Rank Test}}}
vspace{1 em}
hyperref[ranksumtest]{parbox{9em}{centervspace{-1 em}%
textbf{Wilcoxon Rank Sum Test}}}
begin{center}
begin{tikzpicture}[node distance=3 em,>={Stealth}]
node (samp2) [rect] {2 groups};
node (lev2b) [anch, below of=samp2]{};
node (paired1) [rect, below left= of lev2b]{Paired/matched samples};
node (indep1) [rect, below right= of lev2b]{Independent samples};
node (pairtest) [below = of paired1, text width=9em, text centered]%
{hyperref[signedranktest]{textbf{Wilcoxon Signed Rank Test}}};
node (indtest) [below = of indep1, text width=9em, text centered]%
{hyperref[ranksumtest]{parbox{9em}{textbf{Wilcoxon Rank Sum Test}}}};
draw [->] (samp2) -- (lev2b);
draw [->] (lev2b) -| (paired1);
draw [->] (lev2b) -| (indep1);
draw [->] (paired1) -- (pairtest);
draw [->] (indep1) -- (indtest);
end{tikzpicture}
end{center}
end{document}
A deprecated version! That didn't occur to me. Thanks! That being said, your code didn't quite work for me, although it did give me the starting point to fix everything. Note, for example, that in your output, WRST is left-justified instead of centered. Also, I explicitly want the red boxes around the hyperlinks that hyperref provides by default (in my setup, at least), and when I run your code as-is, the hyperlink box is around each line of WSRT in the normal way of hyperlinks with line breaks in them, instead of being a single box around the whole thing, which is what I want.
– bad_platypus
Jan 4 at 23:16
Here are the corrections I made: (1) put my spacing macro back in (because otherwise the red box touches the words inside, which I don't want); (2) Replaced "centervspace{-1 em} from my original code with "centering"; (3) added "arrow/.style={thick,->,>=stealth}" to the tikzset command. Those changes made everything work. (Although I have no doubt there's a more elegant way to handle everything.)
– bad_platypus
Jan 4 at 23:17
With the code you gave in the question, there is no red box after compilation. As for the fact that a text is justified on the left, it's because I forgot to delete the box you addedparbox{9em}{textbf{Wilcoxon Rank Sum Test}}
and which prevents TikZ from centering normally as it does with the other.
– AndréC
Jan 5 at 8:07
With TikZ, to separate the text from the sides of the box, simply use theinner sep
key
– AndréC
Jan 5 at 8:10
AndréC: I appreciate your input, but in my version of TeX I get the red boxes. I'm using MikTeX with the most current versions of all the packages and the default settings (other than what's changed in the posted code). I don't know if you're using different settings or if your defaults are somehow different, but for some reason we're getting different results. As I said, while your code didn't work directly for me, you gave me the hint I needed to fix things, so thanks! When I'm back on my other computer, I'll post the code that I ended up with.
– bad_platypus
Jan 6 at 21:22
|
show 3 more comments
Your code dates from the first versions of TikZ and is now deprecated.
The extra boxes you've added everywhere are disrupting TikZ's normal work. The easiest way here is to do everything with the new 3.0.1a's TikZ version and without having to go through additional commands that complicate his work.
So, I deleted theses boxes and updated the code.
Thus, your personal macro spacerrule
is useless and to solve all your problems, just load the positioning
library (read section 17.5.3 from page 229 of the manual 3.0.1a).
The tikzstyle
is depreciated in favor of the tikzset
.
For arrows, the library is now called arrows.meta
documentclass{article}
usepackage{tikz}
usepackage[linktocpage=true]{hyperref}
usepackage[capitalize]{cleveref}
usetikzlibrary{arrows}
usetikzlibrary{arrows.meta}
usetikzlibrary{positioning}
tikzset{rect/.style={rectangle, rounded corners, minimum width=8em,%
minimum height=3em, text width=8em, text centered, draw=black},
rect2/.style={rectangle, rounded corners, minimum width=5.5em,%
minimum height=3em, text width=5.5em, text centered, draw=black},
anch/.style={inner sep=0em, outer sep=0em}
}
% Create a spacer to make sure box around link isn't too close to text.
%newcommand{spacerrule}[3][0 em]{textcolor{white}{rule[#2]{#1}{#3}}}
begin{document}
% So the hyperlinks link to something.
label{signedranktest}
label{ranksumtest}
% Verify that the commands work outside of tikzpicture
hyperref[signedranktest]{parbox{9em}{centervspace{-1 em}%
textbf{Wilcoxon Signed Rank Test}}}
vspace{1 em}
hyperref[ranksumtest]{parbox{9em}{centervspace{-1 em}%
textbf{Wilcoxon Rank Sum Test}}}
begin{center}
begin{tikzpicture}[node distance=3 em,>={Stealth}]
node (samp2) [rect] {2 groups};
node (lev2b) [anch, below of=samp2]{};
node (paired1) [rect, below left= of lev2b]{Paired/matched samples};
node (indep1) [rect, below right= of lev2b]{Independent samples};
node (pairtest) [below = of paired1, text width=9em, text centered]%
{hyperref[signedranktest]{textbf{Wilcoxon Signed Rank Test}}};
node (indtest) [below = of indep1, text width=9em, text centered]%
{hyperref[ranksumtest]{parbox{9em}{textbf{Wilcoxon Rank Sum Test}}}};
draw [->] (samp2) -- (lev2b);
draw [->] (lev2b) -| (paired1);
draw [->] (lev2b) -| (indep1);
draw [->] (paired1) -- (pairtest);
draw [->] (indep1) -- (indtest);
end{tikzpicture}
end{center}
end{document}
A deprecated version! That didn't occur to me. Thanks! That being said, your code didn't quite work for me, although it did give me the starting point to fix everything. Note, for example, that in your output, WRST is left-justified instead of centered. Also, I explicitly want the red boxes around the hyperlinks that hyperref provides by default (in my setup, at least), and when I run your code as-is, the hyperlink box is around each line of WSRT in the normal way of hyperlinks with line breaks in them, instead of being a single box around the whole thing, which is what I want.
– bad_platypus
Jan 4 at 23:16
Here are the corrections I made: (1) put my spacing macro back in (because otherwise the red box touches the words inside, which I don't want); (2) Replaced "centervspace{-1 em} from my original code with "centering"; (3) added "arrow/.style={thick,->,>=stealth}" to the tikzset command. Those changes made everything work. (Although I have no doubt there's a more elegant way to handle everything.)
– bad_platypus
Jan 4 at 23:17
With the code you gave in the question, there is no red box after compilation. As for the fact that a text is justified on the left, it's because I forgot to delete the box you addedparbox{9em}{textbf{Wilcoxon Rank Sum Test}}
and which prevents TikZ from centering normally as it does with the other.
– AndréC
Jan 5 at 8:07
With TikZ, to separate the text from the sides of the box, simply use theinner sep
key
– AndréC
Jan 5 at 8:10
AndréC: I appreciate your input, but in my version of TeX I get the red boxes. I'm using MikTeX with the most current versions of all the packages and the default settings (other than what's changed in the posted code). I don't know if you're using different settings or if your defaults are somehow different, but for some reason we're getting different results. As I said, while your code didn't work directly for me, you gave me the hint I needed to fix things, so thanks! When I'm back on my other computer, I'll post the code that I ended up with.
– bad_platypus
Jan 6 at 21:22
|
show 3 more comments
Your code dates from the first versions of TikZ and is now deprecated.
The extra boxes you've added everywhere are disrupting TikZ's normal work. The easiest way here is to do everything with the new 3.0.1a's TikZ version and without having to go through additional commands that complicate his work.
So, I deleted theses boxes and updated the code.
Thus, your personal macro spacerrule
is useless and to solve all your problems, just load the positioning
library (read section 17.5.3 from page 229 of the manual 3.0.1a).
The tikzstyle
is depreciated in favor of the tikzset
.
For arrows, the library is now called arrows.meta
documentclass{article}
usepackage{tikz}
usepackage[linktocpage=true]{hyperref}
usepackage[capitalize]{cleveref}
usetikzlibrary{arrows}
usetikzlibrary{arrows.meta}
usetikzlibrary{positioning}
tikzset{rect/.style={rectangle, rounded corners, minimum width=8em,%
minimum height=3em, text width=8em, text centered, draw=black},
rect2/.style={rectangle, rounded corners, minimum width=5.5em,%
minimum height=3em, text width=5.5em, text centered, draw=black},
anch/.style={inner sep=0em, outer sep=0em}
}
% Create a spacer to make sure box around link isn't too close to text.
%newcommand{spacerrule}[3][0 em]{textcolor{white}{rule[#2]{#1}{#3}}}
begin{document}
% So the hyperlinks link to something.
label{signedranktest}
label{ranksumtest}
% Verify that the commands work outside of tikzpicture
hyperref[signedranktest]{parbox{9em}{centervspace{-1 em}%
textbf{Wilcoxon Signed Rank Test}}}
vspace{1 em}
hyperref[ranksumtest]{parbox{9em}{centervspace{-1 em}%
textbf{Wilcoxon Rank Sum Test}}}
begin{center}
begin{tikzpicture}[node distance=3 em,>={Stealth}]
node (samp2) [rect] {2 groups};
node (lev2b) [anch, below of=samp2]{};
node (paired1) [rect, below left= of lev2b]{Paired/matched samples};
node (indep1) [rect, below right= of lev2b]{Independent samples};
node (pairtest) [below = of paired1, text width=9em, text centered]%
{hyperref[signedranktest]{textbf{Wilcoxon Signed Rank Test}}};
node (indtest) [below = of indep1, text width=9em, text centered]%
{hyperref[ranksumtest]{parbox{9em}{textbf{Wilcoxon Rank Sum Test}}}};
draw [->] (samp2) -- (lev2b);
draw [->] (lev2b) -| (paired1);
draw [->] (lev2b) -| (indep1);
draw [->] (paired1) -- (pairtest);
draw [->] (indep1) -- (indtest);
end{tikzpicture}
end{center}
end{document}
Your code dates from the first versions of TikZ and is now deprecated.
The extra boxes you've added everywhere are disrupting TikZ's normal work. The easiest way here is to do everything with the new 3.0.1a's TikZ version and without having to go through additional commands that complicate his work.
So, I deleted theses boxes and updated the code.
Thus, your personal macro spacerrule
is useless and to solve all your problems, just load the positioning
library (read section 17.5.3 from page 229 of the manual 3.0.1a).
The tikzstyle
is depreciated in favor of the tikzset
.
For arrows, the library is now called arrows.meta
documentclass{article}
usepackage{tikz}
usepackage[linktocpage=true]{hyperref}
usepackage[capitalize]{cleveref}
usetikzlibrary{arrows}
usetikzlibrary{arrows.meta}
usetikzlibrary{positioning}
tikzset{rect/.style={rectangle, rounded corners, minimum width=8em,%
minimum height=3em, text width=8em, text centered, draw=black},
rect2/.style={rectangle, rounded corners, minimum width=5.5em,%
minimum height=3em, text width=5.5em, text centered, draw=black},
anch/.style={inner sep=0em, outer sep=0em}
}
% Create a spacer to make sure box around link isn't too close to text.
%newcommand{spacerrule}[3][0 em]{textcolor{white}{rule[#2]{#1}{#3}}}
begin{document}
% So the hyperlinks link to something.
label{signedranktest}
label{ranksumtest}
% Verify that the commands work outside of tikzpicture
hyperref[signedranktest]{parbox{9em}{centervspace{-1 em}%
textbf{Wilcoxon Signed Rank Test}}}
vspace{1 em}
hyperref[ranksumtest]{parbox{9em}{centervspace{-1 em}%
textbf{Wilcoxon Rank Sum Test}}}
begin{center}
begin{tikzpicture}[node distance=3 em,>={Stealth}]
node (samp2) [rect] {2 groups};
node (lev2b) [anch, below of=samp2]{};
node (paired1) [rect, below left= of lev2b]{Paired/matched samples};
node (indep1) [rect, below right= of lev2b]{Independent samples};
node (pairtest) [below = of paired1, text width=9em, text centered]%
{hyperref[signedranktest]{textbf{Wilcoxon Signed Rank Test}}};
node (indtest) [below = of indep1, text width=9em, text centered]%
{hyperref[ranksumtest]{parbox{9em}{textbf{Wilcoxon Rank Sum Test}}}};
draw [->] (samp2) -- (lev2b);
draw [->] (lev2b) -| (paired1);
draw [->] (lev2b) -| (indep1);
draw [->] (paired1) -- (pairtest);
draw [->] (indep1) -- (indtest);
end{tikzpicture}
end{center}
end{document}
edited Jan 4 at 10:36
answered Jan 4 at 8:20
AndréCAndréC
8,30611445
8,30611445
A deprecated version! That didn't occur to me. Thanks! That being said, your code didn't quite work for me, although it did give me the starting point to fix everything. Note, for example, that in your output, WRST is left-justified instead of centered. Also, I explicitly want the red boxes around the hyperlinks that hyperref provides by default (in my setup, at least), and when I run your code as-is, the hyperlink box is around each line of WSRT in the normal way of hyperlinks with line breaks in them, instead of being a single box around the whole thing, which is what I want.
– bad_platypus
Jan 4 at 23:16
Here are the corrections I made: (1) put my spacing macro back in (because otherwise the red box touches the words inside, which I don't want); (2) Replaced "centervspace{-1 em} from my original code with "centering"; (3) added "arrow/.style={thick,->,>=stealth}" to the tikzset command. Those changes made everything work. (Although I have no doubt there's a more elegant way to handle everything.)
– bad_platypus
Jan 4 at 23:17
With the code you gave in the question, there is no red box after compilation. As for the fact that a text is justified on the left, it's because I forgot to delete the box you addedparbox{9em}{textbf{Wilcoxon Rank Sum Test}}
and which prevents TikZ from centering normally as it does with the other.
– AndréC
Jan 5 at 8:07
With TikZ, to separate the text from the sides of the box, simply use theinner sep
key
– AndréC
Jan 5 at 8:10
AndréC: I appreciate your input, but in my version of TeX I get the red boxes. I'm using MikTeX with the most current versions of all the packages and the default settings (other than what's changed in the posted code). I don't know if you're using different settings or if your defaults are somehow different, but for some reason we're getting different results. As I said, while your code didn't work directly for me, you gave me the hint I needed to fix things, so thanks! When I'm back on my other computer, I'll post the code that I ended up with.
– bad_platypus
Jan 6 at 21:22
|
show 3 more comments
A deprecated version! That didn't occur to me. Thanks! That being said, your code didn't quite work for me, although it did give me the starting point to fix everything. Note, for example, that in your output, WRST is left-justified instead of centered. Also, I explicitly want the red boxes around the hyperlinks that hyperref provides by default (in my setup, at least), and when I run your code as-is, the hyperlink box is around each line of WSRT in the normal way of hyperlinks with line breaks in them, instead of being a single box around the whole thing, which is what I want.
– bad_platypus
Jan 4 at 23:16
Here are the corrections I made: (1) put my spacing macro back in (because otherwise the red box touches the words inside, which I don't want); (2) Replaced "centervspace{-1 em} from my original code with "centering"; (3) added "arrow/.style={thick,->,>=stealth}" to the tikzset command. Those changes made everything work. (Although I have no doubt there's a more elegant way to handle everything.)
– bad_platypus
Jan 4 at 23:17
With the code you gave in the question, there is no red box after compilation. As for the fact that a text is justified on the left, it's because I forgot to delete the box you addedparbox{9em}{textbf{Wilcoxon Rank Sum Test}}
and which prevents TikZ from centering normally as it does with the other.
– AndréC
Jan 5 at 8:07
With TikZ, to separate the text from the sides of the box, simply use theinner sep
key
– AndréC
Jan 5 at 8:10
AndréC: I appreciate your input, but in my version of TeX I get the red boxes. I'm using MikTeX with the most current versions of all the packages and the default settings (other than what's changed in the posted code). I don't know if you're using different settings or if your defaults are somehow different, but for some reason we're getting different results. As I said, while your code didn't work directly for me, you gave me the hint I needed to fix things, so thanks! When I'm back on my other computer, I'll post the code that I ended up with.
– bad_platypus
Jan 6 at 21:22
A deprecated version! That didn't occur to me. Thanks! That being said, your code didn't quite work for me, although it did give me the starting point to fix everything. Note, for example, that in your output, WRST is left-justified instead of centered. Also, I explicitly want the red boxes around the hyperlinks that hyperref provides by default (in my setup, at least), and when I run your code as-is, the hyperlink box is around each line of WSRT in the normal way of hyperlinks with line breaks in them, instead of being a single box around the whole thing, which is what I want.
– bad_platypus
Jan 4 at 23:16
A deprecated version! That didn't occur to me. Thanks! That being said, your code didn't quite work for me, although it did give me the starting point to fix everything. Note, for example, that in your output, WRST is left-justified instead of centered. Also, I explicitly want the red boxes around the hyperlinks that hyperref provides by default (in my setup, at least), and when I run your code as-is, the hyperlink box is around each line of WSRT in the normal way of hyperlinks with line breaks in them, instead of being a single box around the whole thing, which is what I want.
– bad_platypus
Jan 4 at 23:16
Here are the corrections I made: (1) put my spacing macro back in (because otherwise the red box touches the words inside, which I don't want); (2) Replaced "centervspace{-1 em} from my original code with "centering"; (3) added "arrow/.style={thick,->,>=stealth}" to the tikzset command. Those changes made everything work. (Although I have no doubt there's a more elegant way to handle everything.)
– bad_platypus
Jan 4 at 23:17
Here are the corrections I made: (1) put my spacing macro back in (because otherwise the red box touches the words inside, which I don't want); (2) Replaced "centervspace{-1 em} from my original code with "centering"; (3) added "arrow/.style={thick,->,>=stealth}" to the tikzset command. Those changes made everything work. (Although I have no doubt there's a more elegant way to handle everything.)
– bad_platypus
Jan 4 at 23:17
With the code you gave in the question, there is no red box after compilation. As for the fact that a text is justified on the left, it's because I forgot to delete the box you added
parbox{9em}{textbf{Wilcoxon Rank Sum Test}}
and which prevents TikZ from centering normally as it does with the other.– AndréC
Jan 5 at 8:07
With the code you gave in the question, there is no red box after compilation. As for the fact that a text is justified on the left, it's because I forgot to delete the box you added
parbox{9em}{textbf{Wilcoxon Rank Sum Test}}
and which prevents TikZ from centering normally as it does with the other.– AndréC
Jan 5 at 8:07
With TikZ, to separate the text from the sides of the box, simply use the
inner sep
key– AndréC
Jan 5 at 8:10
With TikZ, to separate the text from the sides of the box, simply use the
inner sep
key– AndréC
Jan 5 at 8:10
AndréC: I appreciate your input, but in my version of TeX I get the red boxes. I'm using MikTeX with the most current versions of all the packages and the default settings (other than what's changed in the posted code). I don't know if you're using different settings or if your defaults are somehow different, but for some reason we're getting different results. As I said, while your code didn't work directly for me, you gave me the hint I needed to fix things, so thanks! When I'm back on my other computer, I'll post the code that I ended up with.
– bad_platypus
Jan 6 at 21:22
AndréC: I appreciate your input, but in my version of TeX I get the red boxes. I'm using MikTeX with the most current versions of all the packages and the default settings (other than what's changed in the posted code). I don't know if you're using different settings or if your defaults are somehow different, but for some reason we're getting different results. As I said, while your code didn't work directly for me, you gave me the hint I needed to fix things, so thanks! When I'm back on my other computer, I'll post the code that I ended up with.
– bad_platypus
Jan 6 at 21:22
|
show 3 more comments
As promised, here's the final code that worked for me; thanks to AndréC for pointing me in the right direction. I removed my spacing macro from the WRST box to illustrate why I used it. For those of you not following our comment thread, you need to create a PDF to see the boxes around the links.
documentclass{article}
usepackage{tikz}
usepackage[linktocpage=true,linkbordercolor={0 0 1}]{hyperref} % Makes blue box in PDF
usepackage[capitalize]{cleveref}
%usetikzlibrary{arrows}
usetikzlibrary{arrows.meta}
usetikzlibrary{positioning}
tikzset{rect/.style={rectangle, rounded corners, minimum width=8em,%
minimum height=3em, text width=8em, text centered, draw=black},
rect2/.style={rectangle, rounded corners, minimum width=5.5em,%
minimum height=3em, text width=5.5em, text centered, draw=black},
anch/.style={inner sep=0em, outer sep=0em}
}
% Create a spacer to make sure box around link in PDF isn't too close to text.
newcommand{spacerrule}[3][0 em]{textcolor{white}{rule[#2]{#1}{#3}}}
begin{document}
% So the hyperlinks link to something.
label{signedranktest}
label{ranksumtest}
begin{center}
begin{tikzpicture}[node distance=3 em,>={Stealth}]
node (samp2) [rect] {2 groups};
node (lev2b) [anch, below of=samp2]{};
node (paired1) [rect, below left= of lev2b]{Paired/matched samples};
node (indep1) [rect, below right= of lev2b]{Independent samples};
% With spacing macro:
node (pairtest) [below = of paired1, text width=9em, text centered]%
{hyperref[signedranktest]{parbox{9em}{centeringspacerrule{.1 em}{1 em}textbf{Wilcoxon Signed Rank Test}spacerrule{-.4 em}{1 em}}}};
% Without spacing macro:
node (indtest) [below = of indep1, text width=9em, text centered]%
{hyperref[ranksumtest]{parbox{9em}{centeringtextbf{Wilcoxon Rank Sum Test}}}};
draw [->] (samp2) -- (lev2b);
draw [->] (lev2b) -| (paired1);
draw [->] (lev2b) -| (indep1);
draw [->] (paired1) -- (pairtest);
draw [->] (indep1) -- (indtest);
end{tikzpicture}
end{center}
end{document}
New contributor
add a comment |
As promised, here's the final code that worked for me; thanks to AndréC for pointing me in the right direction. I removed my spacing macro from the WRST box to illustrate why I used it. For those of you not following our comment thread, you need to create a PDF to see the boxes around the links.
documentclass{article}
usepackage{tikz}
usepackage[linktocpage=true,linkbordercolor={0 0 1}]{hyperref} % Makes blue box in PDF
usepackage[capitalize]{cleveref}
%usetikzlibrary{arrows}
usetikzlibrary{arrows.meta}
usetikzlibrary{positioning}
tikzset{rect/.style={rectangle, rounded corners, minimum width=8em,%
minimum height=3em, text width=8em, text centered, draw=black},
rect2/.style={rectangle, rounded corners, minimum width=5.5em,%
minimum height=3em, text width=5.5em, text centered, draw=black},
anch/.style={inner sep=0em, outer sep=0em}
}
% Create a spacer to make sure box around link in PDF isn't too close to text.
newcommand{spacerrule}[3][0 em]{textcolor{white}{rule[#2]{#1}{#3}}}
begin{document}
% So the hyperlinks link to something.
label{signedranktest}
label{ranksumtest}
begin{center}
begin{tikzpicture}[node distance=3 em,>={Stealth}]
node (samp2) [rect] {2 groups};
node (lev2b) [anch, below of=samp2]{};
node (paired1) [rect, below left= of lev2b]{Paired/matched samples};
node (indep1) [rect, below right= of lev2b]{Independent samples};
% With spacing macro:
node (pairtest) [below = of paired1, text width=9em, text centered]%
{hyperref[signedranktest]{parbox{9em}{centeringspacerrule{.1 em}{1 em}textbf{Wilcoxon Signed Rank Test}spacerrule{-.4 em}{1 em}}}};
% Without spacing macro:
node (indtest) [below = of indep1, text width=9em, text centered]%
{hyperref[ranksumtest]{parbox{9em}{centeringtextbf{Wilcoxon Rank Sum Test}}}};
draw [->] (samp2) -- (lev2b);
draw [->] (lev2b) -| (paired1);
draw [->] (lev2b) -| (indep1);
draw [->] (paired1) -- (pairtest);
draw [->] (indep1) -- (indtest);
end{tikzpicture}
end{center}
end{document}
New contributor
add a comment |
As promised, here's the final code that worked for me; thanks to AndréC for pointing me in the right direction. I removed my spacing macro from the WRST box to illustrate why I used it. For those of you not following our comment thread, you need to create a PDF to see the boxes around the links.
documentclass{article}
usepackage{tikz}
usepackage[linktocpage=true,linkbordercolor={0 0 1}]{hyperref} % Makes blue box in PDF
usepackage[capitalize]{cleveref}
%usetikzlibrary{arrows}
usetikzlibrary{arrows.meta}
usetikzlibrary{positioning}
tikzset{rect/.style={rectangle, rounded corners, minimum width=8em,%
minimum height=3em, text width=8em, text centered, draw=black},
rect2/.style={rectangle, rounded corners, minimum width=5.5em,%
minimum height=3em, text width=5.5em, text centered, draw=black},
anch/.style={inner sep=0em, outer sep=0em}
}
% Create a spacer to make sure box around link in PDF isn't too close to text.
newcommand{spacerrule}[3][0 em]{textcolor{white}{rule[#2]{#1}{#3}}}
begin{document}
% So the hyperlinks link to something.
label{signedranktest}
label{ranksumtest}
begin{center}
begin{tikzpicture}[node distance=3 em,>={Stealth}]
node (samp2) [rect] {2 groups};
node (lev2b) [anch, below of=samp2]{};
node (paired1) [rect, below left= of lev2b]{Paired/matched samples};
node (indep1) [rect, below right= of lev2b]{Independent samples};
% With spacing macro:
node (pairtest) [below = of paired1, text width=9em, text centered]%
{hyperref[signedranktest]{parbox{9em}{centeringspacerrule{.1 em}{1 em}textbf{Wilcoxon Signed Rank Test}spacerrule{-.4 em}{1 em}}}};
% Without spacing macro:
node (indtest) [below = of indep1, text width=9em, text centered]%
{hyperref[ranksumtest]{parbox{9em}{centeringtextbf{Wilcoxon Rank Sum Test}}}};
draw [->] (samp2) -- (lev2b);
draw [->] (lev2b) -| (paired1);
draw [->] (lev2b) -| (indep1);
draw [->] (paired1) -- (pairtest);
draw [->] (indep1) -- (indtest);
end{tikzpicture}
end{center}
end{document}
New contributor
As promised, here's the final code that worked for me; thanks to AndréC for pointing me in the right direction. I removed my spacing macro from the WRST box to illustrate why I used it. For those of you not following our comment thread, you need to create a PDF to see the boxes around the links.
documentclass{article}
usepackage{tikz}
usepackage[linktocpage=true,linkbordercolor={0 0 1}]{hyperref} % Makes blue box in PDF
usepackage[capitalize]{cleveref}
%usetikzlibrary{arrows}
usetikzlibrary{arrows.meta}
usetikzlibrary{positioning}
tikzset{rect/.style={rectangle, rounded corners, minimum width=8em,%
minimum height=3em, text width=8em, text centered, draw=black},
rect2/.style={rectangle, rounded corners, minimum width=5.5em,%
minimum height=3em, text width=5.5em, text centered, draw=black},
anch/.style={inner sep=0em, outer sep=0em}
}
% Create a spacer to make sure box around link in PDF isn't too close to text.
newcommand{spacerrule}[3][0 em]{textcolor{white}{rule[#2]{#1}{#3}}}
begin{document}
% So the hyperlinks link to something.
label{signedranktest}
label{ranksumtest}
begin{center}
begin{tikzpicture}[node distance=3 em,>={Stealth}]
node (samp2) [rect] {2 groups};
node (lev2b) [anch, below of=samp2]{};
node (paired1) [rect, below left= of lev2b]{Paired/matched samples};
node (indep1) [rect, below right= of lev2b]{Independent samples};
% With spacing macro:
node (pairtest) [below = of paired1, text width=9em, text centered]%
{hyperref[signedranktest]{parbox{9em}{centeringspacerrule{.1 em}{1 em}textbf{Wilcoxon Signed Rank Test}spacerrule{-.4 em}{1 em}}}};
% Without spacing macro:
node (indtest) [below = of indep1, text width=9em, text centered]%
{hyperref[ranksumtest]{parbox{9em}{centeringtextbf{Wilcoxon Rank Sum Test}}}};
draw [->] (samp2) -- (lev2b);
draw [->] (lev2b) -| (paired1);
draw [->] (lev2b) -| (indep1);
draw [->] (paired1) -- (pairtest);
draw [->] (indep1) -- (indtest);
end{tikzpicture}
end{center}
end{document}
New contributor
New contributor
answered Jan 8 at 18:13
bad_platypusbad_platypus
61
61
New contributor
New contributor
add a comment |
add a comment |
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f468517%2fhyperlink-boxes-not-sized-correctly-in-tikzpicture%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
Try removing
begin{center}
andend{center}
. Then putcentering
immediately afterbegin{tikzpicture}[node distance=3 em]
. Does that fix it for you?– whatisit
Jan 4 at 6:39