# Conflict between Fontspec and xypic?

I use the xyling package to draw tree diagrams. For the text I would like to use the CharisSIL font using the fontspec package. But combining these two gives poor quality tree diagrams: the lines are squiggly rather than straight. The trees are fine without fontspec.

MWE:

\documentclass[12pt]{article}
\usepackage{fontspec}
\setmainfont{CharisSIL}
\let\B\relax %to resolve a conflict in the definition of these commands between xyling and xunicode (the latter called by fontspec)
\let\T\relax
\usepackage{xyling} % for trees

\begin{document}

\Tree{&\K{CP} \V \\
\K{DP} && \K{C$'$} \V \\
& \K{C} && \K{IP}
}

\end{document}


• Have you considered using tikz instead. Lots of tree support. – daleif Sep 1 '16 at 19:09
• There is no XeTeX driver in Xy-pic, as far as I know, so oblique lines are realized by joining small segments and they look jagged. – egreg Sep 1 '16 at 20:00
• @egreg then why does the OP get a got result by removing fontspec? – daleif Sep 1 '16 at 21:36
• @daleif Actually, with the OP's code I get no line. – egreg Sep 1 '16 at 21:41
• Also xyling is from 2004, did XeLaTeX even exist back then. The first page of the manual explicitly mentions that xy is called with the dvips option – daleif Sep 2 '16 at 11:34

You could use the forest package, but it's certainly not the only one out there.

## Code

\documentclass[margin=10pt]{standalone}
\usepackage{fontspec}
\usepackage[linguistics]{forest}

\newfontfamily\charis{Charis SIL}

\forestset{
mytree/.style={for tree={font=\charis}}
}

\begin{document}
\begin{forest} mytree,
[CP
[DP]
[C'
[C]
[IP]
]
]
\end{forest}
\end{document}