7

I've got a snippet of tikz-qtree which causes

** ERROR ** DVI stack exceeded limit.

when compiling with xelatex, but works fine with pdflatex. But I need xelatex because I've got a lot of unicode in the document.

There's the code:

\documentclass[11pt]{article}
\usepackage{savetrees}
\usepackage{tikz-qtree, tikz-qtree-compat}
\tikzset{every tree node/.style={align=center, anchor=north}}
\usetikzlibrary{positioning}

\begin{document}
\begin{tikzpicture}
\tikzset{every tree node/.style={align=center, anchor=north}}
\Tree [.CP [.C' [.C\\ø ] [.TP [.T' [.T\\ed ] [.VP [.DP \edge[roof ];\\I ] [.V' [.V\\ask ] [.CP [.C' [.C ø ] [.TP [.T' [.T\\ed ] [.VP [.DP \edge[roof ];\\John ] [.V' [.V\\believe ] [.CP [.C' [.C ø ] [.TP [.T' [.T\\ed ] [.VP [.DP \edge[roof ];\\Mary ] [.V' [.V' [.V\\lie ] ] [.PP \edge[roof ];\\why ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ]
\end{tikzpicture}
\end{document}

And to download: http://sprunge.us/OaIO

Joseph Wright
  • 259,911
  • 34
  • 706
  • 1,036

1 Answers1

5

It is an error message from xdvipdfmx. The two stages can be called by:

xelatex -no-pdf test
xdvipdfmx test.xdv

The latter shows a more verbose warning:

** WARNING ** DVI need stack depth of 320,
** WARNING ** but DVI_STACK_DEPTH_MAX is 256.
** ERROR ** Capacity exceeded.

Looking at the sources dvi.c:

#define DVI_STACK_DEPTH_MAX  256u
...
if (dvi_info.stackdepth > DVI_STACK_DEPTH_MAX) {
  WARN("DVI need stack depth of %d,", dvi_info.stackdepth);
  WARN("but DVI_STACK_DEPTH_MAX is %d.", DVI_STACK_DEPTH_MAX);
  ERROR("Capacity exceeded.");
}
...
static struct   dvi_registers dvi_state;
static struct   dvi_registers dvi_stack[DVI_STACK_DEPTH_MAX];
static unsigned dvi_stack_depth = 0 ;  

That means, the size is hard-coded and cannot be changed at runtime. Recompilation of XeTeX would be needed.

Alternatively generate the image as standalone document (pdfTeX, …) and embed it into your XeTeX document as PDF file.

Heiko Oberdiek
  • 271,626
  • The limitation is also with latex (and DVI output): there's no error, but dvitype says 11020: push DVItype capacity exceeded (stack size=100)! and Bad DVI file: page ended unexpectedly! – egreg Dec 09 '14 at 16:36