Graphics, Figures & Tablesxypic | Get rid of white Space in '\xygraph'

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
elisehopman
Posts: 3
Joined: Wed Nov 02, 2011 3:18 pm

xypic | Get rid of white Space in '\xygraph'

Post by elisehopman »

hello everyone,

I'm using xypic for my bachelor thesis about knots, and can't get this equation to look right. The problem is the white space between the \langle and the second picture. It's fine in the first one, and I don't get why it's there in the second one. I tried solving this by adding [l(0.25)], but that doesn't do the trick.

Code: Select all

\begin{equation}
\langle \xygraph{
     !{0;/r1.0pc/:} 
     [u(0.7)]
     !{\xoverh[1.5]}
     [lul]!{\sbendv[0.5]@(0)}
     [rr][u(0.5)]!{\sbendh[0.5]@(0)}
     [llll][r(0.25)][d(1.25)]!{\xcaph[-3]@(0)}           
   } \rangle  = \langle \xygraph{
     !{0;/r1.0pc/:}             
     [u(1.7)]
     !{\xoverh[1.5]}
     [ldd][ldl(0.5)]!{\sbendh[0.5]@(0)}
     [rr][d(0.5)]!{\sbendv[0.5]@(0)}
     [llll][r(0.25)][u(1.25)]!{\xcaph[-3]@(0)}
     }    \rangle
\end{equation}
It's not really a big problem, but I'm a perfectionist. Does anyone know how to fix this?

thanks in advance for trying to help!
Elise
Last edited by elisehopman on Wed Nov 16, 2011 6:15 pm, edited 2 times in total.

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

shadgrind
Posts: 140
Joined: Thu Jul 16, 2009 12:39 am

xypic | Get rid of white Space in '\xygraph'

Post by shadgrind »

Just use an \hspace command with a negative length, between the 2nd \langle and the 2nd \xygraph.

By the way, if you read the Board Rules you'll see that you are supposed to provide a complete minimal working example if you want help with some code. Otherwise people here may have no idea what packages you're loading, what options you're using, etc; you can't expect people to know how to help you otherwise. For example, here is a complete minimal working example for a solution to your problem:

Code: Select all

\documentclass{article}
\usepackage[all,knot]{xy}
\begin{document}
\begin{equation}
\langle \xygraph{
     !{0;/r1.0pc/:}
     [u(0.7)]
     !{\xoverh[1.5]}
     [lul]!{\sbendv[0.5]@(0)}
     [rr][u(0.5)]!{\sbendh[0.5]@(0)}
     [llll][r(0.25)][d(1.25)]!{\xcaph[-3]@(0)}           
   } \rangle = \langle\hspace{-4mm}\xygraph{
     !{0;/r1.0pc/:}             
     [u(1.7)]
     !{\xoverh[1.5]}
     [ldd][ldl(0.5)]!{\sbendh[0.5]@(0)}
     [rr][d(0.5)]!{\sbendv[0.5]@(0)}
     [llll][r(0.25)][u(1.25)]!{\xcaph[-3]@(0)}
     }    \rangle
\end{equation}
\end{document}
System: TeX Live 2012, Fedora 18 x86_64, GNU Emacs 24.2
elisehopman
Posts: 3
Joined: Wed Nov 02, 2011 3:18 pm

Re: xypic | Get rid of white Space in '\xygraph'

Post by elisehopman »

Thanks for your help, it looks fine now. I will use a minimal working example next time, thanks for pointing that out to me.
RossMoore
Posts: 3
Joined: Sun Jan 11, 2015 10:34 pm

xypic | Get rid of white Space in '\xygraph'

Post by RossMoore »

Yes.
The line that causes the extra space at the left is this one:

Code: Select all

[ldd][ldl(0.5)]!{\sbendh[0.5]@(0)}
Simplify it to become:

Code: Select all

[d(2.5)ll] !{\sbendh[0.5]@(0)}
The reason is a subtlety that occurs when you use a factor to move to a new position,
when that factor has a value less than 1;
e.g. [l(0.5)] first finds [l] then moves to half way from the current node.

In doing this, the position resulting from [l] is included within the rectangle for the whole diagram. This is OK, if it is already within the bounds, but causes the size to increase when it lies outside.

In your coding [ldl(0.5)] first visits [ldl] so extends the bounds to accommodate 2 hops to the left, before moving to halfway between this and the previous node.

By using [d(2.5)ll] the first move is to just 1 hop down, then to 2.5 times this displacement. But you want this within the bounds, so everything looks OK.
Post Reply