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.

Is there any way to flush latex's file io buffers. Because of something I'm trying to achieve I have to copy/modify the outputted pdf after it is created(but in the same compile run). The problem is, it seems, that the pdf is not fully flushed before I copy/modify it. The result is a partially copied file which end up corrupt.

Is there any way to get tex/latex/lutex/lualatex to flush the buffers before I do the copy? (the copy is in lualatex and happens right after the pdf is generated. It is not done separately)

share|improve this question
1  
Do you mean the main output (.dvi or .pdf, depending on mode)? If so, the answer is 'no' as closing the output is the last job TeX does. On the other hand, if you mean the streams we can write to from within TeX then it is doable. –  Joseph Wright May 14 '12 at 6:58
1  
Shouldn't we close this question now that you have asked the more specific one: tex.stackexchange.com/questions/55743/… –  topskip May 14 '12 at 7:01
    
@PatrickGundlach I added this because it is pretty specific and people have gotten on to me in the past about writing multiple questions per post. This one is actually more specific to the problem. –  Uiy May 14 '12 at 7:52
add comment

2 Answers

There is no way to do that. Future versions of LuaTeX might handle that.

share|improve this answer
add comment

One TeX run is intimately linked to the generation of one output file, either .dvi or .pdf. As such, the output file is only closed right at the end of the run (there is no value in the run continuing once the file is written). With pdfTeX and XeTeX this is not going to alter, although it is possible that LuaTeX may have altered behaviour. As such, it is normal to carry out more complex operations using a wrapper around several TeX runs. This could of course be done using the Lua part of LuaTeX (see for example how ConTeXt Mk IV works).

share|improve this answer
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.