Help with a node diagram
I am trying to recreate this diagram from a paper for my thesis. The idea would be that I can scale it to different sizes, only use parts of it and insert different nodes like the circles and triangles.
I have tried reproducing it, but I am quite unexperienced with tikz, so after hours of desperatly trying to make it work I have come up with a huge, unelegant solution, that doesn't really look the way I want it to.
PassOptionsToPackage{svgnames}{xcolor}
documentclass[12pt,a4paper]{scrartcl}
usepackage{tikz, pgf}
usepackage{xltxtra}
renewcommand{familydefault}{sfdefault}
usepackage[T1]{fontenc}
usetikzlibrary{
positioning,
shapes.geometric,
shapes.misc,
calc,
fit,
matrix}
begin{document}
begin{tikzpicture} [pics/myHexagon/.style args={#1/#2/#3}%
{
code=
{
pgfmathsetmacro{mySqrt}{sqrt(3)/2}
defr{#1}
defa{#2}
defc{#3}
draw [cm={r,0,.5*r,mySqrt*r,(0,0)},fill=c,text=white]
(1+a,0) coordinate (-corner 0) coordinate (-corner 6)
-- (a,1) coordinate (-corner 1)
-- (-1-a,1) coordinate (-corner 2)
-- (-1-a,0) coordinate (-corner 3)
-- (-a,-1) coordinate (-corner 4)
-- (1+a,-1) coordinate (-corner 5)
-- cycle;
{asfd}
}
}]
draw (0,0) pic {myHexagon={.6/.3/RoyalBlue}};
draw (2,0) pic {myHexagon={.6/.3/DarkMagenta}};
draw (4,0) pic {myHexagon={.6/.3/RoyalBlue}};
draw (6,0) pic {myHexagon={.6/.3/DarkMagenta}};
draw (2,-1.5) node [shape=ellipse,draw,minimum height=1cm,fill=red] {L-Ala};
draw (1,-3) node [shape=ellipse,draw,minimum height=1cm, fill=yellow] {D-Glu};
draw (0,-4.5) node [shape=ellipse,draw,minimum height=1cm] {L-Lys};
draw (0,-6) node [shape=ellipse,draw,minimum height=1cm] {D-Ala};
draw (1.7,-4.5) node [shape=circle,draw,minimum height=.75cm] {Gly};
draw (3,-4.5) node [shape=circle,draw,minimum height=.75cm] {Gly};
draw (4.3,-4.5) node [shape=circle,draw,minimum height=.75cm] {Gly};
draw (5.6,-4.5) node [shape=circle,draw,minimum height=.75cm] {Gly};
draw (6.9,-4.5) node [shape=circle,draw,minimum height=.75cm] {Gly};
draw (8.5,-4.5) node [shape=ellipse,draw,minimum height=1cm] {D-Ala};
draw (7.5,-6) node [shape=ellipse,draw,minimum height=1cm] {L-Lys};
draw (6.5,-7.5) node [shape=ellipse,draw,minimum height=1cm] {D-Glu};
draw (5.5,-9) node [shape=ellipse,draw,minimum height=1cm] {L-Ala};
draw (3.5,-10.5) pic {myHexagon={.6/.3/RoyalBlue}};
draw (1.5,-10.5) pic {myHexagon={.6/.3/DarkMagenta}};
draw (7.5,-10.5) pic {myHexagon={.6/.3/RoyalBlue}};
draw (5.5,-10.5) pic {myHexagon={.6/.3/DarkMagenta}};
end{tikzpicture}
end{document}
Could someone please help me simplify and complete it?
Thanks!
[edit]
I should mention that I used Scaling only a portion of a TikZ polygon for the polygons.
tikz-pgf nodes
add a comment |
I am trying to recreate this diagram from a paper for my thesis. The idea would be that I can scale it to different sizes, only use parts of it and insert different nodes like the circles and triangles.
I have tried reproducing it, but I am quite unexperienced with tikz, so after hours of desperatly trying to make it work I have come up with a huge, unelegant solution, that doesn't really look the way I want it to.
PassOptionsToPackage{svgnames}{xcolor}
documentclass[12pt,a4paper]{scrartcl}
usepackage{tikz, pgf}
usepackage{xltxtra}
renewcommand{familydefault}{sfdefault}
usepackage[T1]{fontenc}
usetikzlibrary{
positioning,
shapes.geometric,
shapes.misc,
calc,
fit,
matrix}
begin{document}
begin{tikzpicture} [pics/myHexagon/.style args={#1/#2/#3}%
{
code=
{
pgfmathsetmacro{mySqrt}{sqrt(3)/2}
defr{#1}
defa{#2}
defc{#3}
draw [cm={r,0,.5*r,mySqrt*r,(0,0)},fill=c,text=white]
(1+a,0) coordinate (-corner 0) coordinate (-corner 6)
-- (a,1) coordinate (-corner 1)
-- (-1-a,1) coordinate (-corner 2)
-- (-1-a,0) coordinate (-corner 3)
-- (-a,-1) coordinate (-corner 4)
-- (1+a,-1) coordinate (-corner 5)
-- cycle;
{asfd}
}
}]
draw (0,0) pic {myHexagon={.6/.3/RoyalBlue}};
draw (2,0) pic {myHexagon={.6/.3/DarkMagenta}};
draw (4,0) pic {myHexagon={.6/.3/RoyalBlue}};
draw (6,0) pic {myHexagon={.6/.3/DarkMagenta}};
draw (2,-1.5) node [shape=ellipse,draw,minimum height=1cm,fill=red] {L-Ala};
draw (1,-3) node [shape=ellipse,draw,minimum height=1cm, fill=yellow] {D-Glu};
draw (0,-4.5) node [shape=ellipse,draw,minimum height=1cm] {L-Lys};
draw (0,-6) node [shape=ellipse,draw,minimum height=1cm] {D-Ala};
draw (1.7,-4.5) node [shape=circle,draw,minimum height=.75cm] {Gly};
draw (3,-4.5) node [shape=circle,draw,minimum height=.75cm] {Gly};
draw (4.3,-4.5) node [shape=circle,draw,minimum height=.75cm] {Gly};
draw (5.6,-4.5) node [shape=circle,draw,minimum height=.75cm] {Gly};
draw (6.9,-4.5) node [shape=circle,draw,minimum height=.75cm] {Gly};
draw (8.5,-4.5) node [shape=ellipse,draw,minimum height=1cm] {D-Ala};
draw (7.5,-6) node [shape=ellipse,draw,minimum height=1cm] {L-Lys};
draw (6.5,-7.5) node [shape=ellipse,draw,minimum height=1cm] {D-Glu};
draw (5.5,-9) node [shape=ellipse,draw,minimum height=1cm] {L-Ala};
draw (3.5,-10.5) pic {myHexagon={.6/.3/RoyalBlue}};
draw (1.5,-10.5) pic {myHexagon={.6/.3/DarkMagenta}};
draw (7.5,-10.5) pic {myHexagon={.6/.3/RoyalBlue}};
draw (5.5,-10.5) pic {myHexagon={.6/.3/DarkMagenta}};
end{tikzpicture}
end{document}
Could someone please help me simplify and complete it?
Thanks!
[edit]
I should mention that I used Scaling only a portion of a TikZ polygon for the polygons.
tikz-pgf nodes
add a comment |
I am trying to recreate this diagram from a paper for my thesis. The idea would be that I can scale it to different sizes, only use parts of it and insert different nodes like the circles and triangles.
I have tried reproducing it, but I am quite unexperienced with tikz, so after hours of desperatly trying to make it work I have come up with a huge, unelegant solution, that doesn't really look the way I want it to.
PassOptionsToPackage{svgnames}{xcolor}
documentclass[12pt,a4paper]{scrartcl}
usepackage{tikz, pgf}
usepackage{xltxtra}
renewcommand{familydefault}{sfdefault}
usepackage[T1]{fontenc}
usetikzlibrary{
positioning,
shapes.geometric,
shapes.misc,
calc,
fit,
matrix}
begin{document}
begin{tikzpicture} [pics/myHexagon/.style args={#1/#2/#3}%
{
code=
{
pgfmathsetmacro{mySqrt}{sqrt(3)/2}
defr{#1}
defa{#2}
defc{#3}
draw [cm={r,0,.5*r,mySqrt*r,(0,0)},fill=c,text=white]
(1+a,0) coordinate (-corner 0) coordinate (-corner 6)
-- (a,1) coordinate (-corner 1)
-- (-1-a,1) coordinate (-corner 2)
-- (-1-a,0) coordinate (-corner 3)
-- (-a,-1) coordinate (-corner 4)
-- (1+a,-1) coordinate (-corner 5)
-- cycle;
{asfd}
}
}]
draw (0,0) pic {myHexagon={.6/.3/RoyalBlue}};
draw (2,0) pic {myHexagon={.6/.3/DarkMagenta}};
draw (4,0) pic {myHexagon={.6/.3/RoyalBlue}};
draw (6,0) pic {myHexagon={.6/.3/DarkMagenta}};
draw (2,-1.5) node [shape=ellipse,draw,minimum height=1cm,fill=red] {L-Ala};
draw (1,-3) node [shape=ellipse,draw,minimum height=1cm, fill=yellow] {D-Glu};
draw (0,-4.5) node [shape=ellipse,draw,minimum height=1cm] {L-Lys};
draw (0,-6) node [shape=ellipse,draw,minimum height=1cm] {D-Ala};
draw (1.7,-4.5) node [shape=circle,draw,minimum height=.75cm] {Gly};
draw (3,-4.5) node [shape=circle,draw,minimum height=.75cm] {Gly};
draw (4.3,-4.5) node [shape=circle,draw,minimum height=.75cm] {Gly};
draw (5.6,-4.5) node [shape=circle,draw,minimum height=.75cm] {Gly};
draw (6.9,-4.5) node [shape=circle,draw,minimum height=.75cm] {Gly};
draw (8.5,-4.5) node [shape=ellipse,draw,minimum height=1cm] {D-Ala};
draw (7.5,-6) node [shape=ellipse,draw,minimum height=1cm] {L-Lys};
draw (6.5,-7.5) node [shape=ellipse,draw,minimum height=1cm] {D-Glu};
draw (5.5,-9) node [shape=ellipse,draw,minimum height=1cm] {L-Ala};
draw (3.5,-10.5) pic {myHexagon={.6/.3/RoyalBlue}};
draw (1.5,-10.5) pic {myHexagon={.6/.3/DarkMagenta}};
draw (7.5,-10.5) pic {myHexagon={.6/.3/RoyalBlue}};
draw (5.5,-10.5) pic {myHexagon={.6/.3/DarkMagenta}};
end{tikzpicture}
end{document}
Could someone please help me simplify and complete it?
Thanks!
[edit]
I should mention that I used Scaling only a portion of a TikZ polygon for the polygons.
tikz-pgf nodes
I am trying to recreate this diagram from a paper for my thesis. The idea would be that I can scale it to different sizes, only use parts of it and insert different nodes like the circles and triangles.
I have tried reproducing it, but I am quite unexperienced with tikz, so after hours of desperatly trying to make it work I have come up with a huge, unelegant solution, that doesn't really look the way I want it to.
PassOptionsToPackage{svgnames}{xcolor}
documentclass[12pt,a4paper]{scrartcl}
usepackage{tikz, pgf}
usepackage{xltxtra}
renewcommand{familydefault}{sfdefault}
usepackage[T1]{fontenc}
usetikzlibrary{
positioning,
shapes.geometric,
shapes.misc,
calc,
fit,
matrix}
begin{document}
begin{tikzpicture} [pics/myHexagon/.style args={#1/#2/#3}%
{
code=
{
pgfmathsetmacro{mySqrt}{sqrt(3)/2}
defr{#1}
defa{#2}
defc{#3}
draw [cm={r,0,.5*r,mySqrt*r,(0,0)},fill=c,text=white]
(1+a,0) coordinate (-corner 0) coordinate (-corner 6)
-- (a,1) coordinate (-corner 1)
-- (-1-a,1) coordinate (-corner 2)
-- (-1-a,0) coordinate (-corner 3)
-- (-a,-1) coordinate (-corner 4)
-- (1+a,-1) coordinate (-corner 5)
-- cycle;
{asfd}
}
}]
draw (0,0) pic {myHexagon={.6/.3/RoyalBlue}};
draw (2,0) pic {myHexagon={.6/.3/DarkMagenta}};
draw (4,0) pic {myHexagon={.6/.3/RoyalBlue}};
draw (6,0) pic {myHexagon={.6/.3/DarkMagenta}};
draw (2,-1.5) node [shape=ellipse,draw,minimum height=1cm,fill=red] {L-Ala};
draw (1,-3) node [shape=ellipse,draw,minimum height=1cm, fill=yellow] {D-Glu};
draw (0,-4.5) node [shape=ellipse,draw,minimum height=1cm] {L-Lys};
draw (0,-6) node [shape=ellipse,draw,minimum height=1cm] {D-Ala};
draw (1.7,-4.5) node [shape=circle,draw,minimum height=.75cm] {Gly};
draw (3,-4.5) node [shape=circle,draw,minimum height=.75cm] {Gly};
draw (4.3,-4.5) node [shape=circle,draw,minimum height=.75cm] {Gly};
draw (5.6,-4.5) node [shape=circle,draw,minimum height=.75cm] {Gly};
draw (6.9,-4.5) node [shape=circle,draw,minimum height=.75cm] {Gly};
draw (8.5,-4.5) node [shape=ellipse,draw,minimum height=1cm] {D-Ala};
draw (7.5,-6) node [shape=ellipse,draw,minimum height=1cm] {L-Lys};
draw (6.5,-7.5) node [shape=ellipse,draw,minimum height=1cm] {D-Glu};
draw (5.5,-9) node [shape=ellipse,draw,minimum height=1cm] {L-Ala};
draw (3.5,-10.5) pic {myHexagon={.6/.3/RoyalBlue}};
draw (1.5,-10.5) pic {myHexagon={.6/.3/DarkMagenta}};
draw (7.5,-10.5) pic {myHexagon={.6/.3/RoyalBlue}};
draw (5.5,-10.5) pic {myHexagon={.6/.3/DarkMagenta}};
end{tikzpicture}
end{document}
Could someone please help me simplify and complete it?
Thanks!
[edit]
I should mention that I used Scaling only a portion of a TikZ polygon for the polygons.
tikz-pgf nodes
tikz-pgf nodes
edited Dec 29 '18 at 14:40
asked Dec 29 '18 at 13:48
fffff
215
215
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
I would like to suggest using a chamfered rectangle
for the hexagon, and set a large value of for chamfered rectangle xsep
. The pgfmanual writes on p. 736
Sets the distance that the chamfer extends horizontally beyond the
node contents (which includes the inner sep). If ⟨length⟩ is large,
such that the top and bottom chamfered edges would cross, then
⟨length⟩ is ignored and the chamfered edges are drawn so that they
meet in the middle.
and shows a hexagon. Further, you are loading positioning
, and I would like to suggest using it for relative positioning. (You may also look into chains, but I personally I find this sometimes a bit of an overkill.) So here is a first proposal.
PassOptionsToPackage{svgnames}{xcolor}
documentclass[12pt,a4paper]{scrartcl}
usepackage{tikz, pgf}
usepackage{xltxtra}
renewcommand{familydefault}{sfdefault}
usepackage[T1]{fontenc}
usetikzlibrary{
positioning,
shapes.geometric,
shapes.misc,
shadows.blur,
calc}
newcounter{hexa}
begin{document}
begin{tikzpicture}[my hexa/.style={blur shadow,chamfered rectangle,chamfered rectangle
xsep=2cm,draw,text=white,path picture={%
draw[white] let p1=($(path picture bounding box.north)-(path picture
bounding box.east)$) in
([xshift=-1pt]path picture bounding box.east)
-- ++(-y1+1pt,y1-1pt) -- ++(2*x1,0);}},
my elli/.style={blur shadow,ellipse,draw,text=white,path picture={%
fill[white] let p1=($(path picture bounding box.north)-(path picture
bounding box.east)$) in ([xshift=-1pt]path picture bounding box.east)
to[out=90,in=0,looseness=0.8] ([yshift=-1pt]path picture bounding box.north)
to[out=0,in=90,looseness=0.7] cycle;
}},
shaded triangle/.style={blur shadow,regular polygon,regular polygon sides=3,shape border rotate=0,
inner sep=1pt,draw,inner color=#1!10,outer color=#1}]
node[my hexa,fill=RoyalBlue] (Glc1) {GlcN Ac};
node[right=of Glc1,my hexa,fill=DarkMagenta] (Mur1) {MurN Ac};
node[right=of Mur1,my hexa,fill=RoyalBlue] (Glc2) {GlcN Ac};
node[right=of Glc2,my hexa,fill=DarkMagenta] (Mur2) {MurN Ac};
%
node[below=of Mur1,my elli,fill=DarkGreen] (L-Ala1) {L-Ala};
node[below left=8mm and 5mm of L-Ala1,my elli,fill=purple] (D-Glu1)
{textsc{d}-Glu};
node[below left=8mm and 5mm of D-Glu1,my elli,fill=DarkRed] (L-Lys1)
{textsc{l}-Lys};
node[right=3mm of L-Lys1,my elli,fill=green!80!black] (Gly1) {Gly};
node[right=3mm of Gly1,my elli,fill=green!80!black] (Gly2) {Gly};
node[right=3mm of Gly2,my elli,fill=green!80!black] (Gly3) {Gly};
node[right=3mm of Gly3,my elli,fill=green!80!black] (Gly4) {Gly};
node[right=3mm of Gly4,my elli,fill=green!80!black] (Gly5) {Gly};
node[right=3mm of Gly5,my elli,fill=cyan] (D-Ala1) {D-Ala};
node[below=8mm of L-Lys1,my elli,fill=cyan] (D-Ala2) {D-Ala};
%
node[below left=8mm and -5mm of D-Ala1,my elli,fill=DarkRed] (L-Lys2)
{textsc{l}-Lys};
node[below left=8mm and -5mm of L-Lys2,my elli,fill=purple] (D-Glu2)
{textsc{d}-Glu};
node[below left=8mm and -5mm of D-Glu2,my elli,fill=DarkGreen] (L-Ala2)
{L-Ala};
%
node[below=of L-Ala2,my hexa,fill=DarkMagenta] (Mur3) {MurN Ac};
node[left=of Mur3,my hexa,fill=RoyalBlue] (Glc3) {GlcN Ac};
node[left=of Glc3,my hexa,fill=DarkMagenta] (Mur4) {MurN Ac};
node[right=of Mur3,my hexa,fill=RoyalBlue] (Glc4) {GlcN Ac};
%
draw (Glc1) -- (Mur1) -- (Glc2) -- (Mur2);
draw (Glc2) -- (L-Ala1) -- (D-Glu1) -- (L-Lys1)
-- (Gly1) -- (Gly2) -- (Gly3) -- (Gly4) -- (Gly5)
-- (D-Ala1) -- (L-Lys2) -- (D-Glu2) -- (L-Ala2) -- (Mur3) --
(Glc3) -- (Mur4);
draw (Mur3) -- (Glc4);
draw (L-Lys1) -- (D-Ala2);
%
node[above=5mm of Gly3,shaded triangle=red] (E4) {E4};
draw[red,thick,-latex] (E4.south west) -- ($(Gly2)!0.5!(Gly3)$);
draw[red,thick,-latex] (E4.south east) -- ($(Gly3)!0.5!(Gly4)$);
path (Gly5) -- (D-Ala1) coordinate[midway](aux);
node[anchor=south,shaded triangle=red] (E5) at (aux|-E4.south) {E5};
draw[red,thick,-latex] (E5.south) -- (aux);
node[right=2mm of D-Glu1] (txt1) {NH$_2$};
node[left=2mm of D-Glu2] (txt2) {NH$_2$};
draw (D-Glu1) -- (txt1);
draw (D-Glu2) -- (txt2);
end{tikzpicture}
end{document}
To make it smaller, you could scale it (e.g. scale=0.8,transform shape
) and/or adjust the node distance
.
PassOptionsToPackage{svgnames}{xcolor}
documentclass[12pt,a4paper]{scrartcl}
usepackage{tikz, pgf}
usepackage{xltxtra}
renewcommand{familydefault}{sfdefault}
usepackage[T1]{fontenc}
usetikzlibrary{
positioning,
shapes.geometric,
shapes.misc,
shadows.blur,
calc}
newcounter{hexa}
begin{document}
begin{tikzpicture}[node distance=3mm,scale=0.8,transform shape,
every shadow/.style={shadow xshift=-0.5ex,shadow yshift=-0.5ex},
my hexa/.style={blur shadow,chamfered rectangle,chamfered rectangle
xsep=2cm,draw,text=white,path picture={%
draw[white] let p1=($(path picture bounding box.north)-(path picture
bounding box.east)$) in
([xshift=-1pt]path picture bounding box.east)
-- ++(-y1+1pt,y1-1pt) -- ++(2*x1,0);}},
my elli/.style={blur shadow,ellipse,draw,text=white,path picture={%
fill[white] let p1=($(path picture bounding box.north)-(path picture
bounding box.east)$) in ([xshift=-1pt]path picture bounding box.east)
to[out=90,in=0,looseness=0.8] ([yshift=-1pt]path picture bounding box.north)
to[out=0,in=90,looseness=0.7] cycle;
}},
shaded triangle/.style={blur shadow,regular polygon,regular polygon sides=3,shape border rotate=0,
inner sep=1pt,draw,inner color=#1!10,outer color=#1}]
node[my hexa,fill=RoyalBlue] (Glc1) {GlcN Ac};
node[right=of Glc1,my hexa,fill=DarkMagenta] (Mur1) {MurN Ac};
node[right=of Mur1,my hexa,fill=RoyalBlue] (Glc2) {GlcN Ac};
node[right=of Glc2,my hexa,fill=DarkMagenta] (Mur2) {MurN Ac};
%
node[below=of Mur1,my elli,fill=DarkGreen] (L-Ala1) {L-Ala};
node[below left=8mm and 5mm of L-Ala1,my elli,fill=purple] (D-Glu1)
{textsc{d}-Glu};
node[below left=8mm and 5mm of D-Glu1,my elli,fill=DarkRed] (L-Lys1)
{textsc{l}-Lys};
node[right=3mm of L-Lys1,my elli,fill=green!80!black] (Gly1) {Gly};
node[right=3mm of Gly1,my elli,fill=green!80!black] (Gly2) {Gly};
node[right=3mm of Gly2,my elli,fill=green!80!black] (Gly3) {Gly};
node[right=3mm of Gly3,my elli,fill=green!80!black] (Gly4) {Gly};
node[right=3mm of Gly4,my elli,fill=green!80!black] (Gly5) {Gly};
node[right=3mm of Gly5,my elli,fill=cyan] (D-Ala1) {D-Ala};
node[below=8mm of L-Lys1,my elli,fill=cyan] (D-Ala2) {D-Ala};
%
node[below left=8mm and -2mm of D-Ala1,my elli,fill=DarkRed] (L-Lys2)
{textsc{l}-Lys};
node[below left=8mm and -2mm of L-Lys2,my elli,fill=purple] (D-Glu2)
{textsc{d}-Glu};
node[below left=8mm and -2mm of D-Glu2,my elli,fill=DarkGreen] (L-Ala2)
{L-Ala};
%
node[below=of L-Ala2,my hexa,fill=DarkMagenta] (Mur3) {MurN Ac};
node[left=of Mur3,my hexa,fill=RoyalBlue] (Glc3) {GlcN Ac};
node[left=of Glc3,my hexa,fill=DarkMagenta] (Mur4) {MurN Ac};
node[right=of Mur3,my hexa,fill=RoyalBlue] (Glc4) {GlcN Ac};
%
draw (Glc1) -- (Mur1) -- (Glc2) -- (Mur2);
draw (Glc2) -- (L-Ala1) -- (D-Glu1) -- (L-Lys1)
-- (Gly1) -- (Gly2) -- (Gly3) -- (Gly4) -- (Gly5)
-- (D-Ala1) -- (L-Lys2) -- (D-Glu2) -- (L-Ala2) -- (Mur3) --
(Glc3) -- (Mur4);
draw (Mur3) -- (Glc4);
draw (L-Lys1) -- (D-Ala2);
%
node[above=5mm of Gly3,shaded triangle=red] (E4) {E4};
draw[red,thick,-latex] (E4.south west) -- ($(Gly2)!0.5!(Gly3)$);
draw[red,thick,-latex] (E4.south east) -- ($(Gly3)!0.5!(Gly4)$);
path (Gly5) -- (D-Ala1) coordinate[midway](aux);
node[anchor=south,shaded triangle=red] (E5) at (aux|-E4.south) {E5};
draw[red,thick,-latex] (E5.south) -- (aux);
node[right=2mm of D-Glu1] (txt1) {NH$_2$};
node[left=2mm of D-Glu2] (txt2) {NH$_2$};
draw (D-Glu1) -- (txt1);
draw (D-Glu2) -- (txt2);
draw (Glc1.west) -- ++ (-0.2,0) (Mur2.east) -- ++ (0.2,0)
(Glc4.east) -- ++ (0.2,0) (Mur4.west) -- ++ (-0.2,0);
end{tikzpicture}
end{document}
This last version also comes with more realistic shadows, which are opposite to the bright spots.
Is there a way to make it smaller? But in a way that it is still comfortably readable and you don't have to change every single number by hand.
– fffff
Dec 29 '18 at 15:57
1
@fffff Yes, I added some information on possibilities to scale it.
– marmot
Dec 29 '18 at 16:04
when I compile it in texstudio (with xelatex) the shadows are rectangular, how do I fix that?
– fffff
Dec 29 '18 at 16:16
1
@fffff The screenshots show the results of compilations withxelatex
. Sorry, I never use texstudio. The only additional information I have is that Ulrike Fischer made an update that fixed some issues withshadow.blur
andxelatex
, so you may want to update your TeX installation. If that does not help, you could replaceshadows.blur
byshadows
andblur shadow
bydrop shadow
.
– marmot
Dec 29 '18 at 16:20
one little detail, how can you continue the line on the left and right of the polysaccharides a bit, in order to show that the chain continues?
– fffff
Dec 29 '18 at 16:44
|
show 1 more comment
alternative solution, less fancy (but this can be simple add), with relative positioning of nodes and with some effort to make code short ...
documentclass[12pt,a4paper]{scrartcl}
renewcommand{familydefault}{sfdefault}
usepackage[T1]{fontenc}
usepackage[version=4]{mhchem}
PassOptionsToPackage{svgnames}{xcolor}
usepackage{tikz}
usetikzlibrary{calc, chains,
positioning,
shadows,
shapes.geometric, shapes.symbols
}
makeatletter
tikzset{suppress join/.code={deftikz@after@path{}}}
makeatother
begin{document}
begin{tikzpicture}[
node distance = 8mm and 6mm,
start chain = going right,
HEX/.style = {signal, signal to=left and right,
signal pointer angle=120,
draw=#1, fill=#1!60, text=white,
minimum height=10mm, inner sep=-3pt,
drop shadow,
on chain, join=by -},
ELL/.style = {ellipse, draw=#1, fill=#1!60, text=white,
minimum height=8mm, drop shadow,
on chain, join=by -},
CIR/.style = {circle, draw=olive, ball color=olive!50,
minimum height=8mm, drop shadow,
on chain, join=by -},
TRI/.style = {isosceles triangle, draw=red, fill=red!60,
isosceles triangle apex angle=60,
shape border rotate=90}
]
node (h11) [HEX=RoyalBlue] {GlcNAc};
node (h12) [HEX=DarkMagenta] {MurNAc};
node (h13) [HEX=RoyalBlue] {GlcNAc};
node (h14) [HEX=DarkMagenta] {MurNAc};
draw (h11.west) -- + (-0.5,0)
(h14.east) -- + ( 0.5,0);
%
node (e11) [ELL=teal,suppress join,
below=of h12] {L-Ala};
node (e12) [ELL=orange,
below left=of e11,
pin=right:ce{NH2}] {D-Glu};
node (e13) [ELL=teal, below left=of e12] {L-Lys};
draw (h12) -- (e11);
node (c1) [CIR,suppress join,
right=of e13] {Gly};
draw (e13) -- (c1);
%
node (c1) [CIR] {Gly};
node (c2) [CIR] {Gly};
node (c3) [CIR] {Gly};
node (c4) [CIR] {Gly};
node (e21) [ELL=teal,on chain,join=by -] {D-Ala};
node (e22) [ELL=purple,below left=of e21] {L-Lys};
node (e23) [ELL=purple!50!black,
below left=of e22,
pin=left:ce{NH2}] {D-Glu};
node (e24) [ELL=teal,below left=of e23] {L-Ala};
%
node (h23) [HEX=DarkMagenta,
below=of e24] {MurNAc};
node (h22) [HEX=RoyalBlue,left=of h23] {GlcNAc};
node (h21) [HEX=DarkMagenta,left=of h22] {MurNAc};
node (h24) [HEX=RoyalBlue,suppress join,
right=of h23] {GlcNAc};
draw (h21.west) -- + (-0.5,0)
(h23) -- (h24)
(h24.east) -- + ( 0.5,0);
%
node (A) [CIR,ball color=yellow, suppress join,
left=of e11] {A};
node (e25) [ELL=teal,suppress join,
below=of e13] {L-Ala};
draw (e13) -- (e25);
node (t1) [TRI, above=of c3] {E4};
coordinate (t2) at ($(c4)!0.5!(e21)$);
node (t3) [TRI, at=(t2 |- t1)] {E5};
draw[-latex,red, shorten <=1mm, shorten >=1mm]
(A) edge ($(h12)!0.5!(e11)$)
%
(t1) edge ($(c2)!0.5!(c3)$)
(t1) edge ($(c3)!0.5!(c4)$)
(t3) to (t2);
end{tikzpicture}
end{document}
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%2f467785%2fhelp-with-a-node-diagram%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
I would like to suggest using a chamfered rectangle
for the hexagon, and set a large value of for chamfered rectangle xsep
. The pgfmanual writes on p. 736
Sets the distance that the chamfer extends horizontally beyond the
node contents (which includes the inner sep). If ⟨length⟩ is large,
such that the top and bottom chamfered edges would cross, then
⟨length⟩ is ignored and the chamfered edges are drawn so that they
meet in the middle.
and shows a hexagon. Further, you are loading positioning
, and I would like to suggest using it for relative positioning. (You may also look into chains, but I personally I find this sometimes a bit of an overkill.) So here is a first proposal.
PassOptionsToPackage{svgnames}{xcolor}
documentclass[12pt,a4paper]{scrartcl}
usepackage{tikz, pgf}
usepackage{xltxtra}
renewcommand{familydefault}{sfdefault}
usepackage[T1]{fontenc}
usetikzlibrary{
positioning,
shapes.geometric,
shapes.misc,
shadows.blur,
calc}
newcounter{hexa}
begin{document}
begin{tikzpicture}[my hexa/.style={blur shadow,chamfered rectangle,chamfered rectangle
xsep=2cm,draw,text=white,path picture={%
draw[white] let p1=($(path picture bounding box.north)-(path picture
bounding box.east)$) in
([xshift=-1pt]path picture bounding box.east)
-- ++(-y1+1pt,y1-1pt) -- ++(2*x1,0);}},
my elli/.style={blur shadow,ellipse,draw,text=white,path picture={%
fill[white] let p1=($(path picture bounding box.north)-(path picture
bounding box.east)$) in ([xshift=-1pt]path picture bounding box.east)
to[out=90,in=0,looseness=0.8] ([yshift=-1pt]path picture bounding box.north)
to[out=0,in=90,looseness=0.7] cycle;
}},
shaded triangle/.style={blur shadow,regular polygon,regular polygon sides=3,shape border rotate=0,
inner sep=1pt,draw,inner color=#1!10,outer color=#1}]
node[my hexa,fill=RoyalBlue] (Glc1) {GlcN Ac};
node[right=of Glc1,my hexa,fill=DarkMagenta] (Mur1) {MurN Ac};
node[right=of Mur1,my hexa,fill=RoyalBlue] (Glc2) {GlcN Ac};
node[right=of Glc2,my hexa,fill=DarkMagenta] (Mur2) {MurN Ac};
%
node[below=of Mur1,my elli,fill=DarkGreen] (L-Ala1) {L-Ala};
node[below left=8mm and 5mm of L-Ala1,my elli,fill=purple] (D-Glu1)
{textsc{d}-Glu};
node[below left=8mm and 5mm of D-Glu1,my elli,fill=DarkRed] (L-Lys1)
{textsc{l}-Lys};
node[right=3mm of L-Lys1,my elli,fill=green!80!black] (Gly1) {Gly};
node[right=3mm of Gly1,my elli,fill=green!80!black] (Gly2) {Gly};
node[right=3mm of Gly2,my elli,fill=green!80!black] (Gly3) {Gly};
node[right=3mm of Gly3,my elli,fill=green!80!black] (Gly4) {Gly};
node[right=3mm of Gly4,my elli,fill=green!80!black] (Gly5) {Gly};
node[right=3mm of Gly5,my elli,fill=cyan] (D-Ala1) {D-Ala};
node[below=8mm of L-Lys1,my elli,fill=cyan] (D-Ala2) {D-Ala};
%
node[below left=8mm and -5mm of D-Ala1,my elli,fill=DarkRed] (L-Lys2)
{textsc{l}-Lys};
node[below left=8mm and -5mm of L-Lys2,my elli,fill=purple] (D-Glu2)
{textsc{d}-Glu};
node[below left=8mm and -5mm of D-Glu2,my elli,fill=DarkGreen] (L-Ala2)
{L-Ala};
%
node[below=of L-Ala2,my hexa,fill=DarkMagenta] (Mur3) {MurN Ac};
node[left=of Mur3,my hexa,fill=RoyalBlue] (Glc3) {GlcN Ac};
node[left=of Glc3,my hexa,fill=DarkMagenta] (Mur4) {MurN Ac};
node[right=of Mur3,my hexa,fill=RoyalBlue] (Glc4) {GlcN Ac};
%
draw (Glc1) -- (Mur1) -- (Glc2) -- (Mur2);
draw (Glc2) -- (L-Ala1) -- (D-Glu1) -- (L-Lys1)
-- (Gly1) -- (Gly2) -- (Gly3) -- (Gly4) -- (Gly5)
-- (D-Ala1) -- (L-Lys2) -- (D-Glu2) -- (L-Ala2) -- (Mur3) --
(Glc3) -- (Mur4);
draw (Mur3) -- (Glc4);
draw (L-Lys1) -- (D-Ala2);
%
node[above=5mm of Gly3,shaded triangle=red] (E4) {E4};
draw[red,thick,-latex] (E4.south west) -- ($(Gly2)!0.5!(Gly3)$);
draw[red,thick,-latex] (E4.south east) -- ($(Gly3)!0.5!(Gly4)$);
path (Gly5) -- (D-Ala1) coordinate[midway](aux);
node[anchor=south,shaded triangle=red] (E5) at (aux|-E4.south) {E5};
draw[red,thick,-latex] (E5.south) -- (aux);
node[right=2mm of D-Glu1] (txt1) {NH$_2$};
node[left=2mm of D-Glu2] (txt2) {NH$_2$};
draw (D-Glu1) -- (txt1);
draw (D-Glu2) -- (txt2);
end{tikzpicture}
end{document}
To make it smaller, you could scale it (e.g. scale=0.8,transform shape
) and/or adjust the node distance
.
PassOptionsToPackage{svgnames}{xcolor}
documentclass[12pt,a4paper]{scrartcl}
usepackage{tikz, pgf}
usepackage{xltxtra}
renewcommand{familydefault}{sfdefault}
usepackage[T1]{fontenc}
usetikzlibrary{
positioning,
shapes.geometric,
shapes.misc,
shadows.blur,
calc}
newcounter{hexa}
begin{document}
begin{tikzpicture}[node distance=3mm,scale=0.8,transform shape,
every shadow/.style={shadow xshift=-0.5ex,shadow yshift=-0.5ex},
my hexa/.style={blur shadow,chamfered rectangle,chamfered rectangle
xsep=2cm,draw,text=white,path picture={%
draw[white] let p1=($(path picture bounding box.north)-(path picture
bounding box.east)$) in
([xshift=-1pt]path picture bounding box.east)
-- ++(-y1+1pt,y1-1pt) -- ++(2*x1,0);}},
my elli/.style={blur shadow,ellipse,draw,text=white,path picture={%
fill[white] let p1=($(path picture bounding box.north)-(path picture
bounding box.east)$) in ([xshift=-1pt]path picture bounding box.east)
to[out=90,in=0,looseness=0.8] ([yshift=-1pt]path picture bounding box.north)
to[out=0,in=90,looseness=0.7] cycle;
}},
shaded triangle/.style={blur shadow,regular polygon,regular polygon sides=3,shape border rotate=0,
inner sep=1pt,draw,inner color=#1!10,outer color=#1}]
node[my hexa,fill=RoyalBlue] (Glc1) {GlcN Ac};
node[right=of Glc1,my hexa,fill=DarkMagenta] (Mur1) {MurN Ac};
node[right=of Mur1,my hexa,fill=RoyalBlue] (Glc2) {GlcN Ac};
node[right=of Glc2,my hexa,fill=DarkMagenta] (Mur2) {MurN Ac};
%
node[below=of Mur1,my elli,fill=DarkGreen] (L-Ala1) {L-Ala};
node[below left=8mm and 5mm of L-Ala1,my elli,fill=purple] (D-Glu1)
{textsc{d}-Glu};
node[below left=8mm and 5mm of D-Glu1,my elli,fill=DarkRed] (L-Lys1)
{textsc{l}-Lys};
node[right=3mm of L-Lys1,my elli,fill=green!80!black] (Gly1) {Gly};
node[right=3mm of Gly1,my elli,fill=green!80!black] (Gly2) {Gly};
node[right=3mm of Gly2,my elli,fill=green!80!black] (Gly3) {Gly};
node[right=3mm of Gly3,my elli,fill=green!80!black] (Gly4) {Gly};
node[right=3mm of Gly4,my elli,fill=green!80!black] (Gly5) {Gly};
node[right=3mm of Gly5,my elli,fill=cyan] (D-Ala1) {D-Ala};
node[below=8mm of L-Lys1,my elli,fill=cyan] (D-Ala2) {D-Ala};
%
node[below left=8mm and -2mm of D-Ala1,my elli,fill=DarkRed] (L-Lys2)
{textsc{l}-Lys};
node[below left=8mm and -2mm of L-Lys2,my elli,fill=purple] (D-Glu2)
{textsc{d}-Glu};
node[below left=8mm and -2mm of D-Glu2,my elli,fill=DarkGreen] (L-Ala2)
{L-Ala};
%
node[below=of L-Ala2,my hexa,fill=DarkMagenta] (Mur3) {MurN Ac};
node[left=of Mur3,my hexa,fill=RoyalBlue] (Glc3) {GlcN Ac};
node[left=of Glc3,my hexa,fill=DarkMagenta] (Mur4) {MurN Ac};
node[right=of Mur3,my hexa,fill=RoyalBlue] (Glc4) {GlcN Ac};
%
draw (Glc1) -- (Mur1) -- (Glc2) -- (Mur2);
draw (Glc2) -- (L-Ala1) -- (D-Glu1) -- (L-Lys1)
-- (Gly1) -- (Gly2) -- (Gly3) -- (Gly4) -- (Gly5)
-- (D-Ala1) -- (L-Lys2) -- (D-Glu2) -- (L-Ala2) -- (Mur3) --
(Glc3) -- (Mur4);
draw (Mur3) -- (Glc4);
draw (L-Lys1) -- (D-Ala2);
%
node[above=5mm of Gly3,shaded triangle=red] (E4) {E4};
draw[red,thick,-latex] (E4.south west) -- ($(Gly2)!0.5!(Gly3)$);
draw[red,thick,-latex] (E4.south east) -- ($(Gly3)!0.5!(Gly4)$);
path (Gly5) -- (D-Ala1) coordinate[midway](aux);
node[anchor=south,shaded triangle=red] (E5) at (aux|-E4.south) {E5};
draw[red,thick,-latex] (E5.south) -- (aux);
node[right=2mm of D-Glu1] (txt1) {NH$_2$};
node[left=2mm of D-Glu2] (txt2) {NH$_2$};
draw (D-Glu1) -- (txt1);
draw (D-Glu2) -- (txt2);
draw (Glc1.west) -- ++ (-0.2,0) (Mur2.east) -- ++ (0.2,0)
(Glc4.east) -- ++ (0.2,0) (Mur4.west) -- ++ (-0.2,0);
end{tikzpicture}
end{document}
This last version also comes with more realistic shadows, which are opposite to the bright spots.
Is there a way to make it smaller? But in a way that it is still comfortably readable and you don't have to change every single number by hand.
– fffff
Dec 29 '18 at 15:57
1
@fffff Yes, I added some information on possibilities to scale it.
– marmot
Dec 29 '18 at 16:04
when I compile it in texstudio (with xelatex) the shadows are rectangular, how do I fix that?
– fffff
Dec 29 '18 at 16:16
1
@fffff The screenshots show the results of compilations withxelatex
. Sorry, I never use texstudio. The only additional information I have is that Ulrike Fischer made an update that fixed some issues withshadow.blur
andxelatex
, so you may want to update your TeX installation. If that does not help, you could replaceshadows.blur
byshadows
andblur shadow
bydrop shadow
.
– marmot
Dec 29 '18 at 16:20
one little detail, how can you continue the line on the left and right of the polysaccharides a bit, in order to show that the chain continues?
– fffff
Dec 29 '18 at 16:44
|
show 1 more comment
I would like to suggest using a chamfered rectangle
for the hexagon, and set a large value of for chamfered rectangle xsep
. The pgfmanual writes on p. 736
Sets the distance that the chamfer extends horizontally beyond the
node contents (which includes the inner sep). If ⟨length⟩ is large,
such that the top and bottom chamfered edges would cross, then
⟨length⟩ is ignored and the chamfered edges are drawn so that they
meet in the middle.
and shows a hexagon. Further, you are loading positioning
, and I would like to suggest using it for relative positioning. (You may also look into chains, but I personally I find this sometimes a bit of an overkill.) So here is a first proposal.
PassOptionsToPackage{svgnames}{xcolor}
documentclass[12pt,a4paper]{scrartcl}
usepackage{tikz, pgf}
usepackage{xltxtra}
renewcommand{familydefault}{sfdefault}
usepackage[T1]{fontenc}
usetikzlibrary{
positioning,
shapes.geometric,
shapes.misc,
shadows.blur,
calc}
newcounter{hexa}
begin{document}
begin{tikzpicture}[my hexa/.style={blur shadow,chamfered rectangle,chamfered rectangle
xsep=2cm,draw,text=white,path picture={%
draw[white] let p1=($(path picture bounding box.north)-(path picture
bounding box.east)$) in
([xshift=-1pt]path picture bounding box.east)
-- ++(-y1+1pt,y1-1pt) -- ++(2*x1,0);}},
my elli/.style={blur shadow,ellipse,draw,text=white,path picture={%
fill[white] let p1=($(path picture bounding box.north)-(path picture
bounding box.east)$) in ([xshift=-1pt]path picture bounding box.east)
to[out=90,in=0,looseness=0.8] ([yshift=-1pt]path picture bounding box.north)
to[out=0,in=90,looseness=0.7] cycle;
}},
shaded triangle/.style={blur shadow,regular polygon,regular polygon sides=3,shape border rotate=0,
inner sep=1pt,draw,inner color=#1!10,outer color=#1}]
node[my hexa,fill=RoyalBlue] (Glc1) {GlcN Ac};
node[right=of Glc1,my hexa,fill=DarkMagenta] (Mur1) {MurN Ac};
node[right=of Mur1,my hexa,fill=RoyalBlue] (Glc2) {GlcN Ac};
node[right=of Glc2,my hexa,fill=DarkMagenta] (Mur2) {MurN Ac};
%
node[below=of Mur1,my elli,fill=DarkGreen] (L-Ala1) {L-Ala};
node[below left=8mm and 5mm of L-Ala1,my elli,fill=purple] (D-Glu1)
{textsc{d}-Glu};
node[below left=8mm and 5mm of D-Glu1,my elli,fill=DarkRed] (L-Lys1)
{textsc{l}-Lys};
node[right=3mm of L-Lys1,my elli,fill=green!80!black] (Gly1) {Gly};
node[right=3mm of Gly1,my elli,fill=green!80!black] (Gly2) {Gly};
node[right=3mm of Gly2,my elli,fill=green!80!black] (Gly3) {Gly};
node[right=3mm of Gly3,my elli,fill=green!80!black] (Gly4) {Gly};
node[right=3mm of Gly4,my elli,fill=green!80!black] (Gly5) {Gly};
node[right=3mm of Gly5,my elli,fill=cyan] (D-Ala1) {D-Ala};
node[below=8mm of L-Lys1,my elli,fill=cyan] (D-Ala2) {D-Ala};
%
node[below left=8mm and -5mm of D-Ala1,my elli,fill=DarkRed] (L-Lys2)
{textsc{l}-Lys};
node[below left=8mm and -5mm of L-Lys2,my elli,fill=purple] (D-Glu2)
{textsc{d}-Glu};
node[below left=8mm and -5mm of D-Glu2,my elli,fill=DarkGreen] (L-Ala2)
{L-Ala};
%
node[below=of L-Ala2,my hexa,fill=DarkMagenta] (Mur3) {MurN Ac};
node[left=of Mur3,my hexa,fill=RoyalBlue] (Glc3) {GlcN Ac};
node[left=of Glc3,my hexa,fill=DarkMagenta] (Mur4) {MurN Ac};
node[right=of Mur3,my hexa,fill=RoyalBlue] (Glc4) {GlcN Ac};
%
draw (Glc1) -- (Mur1) -- (Glc2) -- (Mur2);
draw (Glc2) -- (L-Ala1) -- (D-Glu1) -- (L-Lys1)
-- (Gly1) -- (Gly2) -- (Gly3) -- (Gly4) -- (Gly5)
-- (D-Ala1) -- (L-Lys2) -- (D-Glu2) -- (L-Ala2) -- (Mur3) --
(Glc3) -- (Mur4);
draw (Mur3) -- (Glc4);
draw (L-Lys1) -- (D-Ala2);
%
node[above=5mm of Gly3,shaded triangle=red] (E4) {E4};
draw[red,thick,-latex] (E4.south west) -- ($(Gly2)!0.5!(Gly3)$);
draw[red,thick,-latex] (E4.south east) -- ($(Gly3)!0.5!(Gly4)$);
path (Gly5) -- (D-Ala1) coordinate[midway](aux);
node[anchor=south,shaded triangle=red] (E5) at (aux|-E4.south) {E5};
draw[red,thick,-latex] (E5.south) -- (aux);
node[right=2mm of D-Glu1] (txt1) {NH$_2$};
node[left=2mm of D-Glu2] (txt2) {NH$_2$};
draw (D-Glu1) -- (txt1);
draw (D-Glu2) -- (txt2);
end{tikzpicture}
end{document}
To make it smaller, you could scale it (e.g. scale=0.8,transform shape
) and/or adjust the node distance
.
PassOptionsToPackage{svgnames}{xcolor}
documentclass[12pt,a4paper]{scrartcl}
usepackage{tikz, pgf}
usepackage{xltxtra}
renewcommand{familydefault}{sfdefault}
usepackage[T1]{fontenc}
usetikzlibrary{
positioning,
shapes.geometric,
shapes.misc,
shadows.blur,
calc}
newcounter{hexa}
begin{document}
begin{tikzpicture}[node distance=3mm,scale=0.8,transform shape,
every shadow/.style={shadow xshift=-0.5ex,shadow yshift=-0.5ex},
my hexa/.style={blur shadow,chamfered rectangle,chamfered rectangle
xsep=2cm,draw,text=white,path picture={%
draw[white] let p1=($(path picture bounding box.north)-(path picture
bounding box.east)$) in
([xshift=-1pt]path picture bounding box.east)
-- ++(-y1+1pt,y1-1pt) -- ++(2*x1,0);}},
my elli/.style={blur shadow,ellipse,draw,text=white,path picture={%
fill[white] let p1=($(path picture bounding box.north)-(path picture
bounding box.east)$) in ([xshift=-1pt]path picture bounding box.east)
to[out=90,in=0,looseness=0.8] ([yshift=-1pt]path picture bounding box.north)
to[out=0,in=90,looseness=0.7] cycle;
}},
shaded triangle/.style={blur shadow,regular polygon,regular polygon sides=3,shape border rotate=0,
inner sep=1pt,draw,inner color=#1!10,outer color=#1}]
node[my hexa,fill=RoyalBlue] (Glc1) {GlcN Ac};
node[right=of Glc1,my hexa,fill=DarkMagenta] (Mur1) {MurN Ac};
node[right=of Mur1,my hexa,fill=RoyalBlue] (Glc2) {GlcN Ac};
node[right=of Glc2,my hexa,fill=DarkMagenta] (Mur2) {MurN Ac};
%
node[below=of Mur1,my elli,fill=DarkGreen] (L-Ala1) {L-Ala};
node[below left=8mm and 5mm of L-Ala1,my elli,fill=purple] (D-Glu1)
{textsc{d}-Glu};
node[below left=8mm and 5mm of D-Glu1,my elli,fill=DarkRed] (L-Lys1)
{textsc{l}-Lys};
node[right=3mm of L-Lys1,my elli,fill=green!80!black] (Gly1) {Gly};
node[right=3mm of Gly1,my elli,fill=green!80!black] (Gly2) {Gly};
node[right=3mm of Gly2,my elli,fill=green!80!black] (Gly3) {Gly};
node[right=3mm of Gly3,my elli,fill=green!80!black] (Gly4) {Gly};
node[right=3mm of Gly4,my elli,fill=green!80!black] (Gly5) {Gly};
node[right=3mm of Gly5,my elli,fill=cyan] (D-Ala1) {D-Ala};
node[below=8mm of L-Lys1,my elli,fill=cyan] (D-Ala2) {D-Ala};
%
node[below left=8mm and -2mm of D-Ala1,my elli,fill=DarkRed] (L-Lys2)
{textsc{l}-Lys};
node[below left=8mm and -2mm of L-Lys2,my elli,fill=purple] (D-Glu2)
{textsc{d}-Glu};
node[below left=8mm and -2mm of D-Glu2,my elli,fill=DarkGreen] (L-Ala2)
{L-Ala};
%
node[below=of L-Ala2,my hexa,fill=DarkMagenta] (Mur3) {MurN Ac};
node[left=of Mur3,my hexa,fill=RoyalBlue] (Glc3) {GlcN Ac};
node[left=of Glc3,my hexa,fill=DarkMagenta] (Mur4) {MurN Ac};
node[right=of Mur3,my hexa,fill=RoyalBlue] (Glc4) {GlcN Ac};
%
draw (Glc1) -- (Mur1) -- (Glc2) -- (Mur2);
draw (Glc2) -- (L-Ala1) -- (D-Glu1) -- (L-Lys1)
-- (Gly1) -- (Gly2) -- (Gly3) -- (Gly4) -- (Gly5)
-- (D-Ala1) -- (L-Lys2) -- (D-Glu2) -- (L-Ala2) -- (Mur3) --
(Glc3) -- (Mur4);
draw (Mur3) -- (Glc4);
draw (L-Lys1) -- (D-Ala2);
%
node[above=5mm of Gly3,shaded triangle=red] (E4) {E4};
draw[red,thick,-latex] (E4.south west) -- ($(Gly2)!0.5!(Gly3)$);
draw[red,thick,-latex] (E4.south east) -- ($(Gly3)!0.5!(Gly4)$);
path (Gly5) -- (D-Ala1) coordinate[midway](aux);
node[anchor=south,shaded triangle=red] (E5) at (aux|-E4.south) {E5};
draw[red,thick,-latex] (E5.south) -- (aux);
node[right=2mm of D-Glu1] (txt1) {NH$_2$};
node[left=2mm of D-Glu2] (txt2) {NH$_2$};
draw (D-Glu1) -- (txt1);
draw (D-Glu2) -- (txt2);
draw (Glc1.west) -- ++ (-0.2,0) (Mur2.east) -- ++ (0.2,0)
(Glc4.east) -- ++ (0.2,0) (Mur4.west) -- ++ (-0.2,0);
end{tikzpicture}
end{document}
This last version also comes with more realistic shadows, which are opposite to the bright spots.
Is there a way to make it smaller? But in a way that it is still comfortably readable and you don't have to change every single number by hand.
– fffff
Dec 29 '18 at 15:57
1
@fffff Yes, I added some information on possibilities to scale it.
– marmot
Dec 29 '18 at 16:04
when I compile it in texstudio (with xelatex) the shadows are rectangular, how do I fix that?
– fffff
Dec 29 '18 at 16:16
1
@fffff The screenshots show the results of compilations withxelatex
. Sorry, I never use texstudio. The only additional information I have is that Ulrike Fischer made an update that fixed some issues withshadow.blur
andxelatex
, so you may want to update your TeX installation. If that does not help, you could replaceshadows.blur
byshadows
andblur shadow
bydrop shadow
.
– marmot
Dec 29 '18 at 16:20
one little detail, how can you continue the line on the left and right of the polysaccharides a bit, in order to show that the chain continues?
– fffff
Dec 29 '18 at 16:44
|
show 1 more comment
I would like to suggest using a chamfered rectangle
for the hexagon, and set a large value of for chamfered rectangle xsep
. The pgfmanual writes on p. 736
Sets the distance that the chamfer extends horizontally beyond the
node contents (which includes the inner sep). If ⟨length⟩ is large,
such that the top and bottom chamfered edges would cross, then
⟨length⟩ is ignored and the chamfered edges are drawn so that they
meet in the middle.
and shows a hexagon. Further, you are loading positioning
, and I would like to suggest using it for relative positioning. (You may also look into chains, but I personally I find this sometimes a bit of an overkill.) So here is a first proposal.
PassOptionsToPackage{svgnames}{xcolor}
documentclass[12pt,a4paper]{scrartcl}
usepackage{tikz, pgf}
usepackage{xltxtra}
renewcommand{familydefault}{sfdefault}
usepackage[T1]{fontenc}
usetikzlibrary{
positioning,
shapes.geometric,
shapes.misc,
shadows.blur,
calc}
newcounter{hexa}
begin{document}
begin{tikzpicture}[my hexa/.style={blur shadow,chamfered rectangle,chamfered rectangle
xsep=2cm,draw,text=white,path picture={%
draw[white] let p1=($(path picture bounding box.north)-(path picture
bounding box.east)$) in
([xshift=-1pt]path picture bounding box.east)
-- ++(-y1+1pt,y1-1pt) -- ++(2*x1,0);}},
my elli/.style={blur shadow,ellipse,draw,text=white,path picture={%
fill[white] let p1=($(path picture bounding box.north)-(path picture
bounding box.east)$) in ([xshift=-1pt]path picture bounding box.east)
to[out=90,in=0,looseness=0.8] ([yshift=-1pt]path picture bounding box.north)
to[out=0,in=90,looseness=0.7] cycle;
}},
shaded triangle/.style={blur shadow,regular polygon,regular polygon sides=3,shape border rotate=0,
inner sep=1pt,draw,inner color=#1!10,outer color=#1}]
node[my hexa,fill=RoyalBlue] (Glc1) {GlcN Ac};
node[right=of Glc1,my hexa,fill=DarkMagenta] (Mur1) {MurN Ac};
node[right=of Mur1,my hexa,fill=RoyalBlue] (Glc2) {GlcN Ac};
node[right=of Glc2,my hexa,fill=DarkMagenta] (Mur2) {MurN Ac};
%
node[below=of Mur1,my elli,fill=DarkGreen] (L-Ala1) {L-Ala};
node[below left=8mm and 5mm of L-Ala1,my elli,fill=purple] (D-Glu1)
{textsc{d}-Glu};
node[below left=8mm and 5mm of D-Glu1,my elli,fill=DarkRed] (L-Lys1)
{textsc{l}-Lys};
node[right=3mm of L-Lys1,my elli,fill=green!80!black] (Gly1) {Gly};
node[right=3mm of Gly1,my elli,fill=green!80!black] (Gly2) {Gly};
node[right=3mm of Gly2,my elli,fill=green!80!black] (Gly3) {Gly};
node[right=3mm of Gly3,my elli,fill=green!80!black] (Gly4) {Gly};
node[right=3mm of Gly4,my elli,fill=green!80!black] (Gly5) {Gly};
node[right=3mm of Gly5,my elli,fill=cyan] (D-Ala1) {D-Ala};
node[below=8mm of L-Lys1,my elli,fill=cyan] (D-Ala2) {D-Ala};
%
node[below left=8mm and -5mm of D-Ala1,my elli,fill=DarkRed] (L-Lys2)
{textsc{l}-Lys};
node[below left=8mm and -5mm of L-Lys2,my elli,fill=purple] (D-Glu2)
{textsc{d}-Glu};
node[below left=8mm and -5mm of D-Glu2,my elli,fill=DarkGreen] (L-Ala2)
{L-Ala};
%
node[below=of L-Ala2,my hexa,fill=DarkMagenta] (Mur3) {MurN Ac};
node[left=of Mur3,my hexa,fill=RoyalBlue] (Glc3) {GlcN Ac};
node[left=of Glc3,my hexa,fill=DarkMagenta] (Mur4) {MurN Ac};
node[right=of Mur3,my hexa,fill=RoyalBlue] (Glc4) {GlcN Ac};
%
draw (Glc1) -- (Mur1) -- (Glc2) -- (Mur2);
draw (Glc2) -- (L-Ala1) -- (D-Glu1) -- (L-Lys1)
-- (Gly1) -- (Gly2) -- (Gly3) -- (Gly4) -- (Gly5)
-- (D-Ala1) -- (L-Lys2) -- (D-Glu2) -- (L-Ala2) -- (Mur3) --
(Glc3) -- (Mur4);
draw (Mur3) -- (Glc4);
draw (L-Lys1) -- (D-Ala2);
%
node[above=5mm of Gly3,shaded triangle=red] (E4) {E4};
draw[red,thick,-latex] (E4.south west) -- ($(Gly2)!0.5!(Gly3)$);
draw[red,thick,-latex] (E4.south east) -- ($(Gly3)!0.5!(Gly4)$);
path (Gly5) -- (D-Ala1) coordinate[midway](aux);
node[anchor=south,shaded triangle=red] (E5) at (aux|-E4.south) {E5};
draw[red,thick,-latex] (E5.south) -- (aux);
node[right=2mm of D-Glu1] (txt1) {NH$_2$};
node[left=2mm of D-Glu2] (txt2) {NH$_2$};
draw (D-Glu1) -- (txt1);
draw (D-Glu2) -- (txt2);
end{tikzpicture}
end{document}
To make it smaller, you could scale it (e.g. scale=0.8,transform shape
) and/or adjust the node distance
.
PassOptionsToPackage{svgnames}{xcolor}
documentclass[12pt,a4paper]{scrartcl}
usepackage{tikz, pgf}
usepackage{xltxtra}
renewcommand{familydefault}{sfdefault}
usepackage[T1]{fontenc}
usetikzlibrary{
positioning,
shapes.geometric,
shapes.misc,
shadows.blur,
calc}
newcounter{hexa}
begin{document}
begin{tikzpicture}[node distance=3mm,scale=0.8,transform shape,
every shadow/.style={shadow xshift=-0.5ex,shadow yshift=-0.5ex},
my hexa/.style={blur shadow,chamfered rectangle,chamfered rectangle
xsep=2cm,draw,text=white,path picture={%
draw[white] let p1=($(path picture bounding box.north)-(path picture
bounding box.east)$) in
([xshift=-1pt]path picture bounding box.east)
-- ++(-y1+1pt,y1-1pt) -- ++(2*x1,0);}},
my elli/.style={blur shadow,ellipse,draw,text=white,path picture={%
fill[white] let p1=($(path picture bounding box.north)-(path picture
bounding box.east)$) in ([xshift=-1pt]path picture bounding box.east)
to[out=90,in=0,looseness=0.8] ([yshift=-1pt]path picture bounding box.north)
to[out=0,in=90,looseness=0.7] cycle;
}},
shaded triangle/.style={blur shadow,regular polygon,regular polygon sides=3,shape border rotate=0,
inner sep=1pt,draw,inner color=#1!10,outer color=#1}]
node[my hexa,fill=RoyalBlue] (Glc1) {GlcN Ac};
node[right=of Glc1,my hexa,fill=DarkMagenta] (Mur1) {MurN Ac};
node[right=of Mur1,my hexa,fill=RoyalBlue] (Glc2) {GlcN Ac};
node[right=of Glc2,my hexa,fill=DarkMagenta] (Mur2) {MurN Ac};
%
node[below=of Mur1,my elli,fill=DarkGreen] (L-Ala1) {L-Ala};
node[below left=8mm and 5mm of L-Ala1,my elli,fill=purple] (D-Glu1)
{textsc{d}-Glu};
node[below left=8mm and 5mm of D-Glu1,my elli,fill=DarkRed] (L-Lys1)
{textsc{l}-Lys};
node[right=3mm of L-Lys1,my elli,fill=green!80!black] (Gly1) {Gly};
node[right=3mm of Gly1,my elli,fill=green!80!black] (Gly2) {Gly};
node[right=3mm of Gly2,my elli,fill=green!80!black] (Gly3) {Gly};
node[right=3mm of Gly3,my elli,fill=green!80!black] (Gly4) {Gly};
node[right=3mm of Gly4,my elli,fill=green!80!black] (Gly5) {Gly};
node[right=3mm of Gly5,my elli,fill=cyan] (D-Ala1) {D-Ala};
node[below=8mm of L-Lys1,my elli,fill=cyan] (D-Ala2) {D-Ala};
%
node[below left=8mm and -2mm of D-Ala1,my elli,fill=DarkRed] (L-Lys2)
{textsc{l}-Lys};
node[below left=8mm and -2mm of L-Lys2,my elli,fill=purple] (D-Glu2)
{textsc{d}-Glu};
node[below left=8mm and -2mm of D-Glu2,my elli,fill=DarkGreen] (L-Ala2)
{L-Ala};
%
node[below=of L-Ala2,my hexa,fill=DarkMagenta] (Mur3) {MurN Ac};
node[left=of Mur3,my hexa,fill=RoyalBlue] (Glc3) {GlcN Ac};
node[left=of Glc3,my hexa,fill=DarkMagenta] (Mur4) {MurN Ac};
node[right=of Mur3,my hexa,fill=RoyalBlue] (Glc4) {GlcN Ac};
%
draw (Glc1) -- (Mur1) -- (Glc2) -- (Mur2);
draw (Glc2) -- (L-Ala1) -- (D-Glu1) -- (L-Lys1)
-- (Gly1) -- (Gly2) -- (Gly3) -- (Gly4) -- (Gly5)
-- (D-Ala1) -- (L-Lys2) -- (D-Glu2) -- (L-Ala2) -- (Mur3) --
(Glc3) -- (Mur4);
draw (Mur3) -- (Glc4);
draw (L-Lys1) -- (D-Ala2);
%
node[above=5mm of Gly3,shaded triangle=red] (E4) {E4};
draw[red,thick,-latex] (E4.south west) -- ($(Gly2)!0.5!(Gly3)$);
draw[red,thick,-latex] (E4.south east) -- ($(Gly3)!0.5!(Gly4)$);
path (Gly5) -- (D-Ala1) coordinate[midway](aux);
node[anchor=south,shaded triangle=red] (E5) at (aux|-E4.south) {E5};
draw[red,thick,-latex] (E5.south) -- (aux);
node[right=2mm of D-Glu1] (txt1) {NH$_2$};
node[left=2mm of D-Glu2] (txt2) {NH$_2$};
draw (D-Glu1) -- (txt1);
draw (D-Glu2) -- (txt2);
draw (Glc1.west) -- ++ (-0.2,0) (Mur2.east) -- ++ (0.2,0)
(Glc4.east) -- ++ (0.2,0) (Mur4.west) -- ++ (-0.2,0);
end{tikzpicture}
end{document}
This last version also comes with more realistic shadows, which are opposite to the bright spots.
I would like to suggest using a chamfered rectangle
for the hexagon, and set a large value of for chamfered rectangle xsep
. The pgfmanual writes on p. 736
Sets the distance that the chamfer extends horizontally beyond the
node contents (which includes the inner sep). If ⟨length⟩ is large,
such that the top and bottom chamfered edges would cross, then
⟨length⟩ is ignored and the chamfered edges are drawn so that they
meet in the middle.
and shows a hexagon. Further, you are loading positioning
, and I would like to suggest using it for relative positioning. (You may also look into chains, but I personally I find this sometimes a bit of an overkill.) So here is a first proposal.
PassOptionsToPackage{svgnames}{xcolor}
documentclass[12pt,a4paper]{scrartcl}
usepackage{tikz, pgf}
usepackage{xltxtra}
renewcommand{familydefault}{sfdefault}
usepackage[T1]{fontenc}
usetikzlibrary{
positioning,
shapes.geometric,
shapes.misc,
shadows.blur,
calc}
newcounter{hexa}
begin{document}
begin{tikzpicture}[my hexa/.style={blur shadow,chamfered rectangle,chamfered rectangle
xsep=2cm,draw,text=white,path picture={%
draw[white] let p1=($(path picture bounding box.north)-(path picture
bounding box.east)$) in
([xshift=-1pt]path picture bounding box.east)
-- ++(-y1+1pt,y1-1pt) -- ++(2*x1,0);}},
my elli/.style={blur shadow,ellipse,draw,text=white,path picture={%
fill[white] let p1=($(path picture bounding box.north)-(path picture
bounding box.east)$) in ([xshift=-1pt]path picture bounding box.east)
to[out=90,in=0,looseness=0.8] ([yshift=-1pt]path picture bounding box.north)
to[out=0,in=90,looseness=0.7] cycle;
}},
shaded triangle/.style={blur shadow,regular polygon,regular polygon sides=3,shape border rotate=0,
inner sep=1pt,draw,inner color=#1!10,outer color=#1}]
node[my hexa,fill=RoyalBlue] (Glc1) {GlcN Ac};
node[right=of Glc1,my hexa,fill=DarkMagenta] (Mur1) {MurN Ac};
node[right=of Mur1,my hexa,fill=RoyalBlue] (Glc2) {GlcN Ac};
node[right=of Glc2,my hexa,fill=DarkMagenta] (Mur2) {MurN Ac};
%
node[below=of Mur1,my elli,fill=DarkGreen] (L-Ala1) {L-Ala};
node[below left=8mm and 5mm of L-Ala1,my elli,fill=purple] (D-Glu1)
{textsc{d}-Glu};
node[below left=8mm and 5mm of D-Glu1,my elli,fill=DarkRed] (L-Lys1)
{textsc{l}-Lys};
node[right=3mm of L-Lys1,my elli,fill=green!80!black] (Gly1) {Gly};
node[right=3mm of Gly1,my elli,fill=green!80!black] (Gly2) {Gly};
node[right=3mm of Gly2,my elli,fill=green!80!black] (Gly3) {Gly};
node[right=3mm of Gly3,my elli,fill=green!80!black] (Gly4) {Gly};
node[right=3mm of Gly4,my elli,fill=green!80!black] (Gly5) {Gly};
node[right=3mm of Gly5,my elli,fill=cyan] (D-Ala1) {D-Ala};
node[below=8mm of L-Lys1,my elli,fill=cyan] (D-Ala2) {D-Ala};
%
node[below left=8mm and -5mm of D-Ala1,my elli,fill=DarkRed] (L-Lys2)
{textsc{l}-Lys};
node[below left=8mm and -5mm of L-Lys2,my elli,fill=purple] (D-Glu2)
{textsc{d}-Glu};
node[below left=8mm and -5mm of D-Glu2,my elli,fill=DarkGreen] (L-Ala2)
{L-Ala};
%
node[below=of L-Ala2,my hexa,fill=DarkMagenta] (Mur3) {MurN Ac};
node[left=of Mur3,my hexa,fill=RoyalBlue] (Glc3) {GlcN Ac};
node[left=of Glc3,my hexa,fill=DarkMagenta] (Mur4) {MurN Ac};
node[right=of Mur3,my hexa,fill=RoyalBlue] (Glc4) {GlcN Ac};
%
draw (Glc1) -- (Mur1) -- (Glc2) -- (Mur2);
draw (Glc2) -- (L-Ala1) -- (D-Glu1) -- (L-Lys1)
-- (Gly1) -- (Gly2) -- (Gly3) -- (Gly4) -- (Gly5)
-- (D-Ala1) -- (L-Lys2) -- (D-Glu2) -- (L-Ala2) -- (Mur3) --
(Glc3) -- (Mur4);
draw (Mur3) -- (Glc4);
draw (L-Lys1) -- (D-Ala2);
%
node[above=5mm of Gly3,shaded triangle=red] (E4) {E4};
draw[red,thick,-latex] (E4.south west) -- ($(Gly2)!0.5!(Gly3)$);
draw[red,thick,-latex] (E4.south east) -- ($(Gly3)!0.5!(Gly4)$);
path (Gly5) -- (D-Ala1) coordinate[midway](aux);
node[anchor=south,shaded triangle=red] (E5) at (aux|-E4.south) {E5};
draw[red,thick,-latex] (E5.south) -- (aux);
node[right=2mm of D-Glu1] (txt1) {NH$_2$};
node[left=2mm of D-Glu2] (txt2) {NH$_2$};
draw (D-Glu1) -- (txt1);
draw (D-Glu2) -- (txt2);
end{tikzpicture}
end{document}
To make it smaller, you could scale it (e.g. scale=0.8,transform shape
) and/or adjust the node distance
.
PassOptionsToPackage{svgnames}{xcolor}
documentclass[12pt,a4paper]{scrartcl}
usepackage{tikz, pgf}
usepackage{xltxtra}
renewcommand{familydefault}{sfdefault}
usepackage[T1]{fontenc}
usetikzlibrary{
positioning,
shapes.geometric,
shapes.misc,
shadows.blur,
calc}
newcounter{hexa}
begin{document}
begin{tikzpicture}[node distance=3mm,scale=0.8,transform shape,
every shadow/.style={shadow xshift=-0.5ex,shadow yshift=-0.5ex},
my hexa/.style={blur shadow,chamfered rectangle,chamfered rectangle
xsep=2cm,draw,text=white,path picture={%
draw[white] let p1=($(path picture bounding box.north)-(path picture
bounding box.east)$) in
([xshift=-1pt]path picture bounding box.east)
-- ++(-y1+1pt,y1-1pt) -- ++(2*x1,0);}},
my elli/.style={blur shadow,ellipse,draw,text=white,path picture={%
fill[white] let p1=($(path picture bounding box.north)-(path picture
bounding box.east)$) in ([xshift=-1pt]path picture bounding box.east)
to[out=90,in=0,looseness=0.8] ([yshift=-1pt]path picture bounding box.north)
to[out=0,in=90,looseness=0.7] cycle;
}},
shaded triangle/.style={blur shadow,regular polygon,regular polygon sides=3,shape border rotate=0,
inner sep=1pt,draw,inner color=#1!10,outer color=#1}]
node[my hexa,fill=RoyalBlue] (Glc1) {GlcN Ac};
node[right=of Glc1,my hexa,fill=DarkMagenta] (Mur1) {MurN Ac};
node[right=of Mur1,my hexa,fill=RoyalBlue] (Glc2) {GlcN Ac};
node[right=of Glc2,my hexa,fill=DarkMagenta] (Mur2) {MurN Ac};
%
node[below=of Mur1,my elli,fill=DarkGreen] (L-Ala1) {L-Ala};
node[below left=8mm and 5mm of L-Ala1,my elli,fill=purple] (D-Glu1)
{textsc{d}-Glu};
node[below left=8mm and 5mm of D-Glu1,my elli,fill=DarkRed] (L-Lys1)
{textsc{l}-Lys};
node[right=3mm of L-Lys1,my elli,fill=green!80!black] (Gly1) {Gly};
node[right=3mm of Gly1,my elli,fill=green!80!black] (Gly2) {Gly};
node[right=3mm of Gly2,my elli,fill=green!80!black] (Gly3) {Gly};
node[right=3mm of Gly3,my elli,fill=green!80!black] (Gly4) {Gly};
node[right=3mm of Gly4,my elli,fill=green!80!black] (Gly5) {Gly};
node[right=3mm of Gly5,my elli,fill=cyan] (D-Ala1) {D-Ala};
node[below=8mm of L-Lys1,my elli,fill=cyan] (D-Ala2) {D-Ala};
%
node[below left=8mm and -2mm of D-Ala1,my elli,fill=DarkRed] (L-Lys2)
{textsc{l}-Lys};
node[below left=8mm and -2mm of L-Lys2,my elli,fill=purple] (D-Glu2)
{textsc{d}-Glu};
node[below left=8mm and -2mm of D-Glu2,my elli,fill=DarkGreen] (L-Ala2)
{L-Ala};
%
node[below=of L-Ala2,my hexa,fill=DarkMagenta] (Mur3) {MurN Ac};
node[left=of Mur3,my hexa,fill=RoyalBlue] (Glc3) {GlcN Ac};
node[left=of Glc3,my hexa,fill=DarkMagenta] (Mur4) {MurN Ac};
node[right=of Mur3,my hexa,fill=RoyalBlue] (Glc4) {GlcN Ac};
%
draw (Glc1) -- (Mur1) -- (Glc2) -- (Mur2);
draw (Glc2) -- (L-Ala1) -- (D-Glu1) -- (L-Lys1)
-- (Gly1) -- (Gly2) -- (Gly3) -- (Gly4) -- (Gly5)
-- (D-Ala1) -- (L-Lys2) -- (D-Glu2) -- (L-Ala2) -- (Mur3) --
(Glc3) -- (Mur4);
draw (Mur3) -- (Glc4);
draw (L-Lys1) -- (D-Ala2);
%
node[above=5mm of Gly3,shaded triangle=red] (E4) {E4};
draw[red,thick,-latex] (E4.south west) -- ($(Gly2)!0.5!(Gly3)$);
draw[red,thick,-latex] (E4.south east) -- ($(Gly3)!0.5!(Gly4)$);
path (Gly5) -- (D-Ala1) coordinate[midway](aux);
node[anchor=south,shaded triangle=red] (E5) at (aux|-E4.south) {E5};
draw[red,thick,-latex] (E5.south) -- (aux);
node[right=2mm of D-Glu1] (txt1) {NH$_2$};
node[left=2mm of D-Glu2] (txt2) {NH$_2$};
draw (D-Glu1) -- (txt1);
draw (D-Glu2) -- (txt2);
draw (Glc1.west) -- ++ (-0.2,0) (Mur2.east) -- ++ (0.2,0)
(Glc4.east) -- ++ (0.2,0) (Mur4.west) -- ++ (-0.2,0);
end{tikzpicture}
end{document}
This last version also comes with more realistic shadows, which are opposite to the bright spots.
edited Dec 29 '18 at 17:01
answered Dec 29 '18 at 15:20
marmot
89.1k4102191
89.1k4102191
Is there a way to make it smaller? But in a way that it is still comfortably readable and you don't have to change every single number by hand.
– fffff
Dec 29 '18 at 15:57
1
@fffff Yes, I added some information on possibilities to scale it.
– marmot
Dec 29 '18 at 16:04
when I compile it in texstudio (with xelatex) the shadows are rectangular, how do I fix that?
– fffff
Dec 29 '18 at 16:16
1
@fffff The screenshots show the results of compilations withxelatex
. Sorry, I never use texstudio. The only additional information I have is that Ulrike Fischer made an update that fixed some issues withshadow.blur
andxelatex
, so you may want to update your TeX installation. If that does not help, you could replaceshadows.blur
byshadows
andblur shadow
bydrop shadow
.
– marmot
Dec 29 '18 at 16:20
one little detail, how can you continue the line on the left and right of the polysaccharides a bit, in order to show that the chain continues?
– fffff
Dec 29 '18 at 16:44
|
show 1 more comment
Is there a way to make it smaller? But in a way that it is still comfortably readable and you don't have to change every single number by hand.
– fffff
Dec 29 '18 at 15:57
1
@fffff Yes, I added some information on possibilities to scale it.
– marmot
Dec 29 '18 at 16:04
when I compile it in texstudio (with xelatex) the shadows are rectangular, how do I fix that?
– fffff
Dec 29 '18 at 16:16
1
@fffff The screenshots show the results of compilations withxelatex
. Sorry, I never use texstudio. The only additional information I have is that Ulrike Fischer made an update that fixed some issues withshadow.blur
andxelatex
, so you may want to update your TeX installation. If that does not help, you could replaceshadows.blur
byshadows
andblur shadow
bydrop shadow
.
– marmot
Dec 29 '18 at 16:20
one little detail, how can you continue the line on the left and right of the polysaccharides a bit, in order to show that the chain continues?
– fffff
Dec 29 '18 at 16:44
Is there a way to make it smaller? But in a way that it is still comfortably readable and you don't have to change every single number by hand.
– fffff
Dec 29 '18 at 15:57
Is there a way to make it smaller? But in a way that it is still comfortably readable and you don't have to change every single number by hand.
– fffff
Dec 29 '18 at 15:57
1
1
@fffff Yes, I added some information on possibilities to scale it.
– marmot
Dec 29 '18 at 16:04
@fffff Yes, I added some information on possibilities to scale it.
– marmot
Dec 29 '18 at 16:04
when I compile it in texstudio (with xelatex) the shadows are rectangular, how do I fix that?
– fffff
Dec 29 '18 at 16:16
when I compile it in texstudio (with xelatex) the shadows are rectangular, how do I fix that?
– fffff
Dec 29 '18 at 16:16
1
1
@fffff The screenshots show the results of compilations with
xelatex
. Sorry, I never use texstudio. The only additional information I have is that Ulrike Fischer made an update that fixed some issues with shadow.blur
and xelatex
, so you may want to update your TeX installation. If that does not help, you could replace shadows.blur
by shadows
and blur shadow
by drop shadow
.– marmot
Dec 29 '18 at 16:20
@fffff The screenshots show the results of compilations with
xelatex
. Sorry, I never use texstudio. The only additional information I have is that Ulrike Fischer made an update that fixed some issues with shadow.blur
and xelatex
, so you may want to update your TeX installation. If that does not help, you could replace shadows.blur
by shadows
and blur shadow
by drop shadow
.– marmot
Dec 29 '18 at 16:20
one little detail, how can you continue the line on the left and right of the polysaccharides a bit, in order to show that the chain continues?
– fffff
Dec 29 '18 at 16:44
one little detail, how can you continue the line on the left and right of the polysaccharides a bit, in order to show that the chain continues?
– fffff
Dec 29 '18 at 16:44
|
show 1 more comment
alternative solution, less fancy (but this can be simple add), with relative positioning of nodes and with some effort to make code short ...
documentclass[12pt,a4paper]{scrartcl}
renewcommand{familydefault}{sfdefault}
usepackage[T1]{fontenc}
usepackage[version=4]{mhchem}
PassOptionsToPackage{svgnames}{xcolor}
usepackage{tikz}
usetikzlibrary{calc, chains,
positioning,
shadows,
shapes.geometric, shapes.symbols
}
makeatletter
tikzset{suppress join/.code={deftikz@after@path{}}}
makeatother
begin{document}
begin{tikzpicture}[
node distance = 8mm and 6mm,
start chain = going right,
HEX/.style = {signal, signal to=left and right,
signal pointer angle=120,
draw=#1, fill=#1!60, text=white,
minimum height=10mm, inner sep=-3pt,
drop shadow,
on chain, join=by -},
ELL/.style = {ellipse, draw=#1, fill=#1!60, text=white,
minimum height=8mm, drop shadow,
on chain, join=by -},
CIR/.style = {circle, draw=olive, ball color=olive!50,
minimum height=8mm, drop shadow,
on chain, join=by -},
TRI/.style = {isosceles triangle, draw=red, fill=red!60,
isosceles triangle apex angle=60,
shape border rotate=90}
]
node (h11) [HEX=RoyalBlue] {GlcNAc};
node (h12) [HEX=DarkMagenta] {MurNAc};
node (h13) [HEX=RoyalBlue] {GlcNAc};
node (h14) [HEX=DarkMagenta] {MurNAc};
draw (h11.west) -- + (-0.5,0)
(h14.east) -- + ( 0.5,0);
%
node (e11) [ELL=teal,suppress join,
below=of h12] {L-Ala};
node (e12) [ELL=orange,
below left=of e11,
pin=right:ce{NH2}] {D-Glu};
node (e13) [ELL=teal, below left=of e12] {L-Lys};
draw (h12) -- (e11);
node (c1) [CIR,suppress join,
right=of e13] {Gly};
draw (e13) -- (c1);
%
node (c1) [CIR] {Gly};
node (c2) [CIR] {Gly};
node (c3) [CIR] {Gly};
node (c4) [CIR] {Gly};
node (e21) [ELL=teal,on chain,join=by -] {D-Ala};
node (e22) [ELL=purple,below left=of e21] {L-Lys};
node (e23) [ELL=purple!50!black,
below left=of e22,
pin=left:ce{NH2}] {D-Glu};
node (e24) [ELL=teal,below left=of e23] {L-Ala};
%
node (h23) [HEX=DarkMagenta,
below=of e24] {MurNAc};
node (h22) [HEX=RoyalBlue,left=of h23] {GlcNAc};
node (h21) [HEX=DarkMagenta,left=of h22] {MurNAc};
node (h24) [HEX=RoyalBlue,suppress join,
right=of h23] {GlcNAc};
draw (h21.west) -- + (-0.5,0)
(h23) -- (h24)
(h24.east) -- + ( 0.5,0);
%
node (A) [CIR,ball color=yellow, suppress join,
left=of e11] {A};
node (e25) [ELL=teal,suppress join,
below=of e13] {L-Ala};
draw (e13) -- (e25);
node (t1) [TRI, above=of c3] {E4};
coordinate (t2) at ($(c4)!0.5!(e21)$);
node (t3) [TRI, at=(t2 |- t1)] {E5};
draw[-latex,red, shorten <=1mm, shorten >=1mm]
(A) edge ($(h12)!0.5!(e11)$)
%
(t1) edge ($(c2)!0.5!(c3)$)
(t1) edge ($(c3)!0.5!(c4)$)
(t3) to (t2);
end{tikzpicture}
end{document}
add a comment |
alternative solution, less fancy (but this can be simple add), with relative positioning of nodes and with some effort to make code short ...
documentclass[12pt,a4paper]{scrartcl}
renewcommand{familydefault}{sfdefault}
usepackage[T1]{fontenc}
usepackage[version=4]{mhchem}
PassOptionsToPackage{svgnames}{xcolor}
usepackage{tikz}
usetikzlibrary{calc, chains,
positioning,
shadows,
shapes.geometric, shapes.symbols
}
makeatletter
tikzset{suppress join/.code={deftikz@after@path{}}}
makeatother
begin{document}
begin{tikzpicture}[
node distance = 8mm and 6mm,
start chain = going right,
HEX/.style = {signal, signal to=left and right,
signal pointer angle=120,
draw=#1, fill=#1!60, text=white,
minimum height=10mm, inner sep=-3pt,
drop shadow,
on chain, join=by -},
ELL/.style = {ellipse, draw=#1, fill=#1!60, text=white,
minimum height=8mm, drop shadow,
on chain, join=by -},
CIR/.style = {circle, draw=olive, ball color=olive!50,
minimum height=8mm, drop shadow,
on chain, join=by -},
TRI/.style = {isosceles triangle, draw=red, fill=red!60,
isosceles triangle apex angle=60,
shape border rotate=90}
]
node (h11) [HEX=RoyalBlue] {GlcNAc};
node (h12) [HEX=DarkMagenta] {MurNAc};
node (h13) [HEX=RoyalBlue] {GlcNAc};
node (h14) [HEX=DarkMagenta] {MurNAc};
draw (h11.west) -- + (-0.5,0)
(h14.east) -- + ( 0.5,0);
%
node (e11) [ELL=teal,suppress join,
below=of h12] {L-Ala};
node (e12) [ELL=orange,
below left=of e11,
pin=right:ce{NH2}] {D-Glu};
node (e13) [ELL=teal, below left=of e12] {L-Lys};
draw (h12) -- (e11);
node (c1) [CIR,suppress join,
right=of e13] {Gly};
draw (e13) -- (c1);
%
node (c1) [CIR] {Gly};
node (c2) [CIR] {Gly};
node (c3) [CIR] {Gly};
node (c4) [CIR] {Gly};
node (e21) [ELL=teal,on chain,join=by -] {D-Ala};
node (e22) [ELL=purple,below left=of e21] {L-Lys};
node (e23) [ELL=purple!50!black,
below left=of e22,
pin=left:ce{NH2}] {D-Glu};
node (e24) [ELL=teal,below left=of e23] {L-Ala};
%
node (h23) [HEX=DarkMagenta,
below=of e24] {MurNAc};
node (h22) [HEX=RoyalBlue,left=of h23] {GlcNAc};
node (h21) [HEX=DarkMagenta,left=of h22] {MurNAc};
node (h24) [HEX=RoyalBlue,suppress join,
right=of h23] {GlcNAc};
draw (h21.west) -- + (-0.5,0)
(h23) -- (h24)
(h24.east) -- + ( 0.5,0);
%
node (A) [CIR,ball color=yellow, suppress join,
left=of e11] {A};
node (e25) [ELL=teal,suppress join,
below=of e13] {L-Ala};
draw (e13) -- (e25);
node (t1) [TRI, above=of c3] {E4};
coordinate (t2) at ($(c4)!0.5!(e21)$);
node (t3) [TRI, at=(t2 |- t1)] {E5};
draw[-latex,red, shorten <=1mm, shorten >=1mm]
(A) edge ($(h12)!0.5!(e11)$)
%
(t1) edge ($(c2)!0.5!(c3)$)
(t1) edge ($(c3)!0.5!(c4)$)
(t3) to (t2);
end{tikzpicture}
end{document}
add a comment |
alternative solution, less fancy (but this can be simple add), with relative positioning of nodes and with some effort to make code short ...
documentclass[12pt,a4paper]{scrartcl}
renewcommand{familydefault}{sfdefault}
usepackage[T1]{fontenc}
usepackage[version=4]{mhchem}
PassOptionsToPackage{svgnames}{xcolor}
usepackage{tikz}
usetikzlibrary{calc, chains,
positioning,
shadows,
shapes.geometric, shapes.symbols
}
makeatletter
tikzset{suppress join/.code={deftikz@after@path{}}}
makeatother
begin{document}
begin{tikzpicture}[
node distance = 8mm and 6mm,
start chain = going right,
HEX/.style = {signal, signal to=left and right,
signal pointer angle=120,
draw=#1, fill=#1!60, text=white,
minimum height=10mm, inner sep=-3pt,
drop shadow,
on chain, join=by -},
ELL/.style = {ellipse, draw=#1, fill=#1!60, text=white,
minimum height=8mm, drop shadow,
on chain, join=by -},
CIR/.style = {circle, draw=olive, ball color=olive!50,
minimum height=8mm, drop shadow,
on chain, join=by -},
TRI/.style = {isosceles triangle, draw=red, fill=red!60,
isosceles triangle apex angle=60,
shape border rotate=90}
]
node (h11) [HEX=RoyalBlue] {GlcNAc};
node (h12) [HEX=DarkMagenta] {MurNAc};
node (h13) [HEX=RoyalBlue] {GlcNAc};
node (h14) [HEX=DarkMagenta] {MurNAc};
draw (h11.west) -- + (-0.5,0)
(h14.east) -- + ( 0.5,0);
%
node (e11) [ELL=teal,suppress join,
below=of h12] {L-Ala};
node (e12) [ELL=orange,
below left=of e11,
pin=right:ce{NH2}] {D-Glu};
node (e13) [ELL=teal, below left=of e12] {L-Lys};
draw (h12) -- (e11);
node (c1) [CIR,suppress join,
right=of e13] {Gly};
draw (e13) -- (c1);
%
node (c1) [CIR] {Gly};
node (c2) [CIR] {Gly};
node (c3) [CIR] {Gly};
node (c4) [CIR] {Gly};
node (e21) [ELL=teal,on chain,join=by -] {D-Ala};
node (e22) [ELL=purple,below left=of e21] {L-Lys};
node (e23) [ELL=purple!50!black,
below left=of e22,
pin=left:ce{NH2}] {D-Glu};
node (e24) [ELL=teal,below left=of e23] {L-Ala};
%
node (h23) [HEX=DarkMagenta,
below=of e24] {MurNAc};
node (h22) [HEX=RoyalBlue,left=of h23] {GlcNAc};
node (h21) [HEX=DarkMagenta,left=of h22] {MurNAc};
node (h24) [HEX=RoyalBlue,suppress join,
right=of h23] {GlcNAc};
draw (h21.west) -- + (-0.5,0)
(h23) -- (h24)
(h24.east) -- + ( 0.5,0);
%
node (A) [CIR,ball color=yellow, suppress join,
left=of e11] {A};
node (e25) [ELL=teal,suppress join,
below=of e13] {L-Ala};
draw (e13) -- (e25);
node (t1) [TRI, above=of c3] {E4};
coordinate (t2) at ($(c4)!0.5!(e21)$);
node (t3) [TRI, at=(t2 |- t1)] {E5};
draw[-latex,red, shorten <=1mm, shorten >=1mm]
(A) edge ($(h12)!0.5!(e11)$)
%
(t1) edge ($(c2)!0.5!(c3)$)
(t1) edge ($(c3)!0.5!(c4)$)
(t3) to (t2);
end{tikzpicture}
end{document}
alternative solution, less fancy (but this can be simple add), with relative positioning of nodes and with some effort to make code short ...
documentclass[12pt,a4paper]{scrartcl}
renewcommand{familydefault}{sfdefault}
usepackage[T1]{fontenc}
usepackage[version=4]{mhchem}
PassOptionsToPackage{svgnames}{xcolor}
usepackage{tikz}
usetikzlibrary{calc, chains,
positioning,
shadows,
shapes.geometric, shapes.symbols
}
makeatletter
tikzset{suppress join/.code={deftikz@after@path{}}}
makeatother
begin{document}
begin{tikzpicture}[
node distance = 8mm and 6mm,
start chain = going right,
HEX/.style = {signal, signal to=left and right,
signal pointer angle=120,
draw=#1, fill=#1!60, text=white,
minimum height=10mm, inner sep=-3pt,
drop shadow,
on chain, join=by -},
ELL/.style = {ellipse, draw=#1, fill=#1!60, text=white,
minimum height=8mm, drop shadow,
on chain, join=by -},
CIR/.style = {circle, draw=olive, ball color=olive!50,
minimum height=8mm, drop shadow,
on chain, join=by -},
TRI/.style = {isosceles triangle, draw=red, fill=red!60,
isosceles triangle apex angle=60,
shape border rotate=90}
]
node (h11) [HEX=RoyalBlue] {GlcNAc};
node (h12) [HEX=DarkMagenta] {MurNAc};
node (h13) [HEX=RoyalBlue] {GlcNAc};
node (h14) [HEX=DarkMagenta] {MurNAc};
draw (h11.west) -- + (-0.5,0)
(h14.east) -- + ( 0.5,0);
%
node (e11) [ELL=teal,suppress join,
below=of h12] {L-Ala};
node (e12) [ELL=orange,
below left=of e11,
pin=right:ce{NH2}] {D-Glu};
node (e13) [ELL=teal, below left=of e12] {L-Lys};
draw (h12) -- (e11);
node (c1) [CIR,suppress join,
right=of e13] {Gly};
draw (e13) -- (c1);
%
node (c1) [CIR] {Gly};
node (c2) [CIR] {Gly};
node (c3) [CIR] {Gly};
node (c4) [CIR] {Gly};
node (e21) [ELL=teal,on chain,join=by -] {D-Ala};
node (e22) [ELL=purple,below left=of e21] {L-Lys};
node (e23) [ELL=purple!50!black,
below left=of e22,
pin=left:ce{NH2}] {D-Glu};
node (e24) [ELL=teal,below left=of e23] {L-Ala};
%
node (h23) [HEX=DarkMagenta,
below=of e24] {MurNAc};
node (h22) [HEX=RoyalBlue,left=of h23] {GlcNAc};
node (h21) [HEX=DarkMagenta,left=of h22] {MurNAc};
node (h24) [HEX=RoyalBlue,suppress join,
right=of h23] {GlcNAc};
draw (h21.west) -- + (-0.5,0)
(h23) -- (h24)
(h24.east) -- + ( 0.5,0);
%
node (A) [CIR,ball color=yellow, suppress join,
left=of e11] {A};
node (e25) [ELL=teal,suppress join,
below=of e13] {L-Ala};
draw (e13) -- (e25);
node (t1) [TRI, above=of c3] {E4};
coordinate (t2) at ($(c4)!0.5!(e21)$);
node (t3) [TRI, at=(t2 |- t1)] {E5};
draw[-latex,red, shorten <=1mm, shorten >=1mm]
(A) edge ($(h12)!0.5!(e11)$)
%
(t1) edge ($(c2)!0.5!(c3)$)
(t1) edge ($(c3)!0.5!(c4)$)
(t3) to (t2);
end{tikzpicture}
end{document}
answered Dec 29 '18 at 18:26
Zarko
121k865158
121k865158
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.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- 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%2f467785%2fhelp-with-a-node-diagram%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