LaTeX forum ⇒ Graphics, Figures & Tablesxypic xytree "fancy line" Topic is solved

Information and discussion about graphics, figures & tables in LaTeX documents.
Linguist
Posts: 39
Joined: Mon Nov 07, 2011 12:07 pm

xypic xytree "fancy line"

Postby Linguist » Sat Jan 03, 2015 1:23 am

Hello,

I'm using the xytree package to draw autosegmental diagrams. The xytree package utilizes xypic for its functions.

What I want to do is place labels on the linking lines between different tiers. This is described in sections 1.4 and/or 2.9 of the xypic docmentation (specifically I want to be able to "delink" tiers as described in section 4.4 here: http://wiki.lyx.org/LyX/LinguistLyX#toc10).

Using the code in the above link I can do this in an xymatrix, but can't figure out how to transfer this to to the xytree autosegmental diagram.

The nub of the problem is I don't know how xytree uses xypic to make autosegmental diagrams; I just copied example code and extrapolated.

  1. \documentclass[a4paper,12pt]{report}
  2. \usepackage{xytree}
  3.  
  4. \begin{document}
  5.  
  6. {\xy
  7. <0pt,0pt>*\asrnode{k}="k",
  8. <1em,0pt>*\asrnode{a}="a",
  9. <2em,0pt>*\asrnode{t}="t",
  10. <0pt,1cm>*\asrnode{$\times$}="x1",
  11. <1em,1cm>*\asrnode{$\times$}="x2",
  12. <2em,1cm>*\asrnode{$\times$}="x3",
  13. <.5em,2cm>*\asrnode{$\mu$}="m1",
  14. <2em,2cm>*\asrnode{$\mu$}="m2",
  15. "k"+U;"x1"+D**\dir{-};
  16. "a"+U;"x2"+D**\dir{-};
  17. "t"+U;"x3"+D**\dir{-};
  18. "x1"+U;"m1"+D**\dir{-};
  19. "x2"+U;"m1"+D**\dir{-};
  20. "x3"+U;"m2"+D**\dir{-};
  21. \endxy}
  22.  
  23. %The vertical line on the right of this diagram has a =
  24. %which I want to be able to put on the diagram above.
  25. \xymatrix{
  26. V\ar@{-}[d]& C & V\ar@{--}[dll]\ar@{-}[d]|=\\
  27. H & & L
  28. }
  29.  
  30. \end{document}

Tags:

Linguist
Posts: 39
Joined: Mon Nov 07, 2011 12:07 pm

Postby Linguist » Sat Jan 03, 2015 7:35 pm

Looks like I keep solving my own probelms.

The key here is to use "arrows" instead of "directionals", as is done in the xytree autosegmental example code.

So to delink (read: place label which is an equals sign) the k from its timing slot in the previous example replace:

  1. "k"+U;"x1"+D**\dir{-};


with

  1. {\ar@{-}|="k"+U;"x1"+D};


In principle the equals sign could be replaced with an arbitrary string (within {}) that you wish to place over the linking line/arrow.

RossMoore
Posts: 3
Joined: Sun Jan 11, 2015 10:34 pm

Postby RossMoore » Mon Jan 12, 2015 12:59 am

Using an "=" sign for the break is not really the best, as it relies on the font character, including its height, depth width, and thickness of its line strokes.
viz.
Image
Notice the gap below, and how it is wider and clunkier than other elements in the graphic.

Better is to specify separate breaks for the individual bars and the gap between them.
  1. {\ar@{-}|-(.425)*@{|} |-{\hole} |-(.575)*@{|} "k"+U;"x1"+D};

resulting in
Image

Note how |- is used, to locate the break in the middle of the arrow/line, taking into account the size and any margins on the initial and terminal objects that it connects.
Similarly |-(factor) locates the point at factor along the line itself,
whereas |(factor) locates the point at factor between the basepoints of the initial and terminal objects.

To vertically align the "delinks" of several consecutive lines, between objects of different sizes say, you would probably find |(factor) to be easier than |-(factor),
though some trial-and-error may be needed to get the best value for the factor.

Linguist
Posts: 39
Joined: Mon Nov 07, 2011 12:07 pm

Postby Linguist » Tue Feb 03, 2015 12:44 pm

Great, thanks! This is a much more elegant solution!

And, being a linguist, I like elegant solutions!


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: No registered users and 4 guests