I have tested morewrites and scrwfile in my template which uses so many writes that without loading any of those packages I would run into the no room for new \write problem.

I find that with scrwfile I can use more packages that use an output. In my case these are

  • TikZ and pgf (without external)
  • imakeidx
  • glossaries
  • fancyvrb
  • listings
  • titletoc
  • todonotes (?)

There may be more, but these are the ones that I know of which use \write

Technically I wonder If anyone can describe what are the differences between these packages and if there is a way to count the free \write outputs.

  • You can grep the log file to get an idea of the used (and thus free) write registers. It does not answer your question, but if you follow these instructions and use the noidx glossaries, you should gain more write registers. – Patrick Häcker Jan 6 '15 at 14:43

Difference between morewrites and scrwfile

morewrites aims at patching

  • the TeX-primitives that are used for creating and writing to text files, that is \write, \openout and \closeout.
  • the \newwrite-macro that is used for allocating \write-registers and that in turn uses the \openout-primitive.

scrwfile aims at patching the \@starttoc-\addtocontents-\@writefile-mechanism provided by the LaTeX kernel for creating things like table of contents, list of figures, list of tables, etc.

...if there is a way to count the free \write outputs

The number of the last \write-register that was allocated in terms of \newwrite (the LaTeX-\@starttoc-\addtocontents-\@writefile-kernel-mechanism internally also uses \newwrite) is held in count-register 17 whereby count-register 17 is initialized to -1 before allocating any \write-register. As \write-registers are numbered from 0 to 15, you can, e.g., have eTeX calculate the amount of such \write-registers that were allocated in terms of \newwrite via \number\numexpr15-\number\count17\relax.


| improve this answer | |
  • 1
    Ok, Is it recommandable to use both packages? – Matthias Pospiech Jan 17 '16 at 11:01
  • I downvoted by accident and can't revert till the anwer is edited. I guess you will extend the answer to include Matthias' quetion. Can you ping me when done so i can upvote? – Johannes_B Jan 18 '16 at 8:35

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.