Document 685 The non-SWP/SW LaTeX filterVersion: 5.5 - Scientific WorkPlace & Scientific Word The Non-SWP/SW LaTeX filter can read many TeX and LaTeX macro definitions not created with SWP or SW. Using the filter, you can successfully import many documents that were created in LaTeX, even if previously you have been unable to open them directly in SWP or SW. The filter works on files written in LaTeX2e, but not LaTeX209 or Plain TeX. Understanding how the filter worksThe filter works by reading a .tex file in much the same way that TeX does. However, instead of translating the .tex file to a DVI file, as TeX does when you typeset a document, the filter translates the .tex file to another .tex file. The resulting file is one in which macros and certain primitive constructs have been expanded so that SWP and SW can understand them. The filter copies the content of the original .tex file to the output .tex file, breaking it into tokens and expanding the macros until they produce text. For example, if a file contains these lines:
\def\m{xxx} the filter will produce This is a test XXX. The filter can expand all tokens defined as macros, \csname, \expandafter, \noexpand, \the, \number, \if, and various other primitive constructs. Although the filter can read many macro definitions, the program may not be able to recognize every possible TeX and LaTeX construct that results. If it is unable to understand a construct, the program places the expanded macro in a gray box labeled unrecognized. You must then try to reconstruct the commands. If the original file contains macros that expand to complex constructs that the program doesn't understand, you may prefer to leave the original macro in place and unexpanded, so that you have one gray box instead of many. The filter doesn't expand macros that SWP and SW already understand. These include letters, digits, and other characters, such as \alpha, \def, \toks, \catcode, \showboxbreadth, \kern, and many others. The filter ignores other TeX commands that aren't involved with generating output for SWP and SW, including those macros that SWP and SW already understand. Using the filter to import a non-SWP/SW LaTeX documentYou can invoke the filter from the program window or from a command prompt. Working from the program window
Working from a command promptIf you are an experienced TeX and LaTeX user, you can also invoke the filter from a command prompt. The executable (pretex.exe) is in the main program directory. CautionUnless you are very familiar with TeX and LaTeX, do not run the non-SWP/SW LaTeX filter from a command prompt. The command line invocation is: pretex -i<input directory> -f<format> <input file> <output file> where
The command line responses list macros that the filter encounters but that are not defined. Modifying the behavior of the filterIf you are an experienced writer of TeX and LaTeX macros, you can modify the behavior of the filter with \msi@hook commands in the cover files that prevent the filter from discarding specified constructs. If there is a construct in the original file that isn't handled by the cover files, you can add the primitive to handle it. NoteUnless you are very familiar with TeX and LaTeX, do not attempt to program the non-SWP/SW LaTeX filter. The filter includes several added TeX primitives. Among the most important are these:
You can find examples of these primitives in use in the files in the ptdata directory in the program installation. Last revised 06/29/06 |