Miscellaneous editor functions

Code commenting

The plug-in offers an effective way to comment (and uncomment) multiple lines at once. There are four ways to do this: Select the area to comment and

  1. Click the "Comment selection" button at the tool bar. (Yellow arrow to the right towards a %-character.)
    Comment selection
    To uncomment a selection, click the "Uncomment selection" button at the tool bar. (Yellow arrow to the left away from the %-character.)
  2. Select Latex > Comment from the menu bar
    To uncomment select Latex > Uncomment from the menu bar
  3. Press ctrl + 5 to comment the selection
    or press esc ctrl + 5 to uncomment the selection.
  4. Open the context menu (click the right button of the mouse on the editor view) and select (under the Source-menu) Comment to comment or Uncomment to uncomment the selected area.

Note: The command will add a "% "-string to every selected line. If there are no lines selected, the "% "-string is added to the line where the cursor is. If the command is executed multiple times, then a "% "-string is added at the beginning of the selected lines every time the command is executed. Uncommenting is similarly cumulative, that is, it removes the first "% " (or "%") from the beginning of the line.

If you wish to fold commented sections, you can use \begin{comment} and \end{comment} to mark the commented area.

Code folding

The user can fold text blocks by clicking the small triangles in the text editor's left margin. The following blocks can be folded:

Folds are hierarchical, e.g. folding a section folds all subsections under it.

Note: If you wish to fold comments, you have to mark a commented block with the \begin{comment} and \end{comment} keywords.

You can also select what environments are folded initially when the editor is opened. This can be done via Code Folding page at the Preferences. (Window > Preferences > Texlipse > Editor > Code Folding)

Preferences - Code Folding
Check the environments that you want to be folded.

If you wish to add new environments, click the New... -utton and type the name of the environment. For example, if you want to have every equation block folded initially, click the New... button, type equation (do not write \begin{equation}) and accept the value by clicking the OK button.

If you don't want to have some environment folded automatically anymore, select the environment and click the Remove-button.

The Up and Down buttons do not affect anything.

Error annotations

The plug-in tries to indicate if there are errors in the document. For example, if \ref or \cite are referring to references that do not exist, a warning annotation is shown. Also, subsections without a preceding section (or subsubsection without a preceding subsection) cause a warning annotation (the warning annotation is a yellow triangle with a black exclamation mark).

It is worth noting that referencing errors are displayed conservatively, i.e. a warning always indicates an unresolved reference (unless you use imports from outside of the project defining references), but some references without an error marker shown can be wrong. Since \thebibliography is not supported, bibliography entries defined with it are not taken into account when checking \cite -commands.

If there are some serious problems, e.g. unbalanced begin-end -blocks, the error annotation is shown (the error annotation is a red circle with a white X-mark). A common problem is a missing } -brace. { and } are always special characters in LaTeX (excluding the verb and verbatim environments) and in text you should escape them by writing \{ and \} if you want them to show up in the output.

There are many cases where TeXlipse warns the user of a situation that is likely wrong and issues a warning, but in situations that are obviously wrong, an error is issued. In particular, unbalanced begin-end blocks and missing } make it impossible to continue parsing the document, so the outline and code folds cannot be updated until these problems are fixed in the document. Some of the errors come as a result of building from the latex-program and these are all shown as error annotations.

The rule of thumb is that if the latex-program halts with the problem it is annotated with an error annotation. Otherwise it is annotated with a warning annotation.

Word counting

To count how many words there are in the selected area, select Latex > Word count from the menu bar. Word counting can also be performed by clicking the Word count icon in the toolbar.

The aim is to count the words that will appear in the output document. Every word in the text is counted as one word, one citation as one word and the words in the argument of a sectioning command are counted, everything else is not considered. If the selection contains commented lines, the words on those lines are not counted.