Create custom shape with holes
up vote
5
down vote
favorite
I'd like to create a key shape symbol using PSTricks, but I have some problems filling it...
Here's the shape I'd like :
documentclass[pstricks, float]{standalone}
usepackage[table, usenames, dvipsnames]{xcolor}
usepackage{pstricks, pst-node, pst-circ, pst-plot,
pst-3dplot,pst-solides3d, pst-sigsys, pstricks-add,pst-eucl}
begin{document}
begin{pspicture}[labelangle=:U, showgrid=true](-3, -3)(5, 3)
pscustom[fillstyle=solid, fillcolor=green]{
psarc{-}(0.2, 0){0.8}{25}{346} % Exterior disk
pscircle[linewidth=2pt](0, 0){0.25} % Hole
psline{-}(0.9250, 0.3380)(3, 0.3380)(3.3, 0)(3, -0.3420)(2.8, -0.3420)
(2.8, -0.3420)(2.65, -0.1920)(2.55, -0.3420)(2.45, -0.1920)(2.25, -0.4920)
(2.15, -0.3420)(2.05, -0.4920)(1.95, -0.3420)(1.85, -0.4920)(1.65, -0.1920)
(1.55, -0.3420)(1.45, -0.1920)(1.25, -0.4920)(1.05, -0.1935)(0.9762, -0.1935)
}
end{pspicture}
end{document}
But the pscustom doesn't work as expected.
Here's the result :

I have thus two problems :
- Create a closed shape with the
psarcand thepsline
- Scoop the
pscircleout of the shape
I haven't find the commands in the user's manual that allows me to do so, and I hope I'm wrong...
Besides, that I'd like to turn the key shape into a new PS object, let's say a psKey, that could be filled, linestyle-d, and so on... I know it's about the makeatletter and makeatother but I could get proper results...
Is this structure wrong ? Should I save it as psKey.tex ?
makeatletter
deftor(#1){%
rput(#1){%
%
% Code lines of the key drawing
%
}
}
makeatother
pstricks
add a comment |
up vote
5
down vote
favorite
I'd like to create a key shape symbol using PSTricks, but I have some problems filling it...
Here's the shape I'd like :
documentclass[pstricks, float]{standalone}
usepackage[table, usenames, dvipsnames]{xcolor}
usepackage{pstricks, pst-node, pst-circ, pst-plot,
pst-3dplot,pst-solides3d, pst-sigsys, pstricks-add,pst-eucl}
begin{document}
begin{pspicture}[labelangle=:U, showgrid=true](-3, -3)(5, 3)
pscustom[fillstyle=solid, fillcolor=green]{
psarc{-}(0.2, 0){0.8}{25}{346} % Exterior disk
pscircle[linewidth=2pt](0, 0){0.25} % Hole
psline{-}(0.9250, 0.3380)(3, 0.3380)(3.3, 0)(3, -0.3420)(2.8, -0.3420)
(2.8, -0.3420)(2.65, -0.1920)(2.55, -0.3420)(2.45, -0.1920)(2.25, -0.4920)
(2.15, -0.3420)(2.05, -0.4920)(1.95, -0.3420)(1.85, -0.4920)(1.65, -0.1920)
(1.55, -0.3420)(1.45, -0.1920)(1.25, -0.4920)(1.05, -0.1935)(0.9762, -0.1935)
}
end{pspicture}
end{document}
But the pscustom doesn't work as expected.
Here's the result :

I have thus two problems :
- Create a closed shape with the
psarcand thepsline
- Scoop the
pscircleout of the shape
I haven't find the commands in the user's manual that allows me to do so, and I hope I'm wrong...
Besides, that I'd like to turn the key shape into a new PS object, let's say a psKey, that could be filled, linestyle-d, and so on... I know it's about the makeatletter and makeatother but I could get proper results...
Is this structure wrong ? Should I save it as psKey.tex ?
makeatletter
deftor(#1){%
rput(#1){%
%
% Code lines of the key drawing
%
}
}
makeatother
pstricks
add a comment |
up vote
5
down vote
favorite
up vote
5
down vote
favorite
I'd like to create a key shape symbol using PSTricks, but I have some problems filling it...
Here's the shape I'd like :
documentclass[pstricks, float]{standalone}
usepackage[table, usenames, dvipsnames]{xcolor}
usepackage{pstricks, pst-node, pst-circ, pst-plot,
pst-3dplot,pst-solides3d, pst-sigsys, pstricks-add,pst-eucl}
begin{document}
begin{pspicture}[labelangle=:U, showgrid=true](-3, -3)(5, 3)
pscustom[fillstyle=solid, fillcolor=green]{
psarc{-}(0.2, 0){0.8}{25}{346} % Exterior disk
pscircle[linewidth=2pt](0, 0){0.25} % Hole
psline{-}(0.9250, 0.3380)(3, 0.3380)(3.3, 0)(3, -0.3420)(2.8, -0.3420)
(2.8, -0.3420)(2.65, -0.1920)(2.55, -0.3420)(2.45, -0.1920)(2.25, -0.4920)
(2.15, -0.3420)(2.05, -0.4920)(1.95, -0.3420)(1.85, -0.4920)(1.65, -0.1920)
(1.55, -0.3420)(1.45, -0.1920)(1.25, -0.4920)(1.05, -0.1935)(0.9762, -0.1935)
}
end{pspicture}
end{document}
But the pscustom doesn't work as expected.
Here's the result :

