本文主要是介绍vim和latex环境搭建,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
安装软件
下载软件
- 下载gvim:http://www.vim.org/download.php,安装的是 gvim74.exe
- 下载latex:http://vim-latex.sourceforge.net/,下载的是vim-latex-1.8.23-20141116.812-gitd0f31c9.tar.gz
安装
gvim安装自不必说。
在http://vim-latex.sourceforge.net/index.php?subject=download&title=Download讲了安装步骤,拷贝如下:
Installation Instructions
Step 1 of 4: Download and extract the archives
Extract one of the archives above into your ~/vimfiles directory (if you are using windows) or ~/.vim directory (if you are using *nix).
If you are updating after a long time, it might be a good idea to remove the ~/vimfiles/ftplugin/latex-suite directory from previous installations before reinstalling.
NOTE: If you already have some latex ftplugin files, read the Advanced Installation Instructions to make sure you do not over-write any of your files.
Step 2 of 4: Set a few things in .vimrc
The recommended settings for vim-latex in your .vimrc file are now only described in the vim-latex manual.
Step 3 of 4: Install the help files
To install the included latex-suite.txt and latexhelp.txt files as vim help files, start vim and do the following:
helptags ~/.vim/doc (for *nix users)
helptags ~/vimfiles/doc (for windows users)
Step 4 of 4: Done!
Thats it! You are done! Now start editing a latex file in vim. Latex-Suite should start up automatically. You can do
:help latex-suite.txt
from within vim to get the online Latex-Suite reference.
注:1. win下面,.vimrc对应的就是_vimrc;2. 上述helptags命令后面可以用相对路径或全路径文件名,如:
:helptags d:/Vim/vimfiles/doc
上面第二步的网页内容拷贝在这里,方便取用:
Installation and recommended Settings
If you are reading this, it most probably means that you have already installed Latex-Suite and the help files. If this is not the case, follow the detailed instructions on Latex-Suite’s download page.
Make sure that you create a few necessary settings in your ~/.vimrc.
" REQUIRED. This makes vim invoke Latex-Suite when you open a tex file.
filetype plugin on" IMPORTANT: win32 users will need to have 'shellslash' set so that latex
" can be called correctly.
set shellslash" IMPORTANT: grep will sometimes skip displaying the file name if you
" search in a singe file. This will confuse Latex-Suite. Set your grep
" program to always generate a file-name.
set grepprg=grep\ -nH\ $*" OPTIONAL: This enables automatic indentation as you type.
filetype indent on" OPTIONAL: Starting with Vim 7, the filetype of empty .tex files defaults to
" 'plaintex' instead of 'tex', which results in vim-latex not being loaded.
" The following changes the default filetype back to 'tex':
let g:tex_flavor='latex'
In addition, the following settings could go in your ~/.vim/ftplugin/tex.vim file:
" this is mostly a matter of taste. but LaTeX looks good with just a bit
" of indentation.
set sw=2
" TIP: if you write your \label's as \label{fig:something}, then if you
" type in \ref{fig: and press <C-n> you will automatically cycle through
" all the figure labels. Very useful!
set iskeyword+=:
顺便可以看到,http://vim-latex.sourceforge.net/documentation/latex-suite/index.html是详细的vim-latex在线帮助。
vim文档
http://www.vim.org/docs.php提供了一些vim的文档。
latex的用上面helptags的方法来即可。
练习
按照latex-suite的Tutorial,gvim打开tex文件都闪退;只能用vim。还不清楚具体原因。另外,也没有看到latex-suite的菜单。
其他
vi常用命令
这篇关于vim和latex环境搭建的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!