1

I'm having trouble getting phylogenetic trees to display correctly within the solution environment of the exam class. For some reason, they are positioned way far to the right (running off the page) in that environment. See MWE below.

% Compile with XeLaTeX to deal with EPS graphics in trees.

\documentclass[letterpaper,12pt,addpoints]{exam}
\usepackage{newicktree}
\printanswers

\begin{document}
\begin{questions}

\question[5] The tree is correctly positioned on the page if it comes after the solution environment.
\begin{solution}
\end{solution}
\begin{newicktree}
\righttree \contemporarytips\nobranchlengths \setunitlength{4in}
\drawtree{(((ferns \& allies, (angiosperms, gymnosperms)),bryophytes), blue-green algae);}
\end{newicktree}

\question[5] The tree is not correctly positioned within the solution environment.
\begin{solution}
\begin{newicktree}
\righttree \contemporarytips\nobranchlengths \setunitlength{4in}
\drawtree{(((ferns \& allies, (angiosperms, gymnosperms)),bryophytes), blue-green algae);}
\end{newicktree}
\end{solution}

\end{questions}
\end{document}
2
  • Package newicktree
    – Johannes_B
    Oct 14 '14 at 15:40
  • I'm wondering why the package author abuses \dimen20 (usually \jot) and \dimen21 (usually \leftmargin) in a context where something is typeset. Very bad LaTeX programming.
    – egreg
    Oct 14 '14 at 16:09
1

Inserting a blank line in the solution environment to create a new paragraph before the newicktree environment did the trick. See below for full code.

% Compile with XeLaTeX to deal with EPS graphics in trees.

\documentclass[letterpaper,12pt,addpoints]{exam}
\usepackage{newicktree}
\printanswers

\begin{document}
\begin{questions}

\question[5] The tree is correctly positioned on the page if it comes after the solution environment.
\begin{solution}
\end{solution}
\begin{newicktree}
\righttree \contemporarytips\nobranchlengths \setunitlength{4in}
\drawtree{(((ferns \& allies, (angiosperms, gymnosperms)),bryophytes), blue-green algae);}
\end{newicktree}

\question[5] The tree is not correctly positioned within the solution environment.
\begin{solution}

\begin{newicktree}
\righttree \contemporarytips\nobranchlengths \setunitlength{4in}
\drawtree{(((ferns \& allies, (angiosperms, gymnosperms)),bryophytes), blue-green algae);}
\end{newicktree}
\end{solution}

\end{questions}
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.