Graphics, Figures & Tablesxypic xytree "fancy line"

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

xypic xytree "fancy line"

Post by Linguist »

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.

Code: Select all

\documentclass[a4paper,12pt]{report}
\usepackage{xytree}

\begin{document}

{\xy
<0pt,0pt>*\asrnode{k}="k",
<1em,0pt>*\asrnode{a}="a",
<2em,0pt>*\asrnode{t}="t",
<0pt,1cm>*\asrnode{$\times$}="x1",
<1em,1cm>*\asrnode{$\times$}="x2",
<2em,1cm>*\asrnode{$\times$}="x3",
<.5em,2cm>*\asrnode{$\mu$}="m1",
<2em,2cm>*\asrnode{$\mu$}="m2",
"k"+U;"x1"+D**\dir{-};
"a"+U;"x2"+D**\dir{-};
"t"+U;"x3"+D**\dir{-};
"x1"+U;"m1"+D**\dir{-};
"x2"+U;"m1"+D**\dir{-};
"x3"+U;"m2"+D**\dir{-};
\endxy}

%The vertical line on the right of this diagram has a = 
%which I want to be able to put on the diagram above.
\xymatrix{
V\ar@{-}[d]& C & V\ar@{--}[dll]\ar@{-}[d]|=\\
H & & L
}

\end{document}

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

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

xypic xytree "fancy line"

Post by Linguist »

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:

Code: Select all

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

Code: Select all

{\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

xypic xytree "fancy line"

Post by RossMoore »

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.

Code: Select all

{\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: 43
Joined: Mon Nov 07, 2011 12:07 pm

Re: xypic xytree "fancy line"

Post by Linguist »

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

And, being a linguist, I like elegant solutions!
Post Reply