Creating a lot of checkbox'es to make visible/invisible arrows using `tikzpicture` environmentChecking whether or not a node has been previously definedHow to draw a diagram of custom subject correlativitiesDesign an algorithm capable of predicting collisions to choose alternative path using `tikzpicture` environmentHow to connect `pic`s through a set of colorful arrows using `tikzpicture` environment
What is the difference between "behavior" and "behaviour"?
Is a stroke of luck acceptable after a series of unfavorable events?
Large drywall patch supports
How to run a prison with the smallest amount of guards?
Do all network devices need to make routing decisions, regardless of communication across networks or within a network?
Unreliable Magic - Is it worth it?
Integer addition + constant, is it a group?
Is there a good way to store credentials outside of a password manager?
Is there a problem with hiding "forgot password" until it's needed?
when is out of tune ok?
Type int? vs type int
How can a function with a hole (removable discontinuity) equal a function with no hole?
How do I find the solutions of the following equation?
Method to test if a number is a perfect power?
You cannot touch me, but I can touch you, who am I?
Fine Tuning of the Universe
How to be diplomatic in refusing to write code that breaches the privacy of our users
Closest Prime Number
What can we do to stop prior company from asking us questions?
How did Doctor Strange see the winning outcome in Avengers: Infinity War?
System.debug(JSON.Serialize(o)) Not longer shows full string
What happens if you roll doubles 3 times then land on "Go to jail?"
Avoiding estate tax by giving multiple gifts
Why didn't Theresa May consult with Parliament before negotiating a deal with the EU?
Creating a lot of checkbox'es to make visible/invisible arrows using `tikzpicture` environment
Checking whether or not a node has been previously definedHow to draw a diagram of custom subject correlativitiesDesign an algorithm capable of predicting collisions to choose alternative path using `tikzpicture` environmentHow to connect `pic`s through a set of colorful arrows using `tikzpicture` environment
I have this MWE, taken from marmot's nice answer:
documentclassarticle
usepackage[margin=0in,footskip=0in,paperwidth=60cm,paperheight=29cm]geometry
usepackage[english]babel
usepackage[utf8]inputenc
usepackage[T1]fontenc
usepackagehyperref
usepackagetikz
usetikzlibrarypositioning,fit,calc
pgfdeclarelayerbehind
pgfdeclarelayerbackground
pgfdeclarelayerforeground
pgfsetlayersbehind,background,main,foreground
tikzset
text field/.style=text height=1.5ex,align=center,rounded corners,
nonfillable title field/.style=text height=2ex,text depth=0.3em,anchor=south,text
width=5cm,align=center,font=footnotesizesffamily,
fillable title field/.style=text height=3.14ex,text depth=0em,anchor=south,text
width=5cm,align=center,font=footnotesizesffamily,
pics/fillable subject/.style=code= (-TF.south east)
-- cycle;
draw ([xshift=4pt]-Title.south west) -- ([xshift=-4pt]-Title.south east);
,
pics/nonfillable subject/.style=code=- (-Title.south west)
,
pics/fillable elective subject/.style=code=- (-Title.south west)
,
pics/nonfillable elective subject/.style=code=%
node[text field] (-TF)
hspace1.2em~/~hspace1.15em~/~hspace2.35em;
node[nonfillable title field] (-Title)
at ([yshift=0.4em]-TF.north) ;
draw[rounded corners] (-TF.south west) ,
manoooh/.style=column sep=-1.75cm,row sep=5mm,
manooohE/.style=column sep=-2.25cm,row sep=5mm,anchor=south,
electives/.style=column sep=-7.25cm,row sep=5mm,
fit sep/.initial=4pt, % change width of node (big rectangle shape)
fit dist/.initial=40pt, % change node distance (big rectangle shape)
inlay top sep/.initial=24pt,
matrix top sep/.initial=24pt,
manoooh curve/.style=to path=let p1=($(tikztotarget)-(tikztostart)$)
in (tikztostart) .. controls ($(tikztostart)+(#1*x1,0)$)
and ($(tikztotarget)+(-#1*x1,0)$) .. (tikztotarget),
manoooh curve/.default=0.3,
along node/.style=insert path=
to[out=0,in=180]
([yshift=5pt]#1-Title.north west) -- ([yshift=5pt]#1-Title.north east)
% From https://tex.stackexchange.com/a/478723/152550
makeatletter% from https://tex.stackexchange.com/a/85531/121799
longdefifnodedefined#1#2#3%
@ifundefinedpgf@sh@ns@#1#3#2%
makeatother
begindocument
thispagestyleempty % To suppress page number
noindent
begintikzpicture
fill[white,fill=orange] (0,0) rectangle (paperwidth,-2cm) node[midway,align=center,font=Huge] bfseries Some text here\LARGE More text here;
endtikzpicture
ifdefinedmymatbottom
else
typeoutPleasespace recompilespace yourspace file!
defmymatbottom-150pt
fi
ifdefinedmyheight
else
defmyheight0
typeoutPleasespace recompilespace yourspace file!
fi
ifdefinedLstMatYShifts
else
defLstMatYShifts0pt,0pt,0pt,0pt,0pt,0pt,0pt
fi
ifdefinedLstMatXShifts
else
defLstMatXShifts0pt,0pt,0pt,0pt,0pt,0pt,0pt
fi
%typeoutheight:myheight
%typeoutxshifts(in):LstMatXShifts
vfill
centering
beginForm
begintikzpicture
% step 1: add the matrices, name them mat0, mat1 etc.
beginscope[local bounding box=matrices]
matrix[manoooh] (mat0) at (LstMatXShifts[0],LstMatYShifts[0])
pic[local bounding box=A] (0) nonfillable subject=Subject A; \
pic (1) nonfillable subject=Subject B; \
;
matrix[manoooh] (mat1) at (LstMatXShifts[1],LstMatYShifts[1])
pic (2) nonfillable subject=Subject C; \
pic (3) nonfillable subject=Subject D; \
pic (4) nonfillable subject=Subject E; \
pic (5) nonfillable subject=Subject F; \
pic (6) nonfillable subject=Subject G; \
pic (7) nonfillable subject=Subject H; \
pic (8) nonfillable subject=Subject I; \
pic[draw=red] (9) nonfillable subject=Subject J; \
;
matrix[manoooh] (mat2) at (LstMatXShifts[2],LstMatYShifts[2])
pic[draw=red] (10) nonfillable subject=Subject K; \
pic (11) nonfillable subject=Subject L; \
pic (12) nonfillable subject=Subject A; \
pic (13) nonfillable subject=Subject N; \
pic (14) nonfillable subject=Subject O; \
pic (15) nonfillable subject=Subject P; \
pic (16) nonfillable subject=Subject Q; \
pic (17) nonfillable subject=Subject R; \
;
matrix[manoooh] (mat3) at (LstMatXShifts[3],LstMatYShifts[3])
pic[draw=red] (18) nonfillable subject=Subject S; \
pic (19) nonfillable subject=Subject T; \
pic (20) nonfillable subject=Subject U; \
pic (21) nonfillable subject=Subject V; \
pic (22) nonfillable subject=Subject W; \
pic (23) nonfillable subject=Subject X; \
pic (24) nonfillable subject=Subject Y; \
pic (25) nonfillable subject=Subject Z; \
;
matrix[manooohE] (matE3) at (LstMatXShifts[3],mymatbottom)
pic (L3E1) nonfillable elective subject=Subject; & &
pic (L3E2) nonfillable elective subject=Subject; \
& pic (L3E3) nonfillable elective subject=Subject; & \
;
matrix[manoooh] (mat4) at (LstMatXShifts[4],LstMatYShifts[4])
& pic[draw=red] (26) nonfillable subject=Subject AA; & \
pic (27) nonfillable subject=Subject AB; & & pic (28) nonfillable subject=Subject AC; \
& pic (29) nonfillable subject=Subject AD; & \
& pic (30) nonfillable subject=Subject AE; & \
& pic (31) nonfillable subject=Subject AF; & \
& pic (32) nonfillable subject=Subject AG; & \
;
matrix[manooohE] (matE4) at (LstMatXShifts[4],mymatbottom)
pic (L4E1) nonfillable elective subject=Subject; \
;
matrix[manoooh] (mat5) at (LstMatXShifts[5],LstMatYShifts[5])
pic (33) nonfillable subject=Subject AH; \
pic (34) nonfillable subject=Subject AI; \
pic[draw=red] (35) nonfillable subject=Subject AJ; \
pic (36) nonfillable subject=Subject AK; \
;
matrix[manooohE] (matE5) at (LstMatXShifts[5],mymatbottom)
pic (L5E1) nonfillable elective subject=Subject; \
pic (L5E2) nonfillable elective subject=Subject; \
pic (L5E3) nonfillable elective subject=Subject; \
pic (L5E4) nonfillable elective subject=Subject; \
pic (L5E5) nonfillable elective subject=Subject; \
;
endscope
pgfmathsetmacrogroupwidth0
pgfmathsetmacrolastwidth0
foreach X in 0,...,5 %<- if you have more or less matrices, adjust 3
node[anchor=south,yshift=1cm,align=center,font=LARGEbfseriesboldmath]
at (matX
makeatletter
immediatewrite@mainauxxdefstringmymatbottom-mymatbottomrelax
immediatewrite@mainauxxdefstringmyheightmyheightrelax
immediatewrite@mainauxxdefstringLstMatYShiftsLstMatYShiftsrelax
immediatewrite@mainauxxdefstringLstMatXShiftsLstMatXShiftsrelax
makeatother
newcommandtotalnodes5 % Define the total of subjects that need arrows-1
% From https://tex.stackexchange.com/a/480685/152550
% now add the arrows.
defLstCon%
"2,...,9",%subjects that 0 links
"2,10/5,13/5,14/5",%subjects that 1 links
"11,14",%subjects that 2 links
"10,13,14,25/13",%subjects that 3 links
"36/12,21,29",%subjects that 4 links
foreach X in 0,...,totalnodes
pgfmathsetmacrohuenumX*0.75*(1/totalnodes)
definecolormycolorhsbhuenum,1,1
pgfmathsetmacromylstLstCon[X]
typeoutX:mylst
foreach Y/myalong in mylst
ifxmyalongY
%typeoutX:Y,empty
draw[-latex,mycolor,very thick] (X-Title.east)
to[manoooh curve] (Y-Title.west);
else
%typeoutX:Yspace andspace myalong
draw[-latex,mycolor,very thick] (X-Title.east)
[along node/.list/.expanded=myalong]
to[manoooh curve] (Y-Title.west);
fi
endtikzpicture
endForm
vfill
enddocument
I would like to add a set of checkbox'es from ocgx2
package, where we can set the arrows to "Visible" or "Invisible" that connect two or more subjects:
If we deselect e.g. "Correlatives of subject C" then all the arrows that start from "Subject C" must be changed to "Invisible", so we cannot see them. Also the "Select All" checkbox has to change, meaning that "We have not selected all the checkbox'es" i.e.:
If we deselect all of them:
Note that the "Select All" checkbox is automatically changed due to the user's deselection of all the other checkbox'es.
As expected, the user can select "Select All" to make all the arrows visible. If he deselects it, all the arrows must be invisible.
You can rely on this great example of AlexG's comment:
documentclass[12pt,margin=3pt]standalone
usepackage[tikz]ocgx2 % PDF Layers
usepackageamssymb % checkmark
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% check box command for layer switching
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
newcommandlayerCheckBox[3]%
% #1: layer name (as shown in Layers tab), #2: layer id,
% #3: initial visibility
resizebox2ex!ooalign%
switchocg#2$square$cr%
beginocg#1#2#3$checkmark$endocg%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
begindocument
begintikzpicture
node (a) at (0,0) A;
node (b) at (1,1) B;
beginscope[ocg=name=Arrow,ref=myArrow,status=visible]
draw[->] (a.east) -| (b.south);
endscope
endtikzpicture
layerCheckBoxArrowmyArrowonA$rightarrow$B
enddocument
If possible, the addition of the checkbox'es should be automatic, in the sense that if there is a set of arrows then they will be inserted in a new line of the big black frame.
After the compilation all the checkbox'es have to start "on".
tikz-pgf ocgx2
add a comment |
I have this MWE, taken from marmot's nice answer:
documentclassarticle
usepackage[margin=0in,footskip=0in,paperwidth=60cm,paperheight=29cm]geometry
usepackage[english]babel
usepackage[utf8]inputenc
usepackage[T1]fontenc
usepackagehyperref
usepackagetikz
usetikzlibrarypositioning,fit,calc
pgfdeclarelayerbehind
pgfdeclarelayerbackground
pgfdeclarelayerforeground
pgfsetlayersbehind,background,main,foreground
tikzset
text field/.style=text height=1.5ex,align=center,rounded corners,
nonfillable title field/.style=text height=2ex,text depth=0.3em,anchor=south,text
width=5cm,align=center,font=footnotesizesffamily,
fillable title field/.style=text height=3.14ex,text depth=0em,anchor=south,text
width=5cm,align=center,font=footnotesizesffamily,
pics/fillable subject/.style=code= (-TF.south east)
-- cycle;
draw ([xshift=4pt]-Title.south west) -- ([xshift=-4pt]-Title.south east);
,
pics/nonfillable subject/.style=code=- (-Title.south west)
,
pics/fillable elective subject/.style=code=- (-Title.south west)
,
pics/nonfillable elective subject/.style=code=%
node[text field] (-TF)
hspace1.2em~/~hspace1.15em~/~hspace2.35em;
node[nonfillable title field] (-Title)
at ([yshift=0.4em]-TF.north) ;
draw[rounded corners] (-TF.south west) ,
manoooh/.style=column sep=-1.75cm,row sep=5mm,
manooohE/.style=column sep=-2.25cm,row sep=5mm,anchor=south,
electives/.style=column sep=-7.25cm,row sep=5mm,
fit sep/.initial=4pt, % change width of node (big rectangle shape)
fit dist/.initial=40pt, % change node distance (big rectangle shape)
inlay top sep/.initial=24pt,
matrix top sep/.initial=24pt,
manoooh curve/.style=to path=let p1=($(tikztotarget)-(tikztostart)$)
in (tikztostart) .. controls ($(tikztostart)+(#1*x1,0)$)
and ($(tikztotarget)+(-#1*x1,0)$) .. (tikztotarget),
manoooh curve/.default=0.3,
along node/.style=insert path=
to[out=0,in=180]
([yshift=5pt]#1-Title.north west) -- ([yshift=5pt]#1-Title.north east)
% From https://tex.stackexchange.com/a/478723/152550
makeatletter% from https://tex.stackexchange.com/a/85531/121799
longdefifnodedefined#1#2#3%
@ifundefinedpgf@sh@ns@#1#3#2%
makeatother
begindocument
thispagestyleempty % To suppress page number
noindent
begintikzpicture
fill[white,fill=orange] (0,0) rectangle (paperwidth,-2cm) node[midway,align=center,font=Huge] bfseries Some text here\LARGE More text here;
endtikzpicture
ifdefinedmymatbottom
else
typeoutPleasespace recompilespace yourspace file!
defmymatbottom-150pt
fi
ifdefinedmyheight
else
defmyheight0
typeoutPleasespace recompilespace yourspace file!
fi
ifdefinedLstMatYShifts
else
defLstMatYShifts0pt,0pt,0pt,0pt,0pt,0pt,0pt
fi
ifdefinedLstMatXShifts
else
defLstMatXShifts0pt,0pt,0pt,0pt,0pt,0pt,0pt
fi
%typeoutheight:myheight
%typeoutxshifts(in):LstMatXShifts
vfill
centering
beginForm
begintikzpicture
% step 1: add the matrices, name them mat0, mat1 etc.
beginscope[local bounding box=matrices]
matrix[manoooh] (mat0) at (LstMatXShifts[0],LstMatYShifts[0])
pic[local bounding box=A] (0) nonfillable subject=Subject A; \
pic (1) nonfillable subject=Subject B; \
;
matrix[manoooh] (mat1) at (LstMatXShifts[1],LstMatYShifts[1])
pic (2) nonfillable subject=Subject C; \
pic (3) nonfillable subject=Subject D; \
pic (4) nonfillable subject=Subject E; \
pic (5) nonfillable subject=Subject F; \
pic (6) nonfillable subject=Subject G; \
pic (7) nonfillable subject=Subject H; \
pic (8) nonfillable subject=Subject I; \
pic[draw=red] (9) nonfillable subject=Subject J; \
;
matrix[manoooh] (mat2) at (LstMatXShifts[2],LstMatYShifts[2])
pic[draw=red] (10) nonfillable subject=Subject K; \
pic (11) nonfillable subject=Subject L; \
pic (12) nonfillable subject=Subject A; \
pic (13) nonfillable subject=Subject N; \
pic (14) nonfillable subject=Subject O; \
pic (15) nonfillable subject=Subject P; \
pic (16) nonfillable subject=Subject Q; \
pic (17) nonfillable subject=Subject R; \
;
matrix[manoooh] (mat3) at (LstMatXShifts[3],LstMatYShifts[3])
pic[draw=red] (18) nonfillable subject=Subject S; \
pic (19) nonfillable subject=Subject T; \
pic (20) nonfillable subject=Subject U; \
pic (21) nonfillable subject=Subject V; \
pic (22) nonfillable subject=Subject W; \
pic (23) nonfillable subject=Subject X; \
pic (24) nonfillable subject=Subject Y; \
pic (25) nonfillable subject=Subject Z; \
;
matrix[manooohE] (matE3) at (LstMatXShifts[3],mymatbottom)
pic (L3E1) nonfillable elective subject=Subject; & &
pic (L3E2) nonfillable elective subject=Subject; \
& pic (L3E3) nonfillable elective subject=Subject; & \
;
matrix[manoooh] (mat4) at (LstMatXShifts[4],LstMatYShifts[4])
& pic[draw=red] (26) nonfillable subject=Subject AA; & \
pic (27) nonfillable subject=Subject AB; & & pic (28) nonfillable subject=Subject AC; \
& pic (29) nonfillable subject=Subject AD; & \
& pic (30) nonfillable subject=Subject AE; & \
& pic (31) nonfillable subject=Subject AF; & \
& pic (32) nonfillable subject=Subject AG; & \
;
matrix[manooohE] (matE4) at (LstMatXShifts[4],mymatbottom)
pic (L4E1) nonfillable elective subject=Subject; \
;
matrix[manoooh] (mat5) at (LstMatXShifts[5],LstMatYShifts[5])
pic (33) nonfillable subject=Subject AH; \
pic (34) nonfillable subject=Subject AI; \
pic[draw=red] (35) nonfillable subject=Subject AJ; \
pic (36) nonfillable subject=Subject AK; \
;
matrix[manooohE] (matE5) at (LstMatXShifts[5],mymatbottom)
pic (L5E1) nonfillable elective subject=Subject; \
pic (L5E2) nonfillable elective subject=Subject; \
pic (L5E3) nonfillable elective subject=Subject; \
pic (L5E4) nonfillable elective subject=Subject; \
pic (L5E5) nonfillable elective subject=Subject; \
;
endscope
pgfmathsetmacrogroupwidth0
pgfmathsetmacrolastwidth0
foreach X in 0,...,5 %<- if you have more or less matrices, adjust 3
node[anchor=south,yshift=1cm,align=center,font=LARGEbfseriesboldmath]
at (matX
makeatletter
immediatewrite@mainauxxdefstringmymatbottom-mymatbottomrelax
immediatewrite@mainauxxdefstringmyheightmyheightrelax
immediatewrite@mainauxxdefstringLstMatYShiftsLstMatYShiftsrelax
immediatewrite@mainauxxdefstringLstMatXShiftsLstMatXShiftsrelax
makeatother
newcommandtotalnodes5 % Define the total of subjects that need arrows-1
% From https://tex.stackexchange.com/a/480685/152550
% now add the arrows.
defLstCon%
"2,...,9",%subjects that 0 links
"2,10/5,13/5,14/5",%subjects that 1 links
"11,14",%subjects that 2 links
"10,13,14,25/13",%subjects that 3 links
"36/12,21,29",%subjects that 4 links
foreach X in 0,...,totalnodes
pgfmathsetmacrohuenumX*0.75*(1/totalnodes)
definecolormycolorhsbhuenum,1,1
pgfmathsetmacromylstLstCon[X]
typeoutX:mylst
foreach Y/myalong in mylst
ifxmyalongY
%typeoutX:Y,empty
draw[-latex,mycolor,very thick] (X-Title.east)
to[manoooh curve] (Y-Title.west);
else
%typeoutX:Yspace andspace myalong
draw[-latex,mycolor,very thick] (X-Title.east)
[along node/.list/.expanded=myalong]
to[manoooh curve] (Y-Title.west);
fi
endtikzpicture
endForm
vfill
enddocument
I would like to add a set of checkbox'es from ocgx2
package, where we can set the arrows to "Visible" or "Invisible" that connect two or more subjects:
If we deselect e.g. "Correlatives of subject C" then all the arrows that start from "Subject C" must be changed to "Invisible", so we cannot see them. Also the "Select All" checkbox has to change, meaning that "We have not selected all the checkbox'es" i.e.:
If we deselect all of them:
Note that the "Select All" checkbox is automatically changed due to the user's deselection of all the other checkbox'es.
As expected, the user can select "Select All" to make all the arrows visible. If he deselects it, all the arrows must be invisible.
You can rely on this great example of AlexG's comment:
documentclass[12pt,margin=3pt]standalone
usepackage[tikz]ocgx2 % PDF Layers
usepackageamssymb % checkmark
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% check box command for layer switching
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
newcommandlayerCheckBox[3]%
% #1: layer name (as shown in Layers tab), #2: layer id,
% #3: initial visibility
resizebox2ex!ooalign%
switchocg#2$square$cr%
beginocg#1#2#3$checkmark$endocg%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
begindocument
begintikzpicture
node (a) at (0,0) A;
node (b) at (1,1) B;
beginscope[ocg=name=Arrow,ref=myArrow,status=visible]
draw[->] (a.east) -| (b.south);
endscope
endtikzpicture
layerCheckBoxArrowmyArrowonA$rightarrow$B
enddocument
If possible, the addition of the checkbox'es should be automatic, in the sense that if there is a set of arrows then they will be inserted in a new line of the big black frame.
After the compilation all the checkbox'es have to start "on".
tikz-pgf ocgx2
add a comment |
I have this MWE, taken from marmot's nice answer:
documentclassarticle
usepackage[margin=0in,footskip=0in,paperwidth=60cm,paperheight=29cm]geometry
usepackage[english]babel
usepackage[utf8]inputenc
usepackage[T1]fontenc
usepackagehyperref
usepackagetikz
usetikzlibrarypositioning,fit,calc
pgfdeclarelayerbehind
pgfdeclarelayerbackground
pgfdeclarelayerforeground
pgfsetlayersbehind,background,main,foreground
tikzset
text field/.style=text height=1.5ex,align=center,rounded corners,
nonfillable title field/.style=text height=2ex,text depth=0.3em,anchor=south,text
width=5cm,align=center,font=footnotesizesffamily,
fillable title field/.style=text height=3.14ex,text depth=0em,anchor=south,text
width=5cm,align=center,font=footnotesizesffamily,
pics/fillable subject/.style=code= (-TF.south east)
-- cycle;
draw ([xshift=4pt]-Title.south west) -- ([xshift=-4pt]-Title.south east);
,
pics/nonfillable subject/.style=code=- (-Title.south west)
,
pics/fillable elective subject/.style=code=- (-Title.south west)
,
pics/nonfillable elective subject/.style=code=%
node[text field] (-TF)
hspace1.2em~/~hspace1.15em~/~hspace2.35em;
node[nonfillable title field] (-Title)
at ([yshift=0.4em]-TF.north) ;
draw[rounded corners] (-TF.south west) ,
manoooh/.style=column sep=-1.75cm,row sep=5mm,
manooohE/.style=column sep=-2.25cm,row sep=5mm,anchor=south,
electives/.style=column sep=-7.25cm,row sep=5mm,
fit sep/.initial=4pt, % change width of node (big rectangle shape)
fit dist/.initial=40pt, % change node distance (big rectangle shape)
inlay top sep/.initial=24pt,
matrix top sep/.initial=24pt,
manoooh curve/.style=to path=let p1=($(tikztotarget)-(tikztostart)$)
in (tikztostart) .. controls ($(tikztostart)+(#1*x1,0)$)
and ($(tikztotarget)+(-#1*x1,0)$) .. (tikztotarget),
manoooh curve/.default=0.3,
along node/.style=insert path=
to[out=0,in=180]
([yshift=5pt]#1-Title.north west) -- ([yshift=5pt]#1-Title.north east)
% From https://tex.stackexchange.com/a/478723/152550
makeatletter% from https://tex.stackexchange.com/a/85531/121799
longdefifnodedefined#1#2#3%
@ifundefinedpgf@sh@ns@#1#3#2%
makeatother
begindocument
thispagestyleempty % To suppress page number
noindent
begintikzpicture
fill[white,fill=orange] (0,0) rectangle (paperwidth,-2cm) node[midway,align=center,font=Huge] bfseries Some text here\LARGE More text here;
endtikzpicture
ifdefinedmymatbottom
else
typeoutPleasespace recompilespace yourspace file!
defmymatbottom-150pt
fi
ifdefinedmyheight
else
defmyheight0
typeoutPleasespace recompilespace yourspace file!
fi
ifdefinedLstMatYShifts
else
defLstMatYShifts0pt,0pt,0pt,0pt,0pt,0pt,0pt
fi
ifdefinedLstMatXShifts
else
defLstMatXShifts0pt,0pt,0pt,0pt,0pt,0pt,0pt
fi
%typeoutheight:myheight
%typeoutxshifts(in):LstMatXShifts
vfill
centering
beginForm
begintikzpicture
% step 1: add the matrices, name them mat0, mat1 etc.
beginscope[local bounding box=matrices]
matrix[manoooh] (mat0) at (LstMatXShifts[0],LstMatYShifts[0])
pic[local bounding box=A] (0) nonfillable subject=Subject A; \
pic (1) nonfillable subject=Subject B; \
;
matrix[manoooh] (mat1) at (LstMatXShifts[1],LstMatYShifts[1])
pic (2) nonfillable subject=Subject C; \
pic (3) nonfillable subject=Subject D; \
pic (4) nonfillable subject=Subject E; \
pic (5) nonfillable subject=Subject F; \
pic (6) nonfillable subject=Subject G; \
pic (7) nonfillable subject=Subject H; \
pic (8) nonfillable subject=Subject I; \
pic[draw=red] (9) nonfillable subject=Subject J; \
;
matrix[manoooh] (mat2) at (LstMatXShifts[2],LstMatYShifts[2])
pic[draw=red] (10) nonfillable subject=Subject K; \
pic (11) nonfillable subject=Subject L; \
pic (12) nonfillable subject=Subject A; \
pic (13) nonfillable subject=Subject N; \
pic (14) nonfillable subject=Subject O; \
pic (15) nonfillable subject=Subject P; \
pic (16) nonfillable subject=Subject Q; \
pic (17) nonfillable subject=Subject R; \
;
matrix[manoooh] (mat3) at (LstMatXShifts[3],LstMatYShifts[3])
pic[draw=red] (18) nonfillable subject=Subject S; \
pic (19) nonfillable subject=Subject T; \
pic (20) nonfillable subject=Subject U; \
pic (21) nonfillable subject=Subject V; \
pic (22) nonfillable subject=Subject W; \
pic (23) nonfillable subject=Subject X; \
pic (24) nonfillable subject=Subject Y; \
pic (25) nonfillable subject=Subject Z; \
;
matrix[manooohE] (matE3) at (LstMatXShifts[3],mymatbottom)
pic (L3E1) nonfillable elective subject=Subject; & &
pic (L3E2) nonfillable elective subject=Subject; \
& pic (L3E3) nonfillable elective subject=Subject; & \
;
matrix[manoooh] (mat4) at (LstMatXShifts[4],LstMatYShifts[4])
& pic[draw=red] (26) nonfillable subject=Subject AA; & \
pic (27) nonfillable subject=Subject AB; & & pic (28) nonfillable subject=Subject AC; \
& pic (29) nonfillable subject=Subject AD; & \
& pic (30) nonfillable subject=Subject AE; & \
& pic (31) nonfillable subject=Subject AF; & \
& pic (32) nonfillable subject=Subject AG; & \
;
matrix[manooohE] (matE4) at (LstMatXShifts[4],mymatbottom)
pic (L4E1) nonfillable elective subject=Subject; \
;
matrix[manoooh] (mat5) at (LstMatXShifts[5],LstMatYShifts[5])
pic (33) nonfillable subject=Subject AH; \
pic (34) nonfillable subject=Subject AI; \
pic[draw=red] (35) nonfillable subject=Subject AJ; \
pic (36) nonfillable subject=Subject AK; \
;
matrix[manooohE] (matE5) at (LstMatXShifts[5],mymatbottom)
pic (L5E1) nonfillable elective subject=Subject; \
pic (L5E2) nonfillable elective subject=Subject; \
pic (L5E3) nonfillable elective subject=Subject; \
pic (L5E4) nonfillable elective subject=Subject; \
pic (L5E5) nonfillable elective subject=Subject; \
;
endscope
pgfmathsetmacrogroupwidth0
pgfmathsetmacrolastwidth0
foreach X in 0,...,5 %<- if you have more or less matrices, adjust 3
node[anchor=south,yshift=1cm,align=center,font=LARGEbfseriesboldmath]
at (matX
makeatletter
immediatewrite@mainauxxdefstringmymatbottom-mymatbottomrelax
immediatewrite@mainauxxdefstringmyheightmyheightrelax
immediatewrite@mainauxxdefstringLstMatYShiftsLstMatYShiftsrelax
immediatewrite@mainauxxdefstringLstMatXShiftsLstMatXShiftsrelax
makeatother
newcommandtotalnodes5 % Define the total of subjects that need arrows-1
% From https://tex.stackexchange.com/a/480685/152550
% now add the arrows.
defLstCon%
"2,...,9",%subjects that 0 links
"2,10/5,13/5,14/5",%subjects that 1 links
"11,14",%subjects that 2 links
"10,13,14,25/13",%subjects that 3 links
"36/12,21,29",%subjects that 4 links
foreach X in 0,...,totalnodes
pgfmathsetmacrohuenumX*0.75*(1/totalnodes)
definecolormycolorhsbhuenum,1,1
pgfmathsetmacromylstLstCon[X]
typeoutX:mylst
foreach Y/myalong in mylst
ifxmyalongY
%typeoutX:Y,empty
draw[-latex,mycolor,very thick] (X-Title.east)
to[manoooh curve] (Y-Title.west);
else
%typeoutX:Yspace andspace myalong
draw[-latex,mycolor,very thick] (X-Title.east)
[along node/.list/.expanded=myalong]
to[manoooh curve] (Y-Title.west);
fi
endtikzpicture
endForm
vfill
enddocument
I would like to add a set of checkbox'es from ocgx2
package, where we can set the arrows to "Visible" or "Invisible" that connect two or more subjects:
If we deselect e.g. "Correlatives of subject C" then all the arrows that start from "Subject C" must be changed to "Invisible", so we cannot see them. Also the "Select All" checkbox has to change, meaning that "We have not selected all the checkbox'es" i.e.:
If we deselect all of them:
Note that the "Select All" checkbox is automatically changed due to the user's deselection of all the other checkbox'es.
As expected, the user can select "Select All" to make all the arrows visible. If he deselects it, all the arrows must be invisible.
You can rely on this great example of AlexG's comment:
documentclass[12pt,margin=3pt]standalone
usepackage[tikz]ocgx2 % PDF Layers
usepackageamssymb % checkmark
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% check box command for layer switching
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
newcommandlayerCheckBox[3]%
% #1: layer name (as shown in Layers tab), #2: layer id,
% #3: initial visibility
resizebox2ex!ooalign%
switchocg#2$square$cr%
beginocg#1#2#3$checkmark$endocg%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
begindocument
begintikzpicture
node (a) at (0,0) A;
node (b) at (1,1) B;
beginscope[ocg=name=Arrow,ref=myArrow,status=visible]
draw[->] (a.east) -| (b.south);
endscope
endtikzpicture
layerCheckBoxArrowmyArrowonA$rightarrow$B
enddocument
If possible, the addition of the checkbox'es should be automatic, in the sense that if there is a set of arrows then they will be inserted in a new line of the big black frame.
After the compilation all the checkbox'es have to start "on".
tikz-pgf ocgx2
I have this MWE, taken from marmot's nice answer:
documentclassarticle
usepackage[margin=0in,footskip=0in,paperwidth=60cm,paperheight=29cm]geometry
usepackage[english]babel
usepackage[utf8]inputenc
usepackage[T1]fontenc
usepackagehyperref
usepackagetikz
usetikzlibrarypositioning,fit,calc
pgfdeclarelayerbehind
pgfdeclarelayerbackground
pgfdeclarelayerforeground
pgfsetlayersbehind,background,main,foreground
tikzset
text field/.style=text height=1.5ex,align=center,rounded corners,
nonfillable title field/.style=text height=2ex,text depth=0.3em,anchor=south,text
width=5cm,align=center,font=footnotesizesffamily,
fillable title field/.style=text height=3.14ex,text depth=0em,anchor=south,text
width=5cm,align=center,font=footnotesizesffamily,
pics/fillable subject/.style=code= (-TF.south east)
-- cycle;
draw ([xshift=4pt]-Title.south west) -- ([xshift=-4pt]-Title.south east);
,
pics/nonfillable subject/.style=code=- (-Title.south west)
,
pics/fillable elective subject/.style=code=- (-Title.south west)
,
pics/nonfillable elective subject/.style=code=%
node[text field] (-TF)
hspace1.2em~/~hspace1.15em~/~hspace2.35em;
node[nonfillable title field] (-Title)
at ([yshift=0.4em]-TF.north) ;
draw[rounded corners] (-TF.south west) ,
manoooh/.style=column sep=-1.75cm,row sep=5mm,
manooohE/.style=column sep=-2.25cm,row sep=5mm,anchor=south,
electives/.style=column sep=-7.25cm,row sep=5mm,
fit sep/.initial=4pt, % change width of node (big rectangle shape)
fit dist/.initial=40pt, % change node distance (big rectangle shape)
inlay top sep/.initial=24pt,
matrix top sep/.initial=24pt,
manoooh curve/.style=to path=let p1=($(tikztotarget)-(tikztostart)$)
in (tikztostart) .. controls ($(tikztostart)+(#1*x1,0)$)
and ($(tikztotarget)+(-#1*x1,0)$) .. (tikztotarget),
manoooh curve/.default=0.3,
along node/.style=insert path=
to[out=0,in=180]
([yshift=5pt]#1-Title.north west) -- ([yshift=5pt]#1-Title.north east)
% From https://tex.stackexchange.com/a/478723/152550
makeatletter% from https://tex.stackexchange.com/a/85531/121799
longdefifnodedefined#1#2#3%
@ifundefinedpgf@sh@ns@#1#3#2%
makeatother
begindocument
thispagestyleempty % To suppress page number
noindent
begintikzpicture
fill[white,fill=orange] (0,0) rectangle (paperwidth,-2cm) node[midway,align=center,font=Huge] bfseries Some text here\LARGE More text here;
endtikzpicture
ifdefinedmymatbottom
else
typeoutPleasespace recompilespace yourspace file!
defmymatbottom-150pt
fi
ifdefinedmyheight
else
defmyheight0
typeoutPleasespace recompilespace yourspace file!
fi
ifdefinedLstMatYShifts
else
defLstMatYShifts0pt,0pt,0pt,0pt,0pt,0pt,0pt
fi
ifdefinedLstMatXShifts
else
defLstMatXShifts0pt,0pt,0pt,0pt,0pt,0pt,0pt
fi
%typeoutheight:myheight
%typeoutxshifts(in):LstMatXShifts
vfill
centering
beginForm
begintikzpicture
% step 1: add the matrices, name them mat0, mat1 etc.
beginscope[local bounding box=matrices]
matrix[manoooh] (mat0) at (LstMatXShifts[0],LstMatYShifts[0])
pic[local bounding box=A] (0) nonfillable subject=Subject A; \
pic (1) nonfillable subject=Subject B; \
;
matrix[manoooh] (mat1) at (LstMatXShifts[1],LstMatYShifts[1])
pic (2) nonfillable subject=Subject C; \
pic (3) nonfillable subject=Subject D; \
pic (4) nonfillable subject=Subject E; \
pic (5) nonfillable subject=Subject F; \
pic (6) nonfillable subject=Subject G; \
pic (7) nonfillable subject=Subject H; \
pic (8) nonfillable subject=Subject I; \
pic[draw=red] (9) nonfillable subject=Subject J; \
;
matrix[manoooh] (mat2) at (LstMatXShifts[2],LstMatYShifts[2])
pic[draw=red] (10) nonfillable subject=Subject K; \
pic (11) nonfillable subject=Subject L; \
pic (12) nonfillable subject=Subject A; \
pic (13) nonfillable subject=Subject N; \
pic (14) nonfillable subject=Subject O; \
pic (15) nonfillable subject=Subject P; \
pic (16) nonfillable subject=Subject Q; \
pic (17) nonfillable subject=Subject R; \
;
matrix[manoooh] (mat3) at (LstMatXShifts[3],LstMatYShifts[3])
pic[draw=red] (18) nonfillable subject=Subject S; \
pic (19) nonfillable subject=Subject T; \
pic (20) nonfillable subject=Subject U; \
pic (21) nonfillable subject=Subject V; \
pic (22) nonfillable subject=Subject W; \
pic (23) nonfillable subject=Subject X; \
pic (24) nonfillable subject=Subject Y; \
pic (25) nonfillable subject=Subject Z; \
;
matrix[manooohE] (matE3) at (LstMatXShifts[3],mymatbottom)
pic (L3E1) nonfillable elective subject=Subject; & &
pic (L3E2) nonfillable elective subject=Subject; \
& pic (L3E3) nonfillable elective subject=Subject; & \
;
matrix[manoooh] (mat4) at (LstMatXShifts[4],LstMatYShifts[4])
& pic[draw=red] (26) nonfillable subject=Subject AA; & \
pic (27) nonfillable subject=Subject AB; & & pic (28) nonfillable subject=Subject AC; \
& pic (29) nonfillable subject=Subject AD; & \
& pic (30) nonfillable subject=Subject AE; & \
& pic (31) nonfillable subject=Subject AF; & \
& pic (32) nonfillable subject=Subject AG; & \
;
matrix[manooohE] (matE4) at (LstMatXShifts[4],mymatbottom)
pic (L4E1) nonfillable elective subject=Subject; \
;
matrix[manoooh] (mat5) at (LstMatXShifts[5],LstMatYShifts[5])
pic (33) nonfillable subject=Subject AH; \
pic (34) nonfillable subject=Subject AI; \
pic[draw=red] (35) nonfillable subject=Subject AJ; \
pic (36) nonfillable subject=Subject AK; \
;
matrix[manooohE] (matE5) at (LstMatXShifts[5],mymatbottom)
pic (L5E1) nonfillable elective subject=Subject; \
pic (L5E2) nonfillable elective subject=Subject; \
pic (L5E3) nonfillable elective subject=Subject; \
pic (L5E4) nonfillable elective subject=Subject; \
pic (L5E5) nonfillable elective subject=Subject; \
;
endscope
pgfmathsetmacrogroupwidth0
pgfmathsetmacrolastwidth0
foreach X in 0,...,5 %<- if you have more or less matrices, adjust 3
node[anchor=south,yshift=1cm,align=center,font=LARGEbfseriesboldmath]
at (matX
makeatletter
immediatewrite@mainauxxdefstringmymatbottom-mymatbottomrelax
immediatewrite@mainauxxdefstringmyheightmyheightrelax
immediatewrite@mainauxxdefstringLstMatYShiftsLstMatYShiftsrelax
immediatewrite@mainauxxdefstringLstMatXShiftsLstMatXShiftsrelax
makeatother
newcommandtotalnodes5 % Define the total of subjects that need arrows-1
% From https://tex.stackexchange.com/a/480685/152550
% now add the arrows.
defLstCon%
"2,...,9",%subjects that 0 links
"2,10/5,13/5,14/5",%subjects that 1 links
"11,14",%subjects that 2 links
"10,13,14,25/13",%subjects that 3 links
"36/12,21,29",%subjects that 4 links
foreach X in 0,...,totalnodes
pgfmathsetmacrohuenumX*0.75*(1/totalnodes)
definecolormycolorhsbhuenum,1,1
pgfmathsetmacromylstLstCon[X]
typeoutX:mylst
foreach Y/myalong in mylst
ifxmyalongY
%typeoutX:Y,empty
draw[-latex,mycolor,very thick] (X-Title.east)
to[manoooh curve] (Y-Title.west);
else
%typeoutX:Yspace andspace myalong
draw[-latex,mycolor,very thick] (X-Title.east)
[along node/.list/.expanded=myalong]
to[manoooh curve] (Y-Title.west);
fi
endtikzpicture
endForm
vfill
enddocument
I would like to add a set of checkbox'es from ocgx2
package, where we can set the arrows to "Visible" or "Invisible" that connect two or more subjects:
If we deselect e.g. "Correlatives of subject C" then all the arrows that start from "Subject C" must be changed to "Invisible", so we cannot see them. Also the "Select All" checkbox has to change, meaning that "We have not selected all the checkbox'es" i.e.:
If we deselect all of them:
Note that the "Select All" checkbox is automatically changed due to the user's deselection of all the other checkbox'es.
As expected, the user can select "Select All" to make all the arrows visible. If he deselects it, all the arrows must be invisible.
You can rely on this great example of AlexG's comment:
documentclass[12pt,margin=3pt]standalone
usepackage[tikz]ocgx2 % PDF Layers
usepackageamssymb % checkmark
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% check box command for layer switching
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
newcommandlayerCheckBox[3]%
% #1: layer name (as shown in Layers tab), #2: layer id,
% #3: initial visibility
resizebox2ex!ooalign%
switchocg#2$square$cr%
beginocg#1#2#3$checkmark$endocg%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
begindocument
begintikzpicture
node (a) at (0,0) A;
node (b) at (1,1) B;
beginscope[ocg=name=Arrow,ref=myArrow,status=visible]
draw[->] (a.east) -| (b.south);
endscope
endtikzpicture
layerCheckBoxArrowmyArrowonA$rightarrow$B
enddocument
If possible, the addition of the checkbox'es should be automatic, in the sense that if there is a set of arrows then they will be inserted in a new line of the big black frame.
After the compilation all the checkbox'es have to start "on".
tikz-pgf ocgx2
tikz-pgf ocgx2
asked 4 mins ago
manoooohmanooooh
1,1691517
1,1691517
add a comment |
add a comment |
0
active
oldest
votes
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%2f481812%2fcreating-a-lot-of-checkboxes-to-make-visible-invisible-arrows-using-tikzpictur%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
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%2f481812%2fcreating-a-lot-of-checkboxes-to-make-visible-invisible-arrows-using-tikzpictur%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