I have thus two problems :
- Create a closed shape with the
psarcand thepsline
- Scoop the
pscircleout of the shape
I haven't find the commands in the user's manual that allows me to do so, and I hope I'm wrong...
Besides, that I'd like to turn the key shape into a new PS object, let's say a psKey, that could be filled, linestyle-d, and so on... I know it's about the makeatletter and makeatother but I could get proper results...
Is this structure wrong ? Should I save it as psKey.tex ?
makeatletter
deftor(#1){%
rput(#1){%
%
% Code lines of the key drawing
%
}
}
makeatother
pstricks
I'd like to create a key shape symbol using PSTricks, but I have some problems filling it...
Here's the shape I'd like :
documentclass[pstricks, float]{standalone}
usepackage[table, usenames, dvipsnames]{xcolor}
usepackage{pstricks, pst-node, pst-circ, pst-plot,
pst-3dplot,pst-solides3d, pst-sigsys, pstricks-add,pst-eucl}
begin{document}
begin{pspicture}[labelangle=:U, showgrid=true](-3, -3)(5, 3)
pscustom[fillstyle=solid, fillcolor=green]{
psarc{-}(0.2, 0){0.8}{25}{346} % Exterior disk
pscircle[linewidth=2pt](0, 0){0.25} % Hole
psline{-}(0.9250, 0.3380)(3, 0.3380)(3.3, 0)(3, -0.3420)(2.8, -0.3420)
(2.8, -0.3420)(2.65, -0.1920)(2.55, -0.3420)(2.45, -0.1920)(2.25, -0.4920)
(2.15, -0.3420)(2.05, -0.4920)(1.95, -0.3420)(1.85, -0.4920)(1.65, -0.1920)
(1.55, -0.3420)(1.45, -0.1920)(1.25, -0.4920)(1.05, -0.1935)(0.9762, -0.1935)
}
end{pspicture}
end{document}
But the pscustom doesn't work as expected.
Here's the result :

I have thus two problems :
- Create a closed shape with the
psarcand thepsline
- Scoop the
pscircleout of the shape
I haven't find the commands in the user's manual that allows me to do so, and I hope I'm wrong...
Besides, that I'd like to turn the key shape into a new PS object, let's say a psKey, that could be filled, linestyle-d, and so on... I know it's about the makeatletter and makeatother but I could get proper results...
Is this structure wrong ? Should I save it as psKey.tex ?
makeatletter
deftor(#1){%
rput(#1){%
%
% Code lines of the key drawing
%
}
}
makeatother
pstricks
pstricks
asked Sep 23 '15 at 11:37
EisenHeim
1,0291721
1,0291721
add a comment |
add a comment |
3 Answers
3
active
oldest
votes
up vote
5
down vote
accepted
documentclass[pstricks]{standalone}
usepackage{pstricks-add}
begin{document}
begin{pspicture}[showgrid=true](-3, -3)(5, 3)
pscustom[fillstyle=solid, fillcolor=green]{
psarcn(0.2, 0){0.8}{346}{25} % Exterior disk
psline(3, 0.3380)(3.3, 0)(3, -0.3420)(2.8, -0.3420)
(2.8, -0.3420)(2.65, -0.1920)(2.55, -0.3420)(2.45, -0.1920)(2.25, -0.4920)
(2.15, -0.3420)(2.05, -0.4920)(1.95, -0.3420)(1.85, -0.4920)(1.65, -0.1920)
(1.55, -0.3420)(1.45, -0.1920)(1.25, -0.4920)(1.05, -0.1935)(0.9762, -0.1935)
pscircle[linewidth=2pt](0, 0){0.25} % Hole
}
end{pspicture}
end{document}

For creating a new macro for this look into pstricks-add there you'll find a lot of examples, like this one:
documentclass[pstricks]{standalone}
usepackage{pstricks-add}
makeatletter
defpstKey{pst@object{pstKey}}
defpstKey@i{@ifnextchar({pstKey@ii{0}}pstKey@ii}
defpstKey@ii#1(#2){%
addbefore@par{fillstyle=solid, fillcolor=green}%
begingroup
use@par
rput{#1}(#2){%
pscustom{
psarcn(0.2, 0){0.8}{346}{25} % Exterior disk
psline(3, 0.3380)(3.3, 0)(3, -0.3420)(2.8, -0.3420)
(2.8, -0.3420)(2.65, -0.1920)(2.55, -0.3420)(2.45, -0.1920)(2.25, -0.4920)
(2.15, -0.3420)(2.05, -0.4920)(1.95, -0.3420)(1.85, -0.4920)(1.65, -0.1920)
(1.55, -0.3420)(1.45, -0.1920)(1.25, -0.4920)(1.05, -0.1935)(0.9762, -0.1935)
pscircle[linewidth=2pt](0, 0){0.25} % Hole
}}%
endgroupignorespaces
}
makeatother
begin{document}
begin{pspicture}[showgrid=true](-3, -3)(5, 3)
pstKey(0,0)
pstKey[fillcolor=red,opacity=0.5]{90}(2,-2)
end{pspicture}
end{document}

And with a scaling option:
documentclass[pstricks]{standalone}
usepackage{pstricks-add}
makeatletter
defpstKey{pst@object{pstKey}}
defpstKey@i{@ifnextchar({pstKey@ii{0}}pstKey@ii}
defpstKey@ii#1(#2){%
addbefore@par{fillstyle=solid, fillcolor=green}%
begingroup
use@par
rput{#1}(#2){psscalebox{psk@psscale}{%
pscustom{
psarcn(0.2, 0){0.8}{346}{25} % Exterior disk
psline(3, 0.3380)(3.3, 0)(3, -0.3420)(2.8, -0.3420)
(2.8, -0.3420)(2.65, -0.1920)(2.55, -0.3420)(2.45, -0.1920)(2.25, -0.4920)
(2.15, -0.3420)(2.05, -0.4920)(1.95, -0.3420)(1.85, -0.4920)(1.65, -0.1920)
(1.55, -0.3420)(1.45, -0.1920)(1.25, -0.4920)(1.05, -0.1935)(0.9762, -0.1935)
pscircle[linewidth=2pt](0, 0){0.25} % Hole
}}}%
endgroupignorespaces
}
makeatother
begin{document}
begin{pspicture}[bgcolor=yellow!30](-3, -3)(5, 3)
pstKey(0,0)
pstKey[fillcolor=red,psscale=0.5,opacity=0.5]{90}(2,-1)
end{pspicture}
end{document}

