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.

In latex.ltx, \protected@write is defined as:

\long\def \protected@write#1#2#3{%
      \begingroup
       \let\thepage\relax
       #2%
       \let\protect\@unexpandable@protect
       \edef\reserved@a{\write#1{#3}}%
       \reserved@a
      \endgroup
      \if@nobreak\ifvmode\nobreak\fi\fi
}

Is there any side effect in using \immediate before \write in the definition of \protected@write?

share|improve this question

1 Answer 1

up vote 14 down vote accepted

If you change this in \protected@write the side effects are severe. For example, \protected@write is used in \label. The page number is not known right away in general. The delay of the \write without \immediate writes the entry at page shipout time, when the page number is known.

Thus do not change \protected@write. If you need immediate writing, use a new macro instead and do not use it for page numbers and such things that are reliably correct at shipout time only.

share|improve this answer

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.