### Block compilation

An interesting feature of 4TeX is block compilation. Instead of compiling a complete document you can mark a block in the (PFE/MED/WinEdit) editor and right-click on the "Compile" button. 4TeX will then compile only that block and, after successful compilation, display the result.

Note that not only the marked block in the editor is compiled. It is very common to specify macros, include packages, etc., at the beginning of the TeX document. These statements my well be essential for a successful compilation of the marked block. Therefore 4TeX composes a temporary file that starts with the beginning of the "main TeX file", up to and including the string "\begin{document}". Naturally you can specify this "BeginBlockMarker" in the Options menu. Likewise the string "\end{document}" could be the "EndBlockMarker". This string is added at the end of the temporary file, which is now ready to compile.

When compiling a TeX file you can encounter an error. After an error you can type "e" and then press Enter. This will result in automatically jumping to the file and line number where TeX reported the error. This feature also works with block compilation.

NB: if the editor you use does not support DDE commands, you still can use block compilation: mark a block of text you want to compile and copy it to the clipboard (press Ctrl-C or Ctrl-Ins). Then right-click "Compile".

### Choosing another editor

By default the PFE editor is installed. This editor is freeware, but maybe you prefer another editor, such as WinEdit and MED, or any other editor. If you choose to use WinEdit or MED, we recommend that you make the following changes in 4TEX.INI:

For PFE change the following parameters in the [UserChoice] section:

Editor=D:\BIN\WIN32\PFE\PFE32.EXE
TeXEdit=D:\BIN\WIN32\PFE\PFE32.EXE /g%d %s
EditorClassName=PFE32_Frame
KillProcesses=PFE32_Frame;Juan_M_Aguirregabiria_TeXmac_Class;dviwin-1;gsview_class;Windvi;BibDBMain;Afx:400000:b:1486:6:4497;wgnuplot_parent;ThunderRTMain;pagedraw_frame;wxFrameClass
LogFileViewer=D:\BIN\WIN32\PFE\PFE32.EXE


For WinEdit change the following parameters in the [UserChoice] section:

Editor=c:\program files\winedt\winedt.exe
TeXEdit="c:\program files\winedt\winedt.exe" [Open('%s');SelLine(%d,7)]
EditorClassName=TApplication
KillProcesses=TMainForm;Juan_M_Aguirregabiria_TeXmac_Class;dviwin-1;gsview_class;Windvi;BibDBMain;Afx:400000:b:1486:6:4497;wgnuplot_parent;ThunderRTMain;pagedraw_frame;wxFrameClass
LogFileViewer=c:\program files\winedt\winedt.exe


For MED change/update the following parameters in the [UserChoice] section:

Editor=d:\bin\win32\med\med.exe
EditorClassName=MRED_MAINWIN_CLASS
TeXEdit=d:\bin\win32\med\med.exe %s %d 1
LogFileViewer=d:\bin\win32\med\med.exe
KillProcesses=MRED_MAINWIN_CLASS;Juan_M_Aguirregabiria_TeXmac_Class;dviwin-1;gsview_class;Windvi;BibDBMain;Afx:400000:b:1486:6:4497;wgnuplot_parent;ThunderRTMain;pagedraw_frame;wxFrameClass


See the documentation on DDE if you want to make 4TeX and your editor communicate through Dynamic Data Exchange.