Awesome, thanks ! And How can I turn this marvel into asymbol?
– EisenHeim
Sep 23 '15 at 12:20
1
as I already wrote, have a look into pst-platon or pst-fractal. There are a lot of examples.
– Herbert
Sep 23 '15 at 12:50
OK, thanks. Actually, I though you quotedpstricks-addfor the pscustom, not for the symbol. Sorry for the misunderstanding.
– EisenHeim
Sep 23 '15 at 13:13
1
see edited answer
– Herbert
Sep 23 '15 at 14:23
1
addbefore@par{...,linestyle=solid,linearc=0}
– Herbert
Sep 23 '15 at 16:10
|
show 5 more comments
up vote
1
down vote
The trick is to add the inner circle outside the pscustom.
I defined a pstKey command through several lists of empty nodes, so as to ease the modification of parameters. pstKey can be placed anywhere and rotated, with rput.
documentclass[float]{standalone}%
PassOptionsToPackage{table, dvipsnames, x11names}{xcolor}
usepackage{pstricks-add, pst-circ, pst-3dplot, pst-solides3d,pst-eucl}%, pst-sigsys
usepackage{auto-pst-pdf}
newcommandpstKey{pnodes{U}(3.3, 0)(3, 0.3380)(0.9250, 0.3380)%
pnodes{b}(0.9762, -0.1935)(1.05, -0.1935)(1.45, -0.1920)(1.65, -0.1920)(2.45, -0.1920)(2.65, -0.1920)
pnodes{m}(1.55, -0.3420)(1.95, -0.3420)(2.15, -0.3420)(2.55, -0.3420)(2.8, -0.3420)(3, -0.3420)
pnodes{B}(1.25, -0.4920)(1.85, -0.4920)(2.05, -0.4920)(2.25, -0.4920)
%
pscustom[fillstyle=solid, fillcolor=Gold4!40! HoneyDew4, opacity =0.65, linejoin =1]{%
psline(U0)(U1)(U2)
psarc(0.2, 0){0.8}{25}{346} % Exterior disk
psline(b0)(b1)(B0)(b2)(m0)(b3)(B1)(m1)(B2)(m2)(B3)(b4)(m3)(b5)(m4)(m5)(U0)
}
pscircle[linewidth=2pt, fillstyle=solid, fillcolor=white](0, 0){0.25}% Hole
}%
begin{document}
begin{pspicture}[labelangle=:U, showgrid=true](-3, -3)(5, 3)%
rput{-30}(1,1){pstKey}
end{pspicture}
end{document}

1
change the background color and the inner circle will still be filled with white instead of the background.
– Herbert
Sep 23 '15 at 14:29
That's what I did first and it didn't work. I guess I mixed up in various modifications of the O.P.'s code. Thank you, Herbert!
– Bernard
Sep 23 '15 at 14:39
add a comment |
up vote
0
down vote
List of changes:
- replace the last point with
closepathto fix the discontinuity at that point (it is noticeable for thicklinewidth). - move
linewidth=2pttopscustomaslinewidthdeclared insidepscustomdoes not take any effect. - remove the center of the last circle.
- use 2 decimal points for literal numbers.
- remove unnecessary
pstricks-add. - reduce the canvas size.
documentclass[pstricks]{standalone}
begin{document}
begin{pspicture}[showgrid=true](-1,-1)(4, 1)
pscustom[fillstyle=solid,fillcolor=green,linewidth=2pt]{
psarcn(0.2,0){0.8}{346}{25}
psline(3,0.33)(3.3,0)(3,-0.34)(2.8,-0.34)
(2.8,-0.34)(2.65,-0.19)(2.55,-0.34)(2.45,-0.19)(2.25,-0.49)
(2.15,-0.34)(2.05,-0.49)(1.95,-0.34)(1.85,-0.49)(1.65,-0.19)
(1.55,-0.34)(1.45,-0.19)(1.25,-0.49)(1.05,-0.19)%(0.9762,-0.1935)
closepath
pscircle{0.25}
}
end{pspicture}
end{document}

add a comment |
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
5
down vote
accepted
documentclass[pstricks]{standalone}
usepackage{pstricks-add}
begin{document}
begin{pspicture}[showgrid=true](-3, -3)(5, 3)
pscustom[fillstyle=solid, fillcolor=green]{
psarcn(0.2, 0){0.8}{346}{25} % Exterior disk
psline(3, 0.3380)(3.3, 0)(3, -0.3420)(2.8, -0.3420)
(2.8, -0.3420)(2.65, -0.1920)(2.55, -0.3420)(2.45, -0.1920)(2.25, -0.4920)
(2.15, -0.3420)(2.05, -0.4920)(1.95, -0.3420)(1.85, -0.4920)(1.65, -0.1920)
(1.55, -0.3420)(1.45, -0.1920)(1.25, -0.4920)(1.05, -0.1935)(0.9762, -0.1935)
pscircle[linewidth=2pt](0, 0){0.25} % Hole
}
end{pspicture}
end{document}

For creating a new macro for this look into pstricks-add there you'll find a lot of examples, like this one:
documentclass[pstricks]{standalone}
usepackage{pstricks-add}
makeatletter
defpstKey{pst@object{pstKey}}
defpstKey@i{@ifnextchar({pstKey@ii{0}}pstKey@ii}
defpstKey@ii#1(#2){%
addbefore@par{fillstyle=solid, fillcolor=green}%
begingroup
use@par
rput{#1}(#2){%
pscustom{
psarcn(0.2, 0){0.8}{346}{25} % Exterior disk
psline(3, 0.3380)(3.3, 0)(3, -0.3420)(2.8, -0.3420)
(2.8, -0.3420)(2.65, -0.1920)(2.55, -0.3420)(2.45, -0.1920)(2.25, -0.4920)
(2.15, -0.3420)(2.05, -0.4920)(1.95, -0.3420)(1.85, -0.4920)(1.65, -0.1920)
(1.55, -0.3420)(1.45, -0.1920)(1.25, -0.4920)(1.05, -0.1935)(0.9762, -0.1935)
pscircle[linewidth=2pt](0, 0){0.25} % Hole
}}%
endgroupignorespaces
}
makeatother
begin{document}
begin{pspicture}[showgrid=true](-3, -3)(5, 3)
pstKey(0,0)
pstKey[fillcolor=red,opacity=0.5]{90}(2,-2)
end{pspicture}
end{document}

And with a scaling option:
documentclass[pstricks]{standalone}
usepackage{pstricks-add}
makeatletter
defpstKey{pst@object{pstKey}}
defpstKey@i{@ifnextchar({pstKey@ii{0}}pstKey@ii}
defpstKey@ii#1(#2){%
addbefore@par{fillstyle=solid, fillcolor=green}%
begingroup
use@par
rput{#1}(#2){psscalebox{psk@psscale}{%
pscustom{
psarcn(0.2, 0){0.8}{346}{25} % Exterior disk
psline(3, 0.3380)(3.3, 0)(3, -0.3420)(2.8, -0.3420)
(2.8, -0.3420)(2.65, -0.1920)(2.55, -0.3420)(2.45, -0.1920)(2.25, -0.4920)
(2.15, -0.3420)(2.05, -0.4920)(1.95, -0.3420)(1.85, -0.4920)(1.65, -0.1920)
(1.55, -0.3420)(1.45, -0.1920)(1.25, -0.4920)(1.05, -0.1935)(0.9762, -0.1935)
pscircle[linewidth=2pt](0, 0){0.25} % Hole
}}}%
endgroupignorespaces
}
makeatother
begin{document}
begin{pspicture}[bgcolor=yellow!30](-3, -3)(5, 3)
pstKey(0,0)
pstKey[fillcolor=red,psscale=0.5,opacity=0.5]{90}(2,-1)
end{pspicture}
end{document}

Awesome, thanks ! And How can I turn this marvel into asymbol?
– EisenHeim
Sep 23 '15 at 12:20
1
as I already wrote, have a look into pst-platon or pst-fractal. There are a lot of examples.
– Herbert
Sep 23 '15 at 12:50
OK, thanks. Actually, I though you quotedpstricks-addfor the pscustom, not for the symbol. Sorry for the misunderstanding.
– EisenHeim
Sep 23 '15 at 13:13
1
see edited answer
– Herbert
Sep 23 '15 at 14:23
1
addbefore@par{...,linestyle=solid,linearc=0}
– Herbert
Sep 23 '15 at 16:10
|
show 5 more comments
up vote
5
down vote
accepted
documentclass[pstricks]{standalone}
usepackage{pstricks-add}
begin{document}
begin{pspicture}[showgrid=true](-3, -3)(5, 3)
pscustom[fillstyle=solid, fillcolor=green]{
psarcn(0.2, 0){0.8}{346}{25} % Exterior disk
psline(3, 0.3380)(3.3, 0)(3, -0.3420)(2.8, -0.3420)
(2.8, -0.3420)(2.65, -0.1920)(2.55, -0.3420)(2.45, -0.1920)(2.25, -0.4920)
(2.15, -0.3420)(2.05, -0.4920)(1.95, -0.3420)(1.85, -0.4920)(1.65, -0.1920)
(1.55, -0.3420)(1.45, -0.1920)(1.25, -0.4920)(1.05, -0.1935)(0.9762, -0.1935)
pscircle[linewidth=2pt](0, 0){0.25} % Hole
}
end{pspicture}
end{document}

For creating a new macro for this look into pstricks-add there you'll find a lot of examples, like this one:
documentclass[pstricks]{standalone}
usepackage{pstricks-add}
makeatletter
defpstKey{pst@object{pstKey}}
defpstKey@i{@ifnextchar({pstKey@ii{0}}pstKey@ii}
defpstKey@ii#1(#2){%
addbefore@par{fillstyle=solid, fillcolor=green}%
begingroup
use@par
rput{#1}(#2){%
pscustom{
psarcn(0.2, 0){0.8}{346}{25} % Exterior disk
psline(3, 0.3380)(3.3, 0)(3, -0.3420)(2.8, -0.3420)
(2.8, -0.3420)(2.65, -0.1920)(2.55, -0.3420)(2.45, -0.1920)(2.25, -0.4920)
(2.15, -0.3420)(2.05, -0.4920)(1.95, -0.3420)(1.85, -0.4920)(1.65, -0.1920)
(1.55, -0.3420)(1.45, -0.1920)(1.25, -0.4920)(1.05, -0.1935)(0.9762, -0.1935)
pscircle[linewidth=2pt](0, 0){0.25} % Hole
}}%
endgroupignorespaces
}
makeatother
begin{document}
begin{pspicture}[showgrid=true](-3, -3)(5, 3)
pstKey(0,0)
pstKey[fillcolor=red,opacity=0.5]{90}(2,-2)
end{pspicture}
end{document}

And with a scaling option:
documentclass[pstricks]{standalone}
usepackage{pstricks-add}
makeatletter
defpstKey{pst@object{pstKey}}
defpstKey@i{@ifnextchar({pstKey@ii{0}}pstKey@ii}
defpstKey@ii#1(#2){%
addbefore@par{fillstyle=solid, fillcolor=green}%
begingroup
use@par
rput{#1}(#2){psscalebox{psk@psscale}{%
pscustom{
psarcn(0.2, 0){0.8}{346}{25} % Exterior disk
psline(3, 0.3380)(3.3, 0)(3, -0.3420)(2.8, -0.3420)
(2.8, -0.3420)(2.65, -0.1920)(2.55, -0.3420)(2.45, -0.1920)(2.25, -0.4920)
(2.15, -0.3420)(2.05, -0.4920)(1.95, -0.3420)(1.85, -0.4920)(1.65, -0.1920)
(1.55, -0.3420)(1.45, -0.1920)(1.25, -0.4920)(1.05, -0.1935)(0.9762, -0.1935)
pscircle[linewidth=2pt](0, 0){0.25} % Hole
}}}%
endgroupignorespaces
}
makeatother
begin{document}
begin{pspicture}[bgcolor=yellow!30](-3, -3)(5, 3)
pstKey(0,0)
pstKey[fillcolor=red,psscale=0.5,opacity=0.5]{90}(2,-1)
end{pspicture}
end{document}

