The solution is
Either use the -interaction batchmode
switch or put \batchmode
at the start of the document(or anywhere you want to stop displaying output).
Use \scrollmode
, \nonstopmode
, or \errorstopmode
anywhere you want to enable output generation. \errorstopmode
enables errors interaction.
Use \batchmode
anywhere you want to disable output generation.
- To reduce clutter use the command line switch, and use the following template.
>
\begin{document}
\scrollmode
....
\batchmode
\end{document}
This will only show output from latex between the the \scrollmode
and \batchmode
and very little else.
If you are using WinEdt(or possibly some other automated process) it seems to like to open 0 length pdf's for no reason. It also doesn't seem to have an easy way to check for 0 length files.
- Add the follow to the
ExecCompiler.edt
file in the \Exec directory right after the string "// Check if the Output was Generated ...". (It is near the bottom)
ExecCompiler.edt
Run('DeleteFileIfEmpty.exe "%P\%N.pdf"','%P',0,0,'%N.pdf',0,0,1);
IfFileExists("%P\%N.pdf", "Relax;", !"JMP('Exit');");
- Here is C code of for a simple tool that deletes a file if it is empty.
DeleteFileIfEmpty.cpp
#include <tchar.h>
#include <Windows.h>
long GetFileSize(const TCHAR *fileName)
{
WIN32_FILE_ATTRIBUTE_DATA fileInfo;
if (NULL == fileName) return -1;
if (!GetFileAttributesEx(fileName, GetFileExInfoStandard, (void*)&fileInfo)) return -1;
return (long)fileInfo.nFileSizeLow;
}
int _tmain(int argc, _TCHAR* argv[])
{
argv = CommandLineToArgvW(GetCommandLine(), &argc); if (argc < 2) return -1;
_TCHAR *fn = new _TCHAR[1000]; ZeroMemory(fn, 1000*sizeof(_TCHAR)); _TCHAR *fn2 = fn;
for(int i = 1; i < argc; i++) { _tcscpy(fn2, argv[i]); fn2 += _tcslen(argv[i]); _tcscpy(fn2++, _T(" ")); } fn2--;
if (GetFileSize(fn) > 0) return -1;
DeleteFile(fn);
return 1;
}
You can download this file at
http://www.freefilehosting.net/deletefileifempty
Put the DeleteFileIfEmpty.exe in a path that is in the %path% environment or the bin dir that WinEdt is setup to use.
This was tested with WinEdt6 and works. Reduces output clutter(no package loading msgs, banners, etc...) and doesn't open up empty files when there is an error.
tex
tag belongs here. Could you please add it (and get rid of then-obsolete comments)?