<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>7 Inserting a Reference</title><link rel="stylesheet" type="text/css" href="../latex-suite.css"></link><meta name="generator" content="DocBook XSL Stylesheets V1.76.1"></meta><link rel="home" href="index.html" title="A (very) quick introduction to Latex-Suite"></link><link rel="up" href="index.html" title="A (very) quick introduction to Latex-Suite"></link><link rel="prev" href="lsq-folding.html" title="6 Folding in Latex-Suite"></link><link rel="next" href="lsq-compiling.html" title="8 Compiling a document"></link></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">7 Inserting a Reference</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="lsq-folding.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="lsq-compiling.html">Next</a></td></tr></table><hr></hr></div><div class="section" title="7 Inserting a Reference"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="lsq-inserting-reference"></a>7 Inserting a Reference</h2></div></div></div><p> A necessary part of LaTeX editing is referencing equations, figures, bibliographic entries etc. This is done with the <code class="literal">\ref</code> and the <code class="literal">\cite</code> commands. Latex-Suite provides an easy way to do this. Somewhere in the body of the document, type in the following sentence </p><pre class="programlisting">This is a reference to (\ref{}).</pre><p> With the cursor between the <code class="literal">{}</code> press <code class="literal"><F9></code> in insert mode. Your vim session will sprout two new windows and it should look like below: </p><pre class="programlisting"> 9 \begin{document} 10 +-- 4 lines: eqnarray (eqn:euler) : \label{eqn:euler}----------------------- 14 This is the famous euler equation. I 15 will type another equation, just as 16 true: 17 +-- 4 lines: eqnarray (eqn:simple) : \label{eqn:simple}--------------------- 21 This is my contribution to mathematics. 22 This is a reference to (\ref{}<++>)<++> 23 \end{document} ~ ~ ~ test.tex [+] 22,29 Bot test.tex|11| \label{eqn:euler} test.tex|18| \label{eqn:simple} ~ ~ ~ [Error List] 1,1 All 7 \usepackage[sumlimits,]{amsmath} 8 9 \begin{document} 10 \begin{eqnarray} 11 \label{eqn:euler} 12 e^{j\pi} + 1 &=& 0 13 \end{eqnarray} 14 This is the famous euler equation. I 15 will type another equation, just as 16 true: test.tex [Preview][+] 11,2-5 46% </pre><p> </p><img src=""></img><p> The cursor will relocate to the middle window which shows all <code class="literal">\label</code>s found in all the <code class="literal">.tex</code> file in the current directory. You can scroll up and down in the middle window till you reach the reference you want to insert. Notice how when you scroll in the middle window, the bottom "Preview" window scrolls automatically to show you the location of the current selection. This helps you identify the reference with greater ease because often times, <code class="literal">\labels</code> are not descriptive enough or there might be too many of them. To insert the reference, just position the cursor on the relevant line in the middle window and press <code class="literal"><enter></code>. The line which you were editing will change to: </p><pre class="programlisting">This is a reference to (\ref{eqn:euler})</pre><p> and the bottom windows close automatically. </p><p> The <code class="literal"><F9></code> key also works for inserting <code class="literal">\cite</code> commands to reference bibliographic entries, inserting file names for the <code class="literal">\inputgraphics</code> command and just plain searching for words. Click <a class="ulink" href="http://vim-latex.sourceforge.net/documentation/latex-suite/latex-completion.html" target="_top">here</a> for more information. </p></div><div class="navfooter"><hr></hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="lsq-folding.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="lsq-compiling.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">6 Folding in Latex-Suite </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 8 Compiling a document</td></tr></table></div></body></html>