Awesome, thanks ! And How can I turn this marvel into asymbol?
– EisenHeim
Sep 23 '15 at 12:20
1
as I already wrote, have a look into pst-platon or pst-fractal. There are a lot of examples.
– Herbert
Sep 23 '15 at 12:50
OK, thanks. Actually, I though you quotedpstricks-addfor the pscustom, not for the symbol. Sorry for the misunderstanding.
– EisenHeim
Sep 23 '15 at 13:13
1
see edited answer
– Herbert
Sep 23 '15 at 14:23
1
addbefore@par{...,linestyle=solid,linearc=0}
– Herbert
Sep 23 '15 at 16:10
|
show 5 more comments
up vote
5
down vote
accepted
up vote
5
down vote
accepted
documentclass[pstricks]{standalone}
usepackage{pstricks-add}
begin{document}
begin{pspicture}[showgrid=true](-3, -3)(5, 3)
pscustom[fillstyle=solid, fillcolor=green]{
psarcn(0.2, 0){0.8}{346}{25} % Exterior disk
psline(3, 0.3380)(3.3, 0)(3, -0.3420)(2.8, -0.3420)
(2.8, -0.3420)(2.65, -0.1920)(2.55, -0.3420)(2.45, -0.1920)(2.25, -0.4920)
(2.15, -0.3420)(2.05, -0.4920)(1.95, -0.3420)(1.85, -0.4920)(1.65, -0.1920)
(1.55, -0.3420)(1.45, -0.1920)(1.25, -0.4920)(1.05, -0.1935)(0.9762, -0.1935)
pscircle[linewidth=2pt](0, 0){0.25} % Hole
}
end{pspicture}
end{document}

For creating a new macro for this look into pstricks-add there you'll find a lot of examples, like this one:
documentclass[pstricks]{standalone}
usepackage{pstricks-add}
makeatletter
defpstKey{pst@object{pstKey}}
defpstKey@i{@ifnextchar({pstKey@ii{0}}pstKey@ii}
defpstKey@ii#1(#2){%
addbefore@par{fillstyle=solid, fillcolor=green}%
begingroup
use@par
rput{#1}(#2){%
pscustom{
psarcn(0.2, 0){0.8}{346}{25} % Exterior disk
psline(3, 0.3380)(3.3, 0)(3, -0.3420)(2.8, -0.3420)
(2.8, -0.3420)(2.65, -0.1920)(2.55, -0.3420)(2.45, -0.1920)(2.25, -0.4920)
(2.15, -0.3420)(2.05, -0.4920)(1.95, -0.3420)(1.85, -0.4920)(1.65, -0.1920)
(1.55, -0.3420)(1.45, -0.1920)(1.25, -0.4920)(1.05, -0.1935)(0.9762, -0.1935)
pscircle[linewidth=2pt](0, 0){0.25} % Hole
}}%
endgroupignorespaces
}
makeatother
begin{document}
begin{pspicture}[showgrid=true](-3, -3)(5, 3)
pstKey(0,0)
pstKey[fillcolor=red,opacity=0.5]{90}(2,-2)
end{pspicture}
end{document}

And with a scaling option:
documentclass[pstricks]{standalone}
usepackage{pstricks-add}
makeatletter
defpstKey{pst@object{pstKey}}
defpstKey@i{@ifnextchar({pstKey@ii{0}}pstKey@ii}
defpstKey@ii#1(#2){%
addbefore@par{fillstyle=solid, fillcolor=green}%
begingroup
use@par
rput{#1}(#2){psscalebox{psk@psscale}{%
pscustom{
psarcn(0.2, 0){0.8}{346}{25} % Exterior disk
psline(3, 0.3380)(3.3, 0)(3, -0.3420)(2.8, -0.3420)
(2.8, -0.3420)(2.65, -0.1920)(2.55, -0.3420)(2.45, -0.1920)(2.25, -0.4920)
(2.15, -0.3420)(2.05, -0.4920)(1.95, -0.3420)(1.85, -0.4920)(1.65, -0.1920)
(1.55, -0.3420)(1.45, -0.1920)(1.25, -0.4920)(1.05, -0.1935)(0.9762, -0.1935)
pscircle[linewidth=2pt](0, 0){0.25} % Hole
}}}%
endgroupignorespaces
}
makeatother
begin{document}
begin{pspicture}[bgcolor=yellow!30](-3, -3)(5, 3)
pstKey(0,0)
pstKey[fillcolor=red,psscale=0.5,opacity=0.5]{90}(2,-1)
end{pspicture}
end{document}

documentclass[pstricks]{standalone}
usepackage{pstricks-add}
begin{document}
begin{pspicture}[showgrid=true](-3, -3)(5, 3)
pscustom[fillstyle=solid, fillcolor=green]{
psarcn(0.2, 0){0.8}{346}{25} % Exterior disk
psline(3, 0.3380)(3.3, 0)(3, -0.3420)(2.8, -0.3420)
(2.8, -0.3420)(2.65, -0.1920)(2.55, -0.3420)(2.45, -0.1920)(2.25, -0.4920)
(2.15, -0.3420)(2.05, -0.4920)(1.95, -0.3420)(1.85, -0.4920)(1.65, -0.1920)
(1.55, -0.3420)(1.45, -0.1920)(1.25, -0.4920)(1.05, -0.1935)(0.9762, -0.1935)
pscircle[linewidth=2pt](0, 0){0.25} % Hole
}
end{pspicture}
end{document}

For creating a new macro for this look into pstricks-add there you'll find a lot of examples, like this one:
documentclass[pstricks]{standalone}
usepackage{pstricks-add}
makeatletter
defpstKey{pst@object{pstKey}}
defpstKey@i{@ifnextchar({pstKey@ii{0}}pstKey@ii}
defpstKey@ii#1(#2){%
addbefore@par{fillstyle=solid, fillcolor=green}%
begingroup
use@par
rput{#1}(#2){%
pscustom{
psarcn(0.2, 0){0.8}{346}{25} % Exterior disk
psline(3, 0.3380)(3.3, 0)(3, -0.3420)(2.8, -0.3420)
(2.8, -0.3420)(2.65, -0.1920)(2.55, -0.3420)(2.45, -0.1920)(2.25, -0.4920)
(2.15, -0.3420)(2.05, -0.4920)(1.95, -0.3420)(1.85, -0.4920)(1.65, -0.1920)
(1.55, -0.3420)(1.45, -0.1920)(1.25, -0.4920)(1.05, -0.1935)(0.9762, -0.1935)
pscircle[linewidth=2pt](0, 0){0.25} % Hole
}}%
endgroupignorespaces
}
makeatother
begin{document}
begin{pspicture}[showgrid=true](-3, -3)(5, 3)
pstKey(0,0)
pstKey[fillcolor=red,opacity=0.5]{90}(2,-2)
end{pspicture}
end{document}

And with a scaling option:
documentclass[pstricks]{standalone}
usepackage{pstricks-add}
makeatletter
defpstKey{pst@object{pstKey}}
defpstKey@i{@ifnextchar({pstKey@ii{0}}pstKey@ii}
defpstKey@ii#1(#2){%
addbefore@par{fillstyle=solid, fillcolor=green}%
begingroup
use@par
rput{#1}(#2){psscalebox{psk@psscale}{%
pscustom{
psarcn(0.2, 0){0.8}{346}{25} % Exterior disk
psline(3, 0.3380)(3.3, 0)(3, -0.3420)(2.8, -0.3420)
(2.8, -0.3420)(2.65, -0.1920)(2.55, -0.3420)(2.45, -0.1920)(2.25, -0.4920)
(2.15, -0.3420)(2.05, -0.4920)(1.95, -0.3420)(1.85, -0.4920)(1.65, -0.1920)
(1.55, -0.3420)(1.45, -0.1920)(1.25, -0.4920)(1.05, -0.1935)(0.9762, -0.1935)
pscircle[linewidth=2pt](0, 0){0.25} % Hole
}}}%
endgroupignorespaces
}
makeatother
begin{document}
begin{pspicture}[bgcolor=yellow!30](-3, -3)(5, 3)
pstKey(0,0)
pstKey[fillcolor=red,psscale=0.5,opacity=0.5]{90}(2,-1)
end{pspicture}
end{document}

edited Sep 23 '15 at 14:32
answered Sep 23 '15 at 12:16
Herbert
265k23402712
265k23402712
Awesome, thanks ! And How can I turn this marvel into asymbol?
– EisenHeim
Sep 23 '15 at 12:20
1
as I already wrote, have a look into pst-platon or pst-fractal. There are a lot of examples.
– Herbert
Sep 23 '15 at 12:50
OK, thanks. Actually, I though you quotedpstricks-addfor the pscustom, not for the symbol. Sorry for the misunderstanding.
– EisenHeim
Sep 23 '15 at 13:13
1
see edited answer
– Herbert
Sep 23 '15 at 14:23
1
addbefore@par{...,linestyle=solid,linearc=0}
– Herbert
Sep 23 '15 at 16:10
|
show 5 more comments
Awesome, thanks ! And How can I turn this marvel into asymbol?
– EisenHeim
Sep 23 '15 at 12:20
1
as I already wrote, have a look into pst-platon or pst-fractal. There are a lot of examples.
– Herbert
Sep 23 '15 at 12:50
OK, thanks. Actually, I though you quotedpstricks-addfor the pscustom, not for the symbol. Sorry for the misunderstanding.
– EisenHeim
Sep 23 '15 at 13:13
1
see edited answer
– Herbert
Sep 23 '15 at 14:23
1
addbefore@par{...,linestyle=solid,linearc=0}
– Herbert
Sep 23 '15 at 16:10
Awesome, thanks ! And How can I turn this marvel into a
symbol ?– EisenHeim
Sep 23 '15 at 12:20
Awesome, thanks ! And How can I turn this marvel into a
symbol ?– EisenHeim
Sep 23 '15 at 12:20
1
1
as I already wrote, have a look into pst-platon or pst-fractal. There are a lot of examples.
– Herbert
Sep 23 '15 at 12:50
as I already wrote, have a look into pst-platon or pst-fractal. There are a lot of examples.
– Herbert
Sep 23 '15 at 12:50
OK, thanks. Actually, I though you quoted
pstricks-add for the pscustom, not for the symbol. Sorry for the misunderstanding.– EisenHeim
Sep 23 '15 at 13:13
OK, thanks. Actually, I though you quoted
pstricks-add for the pscustom, not for the symbol. Sorry for the misunderstanding.– EisenHeim
Sep 23 '15 at 13:13
1
1
see edited answer
– Herbert
Sep 23 '15 at 14:23
see edited answer
– Herbert
Sep 23 '15 at 14:23
1
1
addbefore@par{...,linestyle=solid,linearc=0}– Herbert
Sep 23 '15 at 16:10
addbefore@par{...,linestyle=solid,linearc=0}– Herbert
Sep 23 '15 at 16:10
|
show 5 more comments
up vote
1
down vote
The trick is to add the inner circle outside the pscustom.
I defined a pstKey command through several lists of empty nodes, so as to ease the modification of parameters. pstKey can be placed anywhere and rotated, with rput.
documentclass[float]{standalone}%
PassOptionsToPackage{table, dvipsnames, x11names}{xcolor}
usepackage{pstricks-add, pst-circ, pst-3dplot, pst-solides3d,pst-eucl}%, pst-sigsys
usepackage{auto-pst-pdf}
newcommandpstKey{pnodes{U}(3.3, 0)(3, 0.3380)(0.9250, 0.3380)%
pnodes{b}(0.9762, -0.1935)(1.05, -0.1935)(1.45, -0.1920)(1.65, -0.1920)(2.45, -0.1920)(2.65, -0.1920)
pnodes{m}(1.55, -0.3420)(1.95, -0.3420)(2.15, -0.3420)(2.55, -0.3420)(2.8, -0.3420)(3, -0.3420)
pnodes{B}(1.25, -0.4920)(1.85, -0.4920)(2.05, -0.4920)(2.25, -0.4920)
%
pscustom[fillstyle=solid, fillcolor=Gold4!40! HoneyDew4, opacity =0.65, linejoin =1]{%
psline(U0)(U1)(U2)
psarc(0.2, 0){0.8}{25}{346} % Exterior disk
psline(b0)(b1)(B0)(b2)(m0)(b3)(B1)(m1)(B2)(m2)(B3)(b4)(m3)(b5)(m4)(m5)(U0)
}
pscircle[linewidth=2pt, fillstyle=solid, fillcolor=white](0, 0){0.25}% Hole
}%
begin{document}
begin{pspicture}[labelangle=:U, showgrid=true](-3, -3)(5, 3)%
rput{-30}(1,1){pstKey}
end{pspicture}
end{document}

1
change the background color and the inner circle will still be filled with white instead of the background.
– Herbert
Sep 23 '15 at 14:29
That's what I did first and it didn't work. I guess I mixed up in various modifications of the O.P.'s code. Thank you, Herbert!
– Bernard
Sep 23 '15 at 14:39
add a comment |
up vote
1
down vote
The trick is to add the inner circle outside the pscustom.
I defined a pstKey command through several lists of empty nodes, so as to ease the modification of parameters. pstKey can be placed anywhere and rotated, with rput.
documentclass[float]{standalone}%
PassOptionsToPackage{table, dvipsnames, x11names}{xcolor}
usepackage{pstricks-add, pst-circ, pst-3dplot, pst-solides3d,pst-eucl}%, pst-sigsys
usepackage{auto-pst-pdf}
newcommandpstKey{pnodes{U}(3.3, 0)(3, 0.3380)(0.9250, 0.3380)%
pnodes{b}(0.9762, -0.1935)(1.05, -0.1935)(1.45, -0.1920)(1.65, -0.1920)(2.45, -0.1920)(2.65, -0.1920)
pnodes{m}(1.55, -0.3420)(1.95, -0.3420)(2.15, -0.3420)(2.55, -0.3420)(2.8, -0.3420)(3, -0.3420)
pnodes{B}(1.25, -0.4920)(1.85, -0.4920)(2.05, -0.4920)(2.25, -0.4920)
%
pscustom[fillstyle=solid, fillcolor=Gold4!40! HoneyDew4, opacity =0.65, linejoin =1]{%
psline(U0)(U1)(U2)
psarc(0.2, 0){0.8}{25}{346} % Exterior disk
psline(b0)(b1)(B0)(b2)(m0)(b3)(B1)(m1)(B2)(m2)(B3)(b4)(m3)(b5)(m4)(m5)(U0)
}
pscircle[linewidth=2pt, fillstyle=solid, fillcolor=white](0, 0){0.25}% Hole
}%
begin{document}
begin{pspicture}[labelangle=:U, showgrid=true](-3, -3)(5, 3)%
rput{-30}(1,1){pstKey}
end{pspicture}
end{document}

1
change the background color and the inner circle will still be filled with white instead of the background.
– Herbert
Sep 23 '15 at 14:29
That's what I did first and it didn't work. I guess I mixed up in various modifications of the O.P.'s code. Thank you, Herbert!
– Bernard
Sep 23 '15 at 14:39
add a comment |
up vote
1
down vote
up vote
1
down vote
The trick is to add the inner circle outside the pscustom.
I defined a pstKey command through several lists of empty nodes, so as to ease the modification of parameters. pstKey can be placed anywhere and rotated, with rput.
documentclass[float]{standalone}%
PassOptionsToPackage{table, dvipsnames, x11names}{xcolor}
usepackage{pstricks-add, pst-circ, pst-3dplot, pst-solides3d,pst-eucl}%, pst-sigsys
usepackage{auto-pst-pdf}
newcommandpstKey{pnodes{U}(3.3, 0)(3, 0.3380)(0.9250, 0.3380)%
pnodes{b}(0.9762, -0.1935)(1.05, -0.1935)(1.45, -0.1920)(1.65, -0.1920)(2.45, -0.1920)(2.65, -0.1920)
pnodes{m}(1.55, -0.3420)(1.95, -0.3420)(2.15, -0.3420)(2.55, -0.3420)(2.8, -0.3420)(3, -0.3420)
pnodes{B}(1.25, -0.4920)(1.85, -0.4920)(2.05, -0.4920)(2.25, -0.4920)
%
pscustom[fillstyle=solid, fillcolor=Gold4!40! HoneyDew4, opacity =0.65, linejoin =1]{%
psline(U0)(U1)(U2)
psarc(0.2, 0){0.8}{25}{346} % Exterior disk
psline(b0)(b1)(B0)(b2)(m0)(b3)(B1)(m1)(B2)(m2)(B3)(b4)(m3)(b5)(m4)(m5)(U0)
}
pscircle[linewidth=2pt, fillstyle=solid, fillcolor=white](0, 0){0.25}% Hole
}%
begin{document}
begin{pspicture}[labelangle=:U, showgrid=true](-3, -3)(5, 3)%
rput{-30}(1,1){pstKey}
end{pspicture}
end{document}

The trick is to add the inner circle outside the pscustom.
I defined a pstKey command through several lists of empty nodes, so as to ease the modification of parameters. pstKey can be placed anywhere and rotated, with rput.
documentclass[float]{standalone}%
PassOptionsToPackage{table, dvipsnames, x11names}{xcolor}
usepackage{pstricks-add, pst-circ, pst-3dplot, pst-solides3d,pst-eucl}%, pst-sigsys
usepackage{auto-pst-pdf}
newcommandpstKey{pnodes{U}(3.3, 0)(3, 0.3380)(0.9250, 0.3380)%
pnodes{b}(0.9762, -0.1935)(1.05, -0.1935)(1.45, -0.1920)(1.65, -0.1920)(2.45, -0.1920)(2.65, -0.1920)
pnodes{m}(1.55, -0.3420)(1.95, -0.3420)(2.15, -0.3420)(2.55, -0.3420)(2.8, -0.3420)(3, -0.3420)
pnodes{B}(1.25, -0.4920)(1.85, -0.4920)(2.05, -0.4920)(2.25, -0.4920)
%
pscustom[fillstyle=solid, fillcolor=Gold4!40! HoneyDew4, opacity =0.65, linejoin =1]{%
psline(U0)(U1)(U2)
psarc(0.2, 0){0.8}{25}{346} % Exterior disk
psline(b0)(b1)(B0)(b2)(m0)(b3)(B1)(m1)(B2)(m2)(B3)(b4)(m3)(b5)(m4)(m5)(U0)
}
pscircle[linewidth=2pt, fillstyle=solid, fillcolor=white](0, 0){0.25}% Hole
}%
begin{document}
begin{pspicture}[labelangle=:U, showgrid=true](-3, -3)(5, 3)%
rput{-30}(1,1){pstKey}
end{pspicture}
end{document}

edited Sep 23 '15 at 14:41
answered Sep 23 '15 at 13:54
Bernard
162k767192
162k767192
1
change the background color and the inner circle will still be filled with white instead of the background.
– Herbert
Sep 23 '15 at 14:29
That's what I did first and it didn't work. I guess I mixed up in various modifications of the O.P.'s code. Thank you, Herbert!
– Bernard
Sep 23 '15 at 14:39
add a comment |
1
change the background color and the inner circle will still be filled with white instead of the background.
– Herbert
Sep 23 '15 at 14:29
That's what I did first and it didn't work. I guess I mixed up in various modifications of the O.P.'s code. Thank you, Herbert!
– Bernard
Sep 23 '15 at 14:39
1
1
change the background color and the inner circle will still be filled with white instead of the background.
– Herbert
Sep 23 '15 at 14:29
change the background color and the inner circle will still be filled with white instead of the background.
– Herbert
Sep 23 '15 at 14:29
That's what I did first and it didn't work. I guess I mixed up in various modifications of the O.P.'s code. Thank you, Herbert!
– Bernard
Sep 23 '15 at 14:39
That's what I did first and it didn't work. I guess I mixed up in various modifications of the O.P.'s code. Thank you, Herbert!
– Bernard
Sep 23 '15 at 14:39
add a comment |
up vote
0
down vote
List of changes:
- replace the last point with
closepathto fix the discontinuity at that point (it is noticeable for thicklinewidth). - move
linewidth=2pttopscustomaslinewidthdeclared insidepscustomdoes not take any effect. - remove the center of the last circle.
- use 2 decimal points for literal numbers.
- remove unnecessary
pstricks-add. - reduce the canvas size.
documentclass[pstricks]{standalone}
begin{document}
begin{pspicture}[showgrid=true](-1,-1)(4, 1)
pscustom[fillstyle=solid,fillcolor=green,linewidth=2pt]{
psarcn(0.2,0){0.8}{346}{25}
psline(3,0.33)(3.3,0)(3,-0.34)(2.8,-0.34)
(2.8,-0.34)(2.65,-0.19)(2.55,-0.34)(2.45,-0.19)(2.25,-0.49)
(2.15,-0.34)(2.05,-0.49)(1.95,-0.34)(1.85,-0.49)(1.65,-0.19)
(1.55,-0.34)(1.45,-0.19)(1.25,-0.49)(1.05,-0.19)%(0.9762,-0.1935)
closepath
pscircle{0.25}
}
end{pspicture}
end{document}

add a comment |
up vote
0
down vote
List of changes:
- replace the last point with
closepathto fix the discontinuity at that point (it is noticeable for thicklinewidth). - move
linewidth=2pttopscustomaslinewidthdeclared insidepscustomdoes not take any effect. - remove the center of the last circle.
- use 2 decimal points for literal numbers.
- remove unnecessary
pstricks-add. - reduce the canvas size.
documentclass[pstricks]{standalone}
begin{document}
begin{pspicture}[showgrid=true](-1,-1)(4, 1)
pscustom[fillstyle=solid,fillcolor=green,linewidth=2pt]{
psarcn(0.2,0){0.8}{346}{25}
psline(3,0.33)(3.3,0)(3,-0.34)(2.8,-0.34)
(2.8,-0.34)(2.65,-0.19)(2.55,-0.34)(2.45,-0.19)(2.25,-0.49)
(2.15,-0.34)(2.05,-0.49)(1.95,-0.34)(1.85,-0.49)(1.65,-0.19)
(1.55,-0.34)(1.45,-0.19)(1.25,-0.49)(1.05,-0.19)%(0.9762,-0.1935)
closepath
pscircle{0.25}
}
end{pspicture}
end{document}

add a comment |
up vote
0
down vote
up vote
0
down vote
List of changes:
- replace the last point with
closepathto fix the discontinuity at that point (it is noticeable for thicklinewidth). - move
linewidth=2pttopscustomaslinewidthdeclared insidepscustomdoes not take any effect. - remove the center of the last circle.
- use 2 decimal points for literal numbers.
- remove unnecessary
pstricks-add. - reduce the canvas size.
documentclass[pstricks]{standalone}
begin{document}
begin{pspicture}[showgrid=true](-1,-1)(4, 1)
pscustom[fillstyle=solid,fillcolor=green,linewidth=2pt]{
psarcn(0.2,0){0.8}{346}{25}
psline(3,0.33)(3.3,0)(3,-0.34)(2.8,-0.34)
(2.8,-0.34)(2.65,-0.19)(2.55,-0.34)(2.45,-0.19)(2.25,-0.49)
(2.15,-0.34)(2.05,-0.49)(1.95,-0.34)(1.85,-0.49)(1.65,-0.19)
(1.55,-0.34)(1.45,-0.19)(1.25,-0.49)(1.05,-0.19)%(0.9762,-0.1935)
closepath
pscircle{0.25}
}
end{pspicture}
end{document}

List of changes:
- replace the last point with
closepathto fix the discontinuity at that point (it is noticeable for thicklinewidth). - move
linewidth=2pttopscustomaslinewidthdeclared insidepscustomdoes not take any effect. - remove the center of the last circle.
- use 2 decimal points for literal numbers.
- remove unnecessary
pstricks-add. - reduce the canvas size.
documentclass[pstricks]{standalone}
begin{document}
begin{pspicture}[showgrid=true](-1,-1)(4, 1)
pscustom[fillstyle=solid,fillcolor=green,linewidth=2pt]{
psarcn(0.2,0){0.8}{346}{25}
psline(3,0.33)(3.3,0)(3,-0.34)(2.8,-0.34)
(2.8,-0.34)(2.65,-0.19)(2.55,-0.34)(2.45,-0.19)(2.25,-0.49)
(2.15,-0.34)(2.05,-0.49)(1.95,-0.34)(1.85,-0.49)(1.65,-0.19)
(1.55,-0.34)(1.45,-0.19)(1.25,-0.49)(1.05,-0.19)%(0.9762,-0.1935)
closepath
pscircle{0.25}
}
end{pspicture}
end{document}

answered yesterday
community wiki
Artificial Stupidity
add a comment |
add a comment |
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%2f269050%2fcreate-custom-shape-with-holes%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