Install and use vim to insert latex suite in Mac and ubuntu

Source: Internet
Author: User
Tags documentation imap

Install and use the vim plug-in latex-suite in Mac


There is a latex plug-in vim ~ Pretty good to use ~ It seems that the IDE has no code prompts and so on. There are a lot of tutorials under win, just go to the next step. I have a problem with instruction on the official website under mac, and now I will record it and share it with you.

Let's take a look at this install instruction. Download here.

Method 1. note the path when installing make install. you must modify the vim path and other configurations, for example,/Users/TangLei /. vim, which is/usr/local by default. or copy directly.

Method 2. copy directly.

/Users/TangLei/. vim/bundle-all plug-ins are available here.

Note: check that this script has a wooden pathogen (to help manage the plug-in) and enable: execute pathogen # infect () in vimrc ()

Then modify the configuration. vimrc reference http://vim-latex.sourceforge.net/documentation/latex-suite/recommended-settings.html

Effect:

For example, enter "table + F5" to see the following code:

For example, automatically insert a tag: ctrl + n

For other related skills, see help.

In addition, if the F9 cross-reference feature is used, change latex-suite/texrc to 1 in TexLet g: Tex_UsePython = 1 to 0.


Install and use vim-latex suite in ubuntu

1. Download the plug-in
Download the vim-latexplug-in from http://sourceforge.net/projects/vim-latex/files.
2. Install the plug-in

Decompress the downloaded package ~ /. Vim directory.
Set vimrc. See http://vim-latex.sourceforge.net/documentation/latex-suite/recommended-settings.html
Install the help file. Helptags ~ /. Vim/doc
Set Vim-latex-suite. Use the xelatex command to compile the document and use evince to browse the generated pdf document. You can modify it through ~ /. Vim/ftplugin/latex-suite/texrc to complete these operations.

# Lines 88th to 92 are modified as follows to make tex always compiled into pdf

88 if has ('macunix ')

89 TexLet g: Tex_DefaultTargetFormat = 'PDF'

90 else

91 TexLet g: Tex_DefaultTargetFormat = 'PDF'

92 endif


# Use xelatex to compile tex-> pdf

114 "ways to generate pdf files. there are soo files...

115 "NOTE: pdflatex generates the same output as latex. therefore quickfix is

116 "possible.

117 TexLet g: Tex_CompileRule_pdf = 'xelatex-interaction = nonstopmode $ *'



Modify row 147 and specify to open the pdf document using the evince program

144 elseif has ('macunix ')

145 "Let the system pick. If you want, you can override the choice here.

146 TexLet g: Tex_ViewRule_ps =''

147 TexLet g: Tex_ViewRule_pdf = 'evince

 
5. Restart vim.
 
 
========================================================= ==========================================
1. key to note at the beginning: Ctrl-J, F5, F7, F9, Shift-F5, Shift-F7, \ ll (compile shortcut), \ lv (view pdf shortcut), \ ls, ctrl-X Ctrl-K (supplemented by dictionary.
 
2. Write \ cite {and press F9 without a cross reference. The reason is that the Python interface in vim has some problems with latex-suite. Disable it. You only need ~ /. Vim/ftplugin/latex-suite/texrc is enabled by default ~ /. Vim/ftplugin/latex-suite/texrc, set
TexLet g: Tex_UsePython = 1
Change
TexLet g: Tex_UsePython = 0
That's it!
 
3. in order to be able to perform a forward search, you should set the parameters and use \ ll for compilation. However, when makefile is in the working directory, \ ll does not execute the set compilation command, but executes makefile, as a result, forward search cannot be performed, and it is depressing for a long time. In fact, you only need to disable makefile ~ /. Vim/ftplugin/latex-suite/texrc
TexLet g: Tex_UseMakefile = 0
 
4. Set forward search in ~ Specified in/. vim/ftplugin/tex. vim
Let g: Tex_CompileRule_dvi = 'Latex-src-specials-interaction = nonstopmode $ *'
Note: You should also set TCTarget dvi. However, if you do not set TCTarget dvi, running vi in the above file will prompt an error, but you can execute this command in vi, no matter whether it can be used. After the settings, you need to re-compile the tex file (use \ ll), and then \ ls can be searched and previewed.
 
5. Reverse search, see the http://bbs.ctex.org/viewthread.php? Tid = 39072 & extra = & page = 1
Note that reverse search only supports gvim, and gvim must be started in remote mode:
Gvim -- servername latex-suite -- remote-silent filename. tex
To be able to use reverse search, xdvi must know that the current editor works in remote mode.
VIM, so that you can call the editor to display the search results when searching. In your ~ /. Vimrc or ~ Add the following content to/. vim/ftplugin/tex. vim:
Let g: Tex_ViewRule_dvi = "xdvi-editor 'gvim -- servername latex-suite -- remote-silent '"
In this way, \ ls can be viewed after the \ ll compilation. Remember to press Ctrl to double-click somewhere (it seems that you can click it with the left button) during reverse search, and the link will jump to the corresponding part of the tex source file.
 
6. For convenience, you have made some settings, including the shortcut keys ~ In/. vim/ftplugin/tex. vim:
Map <F4> <ESC>: q <CR> "F4 close the window (buffer)
Map <F2> <ESC>: w <CR> \ ll "F2 save and compile
Imap <F2> <ESC>: w <CR> \ ll
Map <F3> <ESC> \ lv "F3 view
Imap <F3> <ESC> \ lv
Nmap <Tab> <C-j> "uses the Tab key instead of Ctrl-j to redirect.
Imap <Tab> <C-j>
Vmap <Tab> <C-j>
Set keywordprg =: help "press the K key to find help for words at the cursor. The default value is man.
Cmap xxx! Make
Set iskeyword + = ., _ "facilitates fig. xx, prl1038512345 and other forms of search completion, otherwise by default, fig is not set. xx is regarded as a word, but as fig and xx. "is used as the separator of the word.
 
7. In fact, as long as latex-src-specials-interaction = nonstopmode xxx. tex
The compiled dvi file already contains the forward and reverse search information, so you can search in the forward or reverse direction. If you open it with xdvi, press Ctrl and left-click to search in the reverse direction, however, xdvi uses the xterm-e vi window by default. In fact, you can specify the editor by yourself, such
Xdvi-editor gedit
As for reverse search, the gvim parameter added above only ensures that a gvim window is not opened for each reverse search.
 
8. Temporarily cancel the definition of the shortcut key. For example, if you want to enter double quotation marks, but when you press "it will automatically become'', how can you disable automatic replacement and directly output?
Remember <Ctrl-v>!
<Ctrl-v> "get"
SS <Ctrl-v> S to get SSS
~ <Ctrl-v> ~ Get ~~

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.