Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm using TeXShop on Mac OS X (based on LaTeX) in conjunction with the graphvizzz package in order to draw inline directed graphs in my documents (with the use of write18 and the dot command). Apparently each graph uses a \write command, so I got up to about a dozen inline graphs in a single document and ran out of \write slots. When I try to build the document, I now get the following error:

? ! No room for a new \write .

I've done some reading about this problem, and there's no immediately apparent way to increase the number of \writes available to me. Is there another way I can continue to use this package without requiring a \write for each graph?

For reference, a sample document looks something like this:

\documentclass{article}
\usepackage{graphvizzz}

\begin{document}

This is a state machine:
\digraph[scale=0.5]{machine}{
   margin = "0 0 0 0";
   rankdir = "LR";
   node [ shape = "circle" ] A B;
   A -> B [ label = "0" ];
}

\end{document}
share|improve this question
add comment

3 Answers 3

up vote 5 down vote accepted

With pgf/tikZ you could evade this problem.

\documentclass{minimal}
\usepackage{tikz}
\usetikzlibrary{automata,positioning}

\begin{document}
  This is a state machine:

  \begin{tikzpicture}[%
    >=stealth,
    node distance=2cm,
    on grid,
    auto
  ]
    \node[state] (A)              {A};
    \node[state] (B) [right of=A] {B};
    \path[->] (A) edge node {0} (B);
  \end{tikzpicture}
\end{document}

The package manual has the details. There is also a specific example gallery.


enter image description here

share|improve this answer
    
This looks like a much better solution than what I'm currently using - I'll check it out. Thanks! –  Tim Dec 6 '10 at 22:01
add comment

The package was obviously never tried by its author for anything but trivia.

To put it right, change

\newcommand{\digraph}[3][scale=1]{ 
  \newwrite\dotfile 
  ...

in the package to

\newwrite\dotfile
\newcommand{\digraph}[3][scale=1]{
  ...

(i.e., move the \newwrite out of the command). Some lines below, remove the \newwrite\dotfile line from the definition of \graph.

FWIW, you're right; there is no way to increase the number of \write streams. and of course, using TikZ is a good alternative, so carry on with that if it suits you.

share|improve this answer
    
I was thinking of suggesting (reminding?) either you or the OP to make sure this gets reported to the package author, but I see that someone has already reported it as code.google.com/p/graphvizzz/issues/detail?id=1, with a link straight here for the fix. Good job, whoever it was. –  SamB Dec 9 '10 at 2:11
    
I actually handled it - thanks anon for suggesting the change, or I wouldn't have thought to report it as an issue in the first place. –  Tim Dec 10 '10 at 2:27
add comment

You could use the morewrites packages:

http://get-software.net/macros/latex/contrib/morewrites/morewrites.pdf

Basically, all you need to do is to add the line

\usepackage{morewrites}

somewhere near the beginning of your document and the "No more room for a new \write" error should disappear.

share|improve this answer
1  
While this can be a useful tip in general, the "real" solution to the particular problem is to correct a the clearly faulty package, taking out the \newwrite\dotfile declarations from the definitions of \digraph and \graph and issuing it once and for all at the start. This will cooperate well with morewrites, of course. Unfortunately, the bug hasn't been corrected in almost 18 months. –  egreg May 31 '12 at 13:22
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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