5.1 Latex-Suite completion example

Consider the situation where you are editing a file with two equations labelled eqn:euler and eqn:einstein. Now you want to insert a reference to one of these equations. To do this, you type the \ref{eqn:} command and with the cursor placed after eqn:, press <F9>. This will bring up two new windows beneath the main window you were working in as shown in the figure below.

      8 These are a couple of equations:
      9 +--  4 lines: eqnarray (eqn:euler) :   e^{j\pi} + 1 &=& 0---------------
     13 +--  4 lines: equation (eqn:einstein) :   E = m c^2---------------------
     18 These are a couple of figures:
     19 +--  7 lines: figure (fig:monkeys) : Monkeys can Type-------------------
     26 +--  7 lines: figure (fig:shakespeare) : Shakespeare could not type-----
     34 This is a reference to \ref{eqn:}<++>
     37 \end{document}
newfile.tex                                                   34,32          Bot
newfile.tex|11| \label{eqn:euler}
newfile.tex|15| \label{eqn:einstein}
[Error List]                                                  1,1            All
      8 These are a couple of equations:
      9 \begin{eqnarray}
     10   e^{j\pi} + 1 &=& 0
     11   \label{eqn:euler}
     12 \end{eqnarray}
     13 \begin{equation}
     14   E = m c^2
     15   \label{eqn:einstein}
     16 \end{equation}
newfile.tex [Preview]                                         11,3           21%

The first window (shown as [Error List] above) is a |cwindow| containing a list of possible matches for the reference. The cursor will be located in the first line of this window. The bottom window is a preview-window showing the context of the \label. Moving around in the [Error List] window automatically scrolls the preview window so as to always keep showing the context of the \label being viewed in the [Error List] window. You can also press J and K in the [ErrorList] window to scroll the preview window up and down.

To insert one of the labels, simply position the cursor in the correct line in the [Error List] window and press <enter>. This will immediately close the two newly opened windows, get back to the correct location in the original file being edited and insert the label into the \ref command.

If you notice carefully in the example above, the [Error List] window only showed the matches for the equations and did not list any of the figure labels. This is because we pressed <F9> after \ref{eqn: instead of simply after \ref{. This caused Latex-Suite to search only for those labels which started with the string eqn:. If you had pressed <F9> after a \ref{, you would have been shown matches from all labels, not just those starting with eqn:.

Thus prefixing all your labels with eqn:, fig:, tab: etc. depending on what you are labelling will lead to an easier time completing references.