5

I want to use tikz-qtree to add trees to a book formatted with tufte-book. For the most part, they work. However, one example does not. Consider the following minimal example:

\documentclass{tufte-book}
\usepackage{tikz-qtree}
\begin{document}
    \Tree [.mabubundok ma- [.bubundok \textsc{red} bundok ] ]
\end{document}

When I compile it, I get the following error message:

Package tikz Error: Giving up on this path. Did you forget a semicolon?.

However, if I change the document class to article, it compiles just fine:

\documentclass{article}
\usepackage{tikz-qtree}
\begin{document}
    \Tree [.mabubundok ma- [.bubundok \textsc{red} bundok ] ]
\end{document}

What is causing this behavior?

  • Welcome to TeX.se and thanks for providing minimal example documents with your question! – Alan Munn Oct 8 '19 at 19:20
5

The problem is not with tikz-qtree but with the use of \textsc within the tree. The tufte-book class redefines \textsc using commands from the soul package. So you need to use \textsmallcaps instead.

\documentclass{tufte-book}
\usepackage{tikz-qtree}
\begin{document}
    \Tree [.mabubundok ma- [.bubundok \textsmallcaps{red} bundok ] ]
\end{document}

output  of code

You can see this clearly by comparing \textsc and \textsmallcaps. The former is letter spaced, while the latter is regular \scshape:

\documentclass{tufte-book}

\begin{document}
\textsc{foo}

\textsmallcaps{foo}
\end{document}

output of code

This example provides a good argument for using semantic markup rather than formatting elements directly. So a better version of your code would be to define a macro for grammatical feature markup, which would then be defined as using \scshape directly, and only changed once in the document.

\documentclass{tufte-book}
\usepackage{tikz-qtree}
\DeclareTextFontCommand{\feat}{\scshape}
\begin{document}
    \Tree [.mabubundok ma- [.bubundok \feat{red} bundok ] ]
\end{document}
| improve this answer | |
  • Thanks, @Alan Munn. That solved it. Now where is the checkbox I'm supposed to check saying I accept this answer? – dmort27 Oct 9 '19 at 19:25
  • @dmort27 just below the voting buttons there is a faint green checkmark icon. Just click on that and it will display fully to mark the question as accepted. – Alan Munn Oct 9 '19 at 22:28

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.