Document 419

Repairing a damaged document

Version: 3.x, 4.x, 5.x - Scientific WorkPlace & Scientific Word

If your document has been damaged or corrupted somehow, you may be able to repair it so that it will open successfully in SWP or SW. However, the program does not handle every possible construct that might occur in a native LaTeX document. If your document was originally written in native LaTeX and then imported to SWP or SW, some problems may persist. In general, if a LaTeX document contains a construct that differs from Plain TeX (such as array versus matrix), you may be able to open the document in SWP or SW if you modify it to use the LaTeX construct.

You may be able to repair a damaged document using this technique:

  1. Make a copy of the .tex file.
  2. Use the TrueTeX formatter to try to compile the document.
  3. Open the document with an ASCII editor, isolate and correct any LaTeX errors, and then recompile the document with the TrueTeX formatter.
  4. If LaTeX compiles the document successfully, try to open the document in SWP or SW.
  5. As the program loads the document, carefully watch the display of paragraph numbers on the Status bar.

    If the document loads successfully, you have repaired the document successfully.

  6. If not, note the paragraph number where the error occurred.
  7. Repeat steps 3 through 6 until the document loads successfully.

Encapsulating information in a TeX field

If you can isolate the lines that contain the error, you may be able to make the document work temporarily in SWP or SW by enclosing those lines in an encapsulated TeX field:

  1. Open the document with an ASCII editor.
  2. If much of the document is still commented out, remove the percent signs from all but the few lines surrounding and containing the error.
  3. Copy the commented lines to the clipboard.
  4. Save and close the file.
  5. Open the document in SWP or SW.
  6. Place the insertion point where the commented lines should appear.
  7. Enter an encapsulated TeX field.
  8. Copy the lines from the clipboard, remove the percent sign at the beginning of each line, and choose OK.
  9. Typeset compile the document.
  10. If the document compiles correctly, you've successfully repaired the document.

    If the document still doesn't compile correctly, remove the TeX field from the document.

Important Encapsulating erroneous code is a temporary workaround. Pursue a more robust solution to the problem.

Placing statements in an external file

Complex \def and \renewcommand statements in the preamble of your document can prevent the program from loading the document. If your document preamble contains such commands, you may be able to read the file if you place the statements in an external file and then input the file from the preamble:

  1. Open the document with an ASCII editor.

  2. Select the statements you want to place in another file, and cut them to the clipboard.

  3. In place of the deleted items, type \input{filename.tex} where filename is the name of the ASCII file you will create in the next steps.

  4. Open a new file with an ASCII editor.

  5. Paste the statements from the clipboard into the file.

  6. Name the file with a .tex extension.

  7. Save the file in an appropriate subdirectory in the TCITeX/TeX directory of your installation. If you place the file somewhere else, LaTeX won't find it when you try to compile the document.

  8. Try to open and compile the original document in SWP or SW.

Last revised 01/19/06

This document was created with Scientific WorkPlace.