1

enter image description here

I can't figure out how I can draw this with XYpic. I'm very new to XYpic. I tried the following:

\documentclass{article}
\usepackage[graph,knot,curve]{xy}
\begin{document}
$$\xygraph{ !{0; /r1.0pc/ :} ! {\vcap[4]} ! {\vcap[-4]} [l(1.05)] ! 
                               {\vcap[6]} ! {\vcap[-6]} [rddd] ! 
                               {\vcap[4]} ! {\vcap[-4]} [l(1.05)] ! 
                               {\vcap[6]} ! {\vcap[-6]} }
$$
\end{document} 

I don't know how to put in the circles with the T and U and also the "holes" at the crossings.

4
  • This is a very specific question, right now with a do it for me-flavour. Please show what you have tried so far and where you got stuck. In other words, a minimal working example.
    – Johannes_B
    Apr 5, 2015 at 7:42
  • I'm sorry. I'm very new to XYpic. I tried the following: $ \xygraph{ !{0; /r1.0pc/ :} ! {\vcap[4]} ! {\vcap[-4]} [l(1.05)] ! {\vcap[6]} ! {\vcap[-6]} [rddd] ! {\vcap[4]} ! {\vcap[-4]} [l(1.05)] ! {\vcap[6]} ! {\vcap[-6]} }$ I don't know how to put in the circles with the T and U and also the "holes" at the crossings.
    – Zeus
    Apr 5, 2015 at 8:03
  • 1
    Please add the information to the question. The edit button is to the left of your user name. Code markup in comments doesn't work for blocks.
    – Johannes_B
    Apr 5, 2015 at 8:23
  • 1
    Maybe modern TikZ is a better alternative? The documentation has a very good tutorial.
    – Johannes_B
    Apr 5, 2015 at 8:23

2 Answers 2

4

An exercise in drawing things in the right Z-order in Metapost.

enter image description here

prologues := 3;
outputtemplate := "%j%c.eps";

beginfig(1);
  path r[], c[];

  r1 = fullcircle scaled 50 shifted 16 up;
  r2 = fullcircle scaled 60 shifted 16 up;
  r3 = fullcircle scaled 50 shifted 16 down;
  r4 = fullcircle scaled 60 shifted 16 down;
  c1 = fullcircle scaled 16 shifted 1/2[point 2 of r1, point 2 of r2];
  c2 = fullcircle scaled 16 shifted 1/2[point 6 of r3, point 6 of r4];

  draw subpath (2,6) of r1;
  draw subpath (2,6) of r2;
  draw subpath (-2,2) of r3;
  draw subpath (-2,2) of r4;
  drawoptions(withpen pencircle scaled 2 withcolor background);
  linecap := butt;
  draw subpath (-2,2) of r1;
  draw subpath (-2,2) of r2;
  draw subpath (2,6) of r3;
  draw subpath (2,6) of r4;
  drawoptions();
  draw subpath (-2,2) of r1;
  draw subpath (-2,2) of r2;
  draw subpath (2,6) of r3;
  draw subpath (2,6) of r4;

  defaultfont := "bchb8r"; defaultscale := 0.8;
  fill c1 withcolor .9 white; draw c1; label("T",center c1);
  fill c2 withcolor .9 white; draw c2; label("U",center c2);

  label.bot("H(T,U)", point 6 of c2);

endfig;
end.

Note that subpath (2,6) of fullcircle gives you the left-hand half, while subpath (-2,2) gives you the right.

0
4

Here is a simple code, using the pst-node module of pstricks:

\documentclass[12pt, pdf, x11names, a4paper]{standalone}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{pst-node}

\begin{document}

\begin{pspicture*}(-2,-4.5)(2,3.6)
    \def\R{1.75}
    \psset{radius=0.6}
    \pnodes(0,3){t}(0,-3){u}(0,1.25){c}
    {\psset{doubleline, doublesep = 0.4, linecolor=LightCyan3}
        \psarcn(c){\R}{-90}{90}
        \nccircle[shift = 2ex, linecolor=Red3]{-}{u}{\R}
        \psarc(c){\R}{-90}{90}}
    \psset{fillstyle=solid, fillcolor=Snow2!30!LightCyan3, linecolor=LightCyan4}
    \Cnodeput{0}(0,3){T}{$ \mathbf{T} $}
    \Cnodeput{0}(0,-3){U}{$ \mathbf{U} $}
    \uput{1}[d](U){$ \mathbf{H(T, U)} $}
\end{pspicture*}

\end{document} 

enter image description here

1
  • Note you can easily change the size of the figure if required, without changing the size of the texts: it is enough to add \psset{unit=the value you want} (the default is 1cm, as you might expect).
    – Bernard
    Apr 5, 2015 at 12:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .