When editing medium sized .tex files, I often find it convenient to make use of the narrow command
C-x n n (narrow-to-region), usually in combination with the mark section command
C-c * (LaTeX-mark-section).
I then wish to compile only the accessible portion. For this purpose, I have been using the Tex command
C-c C-b (TeX-command-buffer), but recently this command has started acting inconsistently. Depending on the position of point, it sometimes
- Compiles only the accessible portion
- Compiles the entire buffer
- Returns the message
ad-Advice-TeX-region-create: End of buffer
Compiling the accessible portion is what I intend, and I can usually (but not always) trigger this behaviour by putting point at the beginning of a line or at the end of the accessible portion.
Compilation of the entire buffer seems to happen sometimes when I have previously compiled the entire buffer with
C-c C-c (TeX-command-master), but this is not consistent at all.
End of buffer error is usually triggered by not placing point at the beginning of a line. It also seems to happen more frequently if there is a reference in the accessible portion to something in the inaccessible portion.
Sometimes (usually if I first trigger the
End of buffer error by running
C-c C-b with point placed mid-line, and then run
C-c C-b with point placed at the beginning of a line) it happens that, although compilation occurs, new changes are not included in the output
_region_.pdf file, although they are included in the
As a side-note, which is perhaps related, the Tex command
C-c C-z (LaTeX-command-section) also behaves differently if I narrow: Instead of compiling the current section inside the accessible portion, it compiles only from the beginning of the section until the position of point.
I guess first narrowing and then running
C-c C-b is not the intended use of the command
C-c C-b. In that case, I should instead make my own command for this specific purpose. But it used to work for me consistently with the intended effect, so I am interested in knowing what might be the cause of this inconsistent behaviour.