Reducing the console output of LaTeX
The line feed after 79 characters is defined in Web2C's configuration file, called texmf.cnf. The variable name is max_print_line
which you can change in the file (not recommended in general, but in that case the setting is really harmless); and if you run TeX from a shell you can also set this variable in the environment (export max_print_line=1048576
for Korn-like shells, set max_print_line 1048576
for C shells).
I am not aware of a way to forbid line breaks entirely; I only set the variable to a very large value when this behaviour annoys me.
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.
This is what the silence package is intended to help with.