TeX-PDF : Lightweight
| script karma
Downloaded by 2280
Comments, bugs, improvements
script versions (upload new version)
This plugin provides support for specialized lightweight "stay-out-of-your-way"
TeX-to-PDF compilation and viewing. In contrast to some of the other more
comprehensive TeX/LaTeX suites, it provides nothing else but two commands, and
leaves the rest of your Vim platform undisturbed, except for a few key maps to
invoke the commands.
- Runs "make" if a Makefile is found, otherwise invokes Rubber (if
installed) or pdflatex (otherwise) on the current file.
- Successful builds will result in PDF being opened/refreshed in the
default external viewer.
- Unsuccessful builds will result in the QuickFix buffer being opened and
to list the errors, with line numbers, description etc.
Once the plugin is installed (see below), when you have a TeX or LaTeX document
open in the buffer, type '\r' or <Shift-F9> to compile the document and open
(or refresh) the resulting PDF in your system's default PDF viewer. To just
compile the document to PDF without opening it, type '\m' or <F9>. If there
are any compile errors, a window will open and list all the problematic lines.
As usual, you can navigate forward and backward through this list using the
':cnext' and ':cprev' commands, and you will automatically be taken to the
corresponding line in the source document.
Working with Rubber
This plugin will work quite happily with the stock TeX/LaTeX tools found on
most systems. As described above, for example, this plugin will run "make" if a
Makefile is found in the current working directory (by-passing Rubber, even if
installed), and fall back to the standard "pdflatex" if Rubber is not
However, installation of "Rubber" (https://launchpad.net/rubber) in conjunction
with this plugin makes Vim a *very* powerful, yet highly ergonomic and
non-intrusive, LaTeX IDE, making Makefiles unneccessary for many document
projects. Rubber takes care of the multiple TeX compile passes required to get
the the bibliographies, references, cross-references, etc. correctly built,
while this plug-in takes care of opening/refreshing the PDF view on successful
builds, as well as providing for a *clean* view of the errors on an
This plugin provides two commands: "BuildAndViewTexPdf" and "BuildTexPdf".
"BuildAndViewTexPdf" will build the PDF from the TeX source, and, if
successful, will open the resulting PDF for viewing in an external viewer (or
refresh the PDF if already opened).
"BuildTexPdf" will build the PDF from the TeX source without opening/refreshing
The build logic is:
(1) If a Makefile is found in the current directory, then "make" will be
(2) If there is no Makefile in the current directory, but "Rubber"
(https://launchpad.net/rubber) is installed and available, then this will
invoked on the current buffer file.
(3) If Rubber is not installed, then "pdflatex" will be invoked on the
current buffer file.
If the build is unsuccessful, the QuickFix buffer is populated with the
(parsed, cleaned, and filtered) error messages and automatically opened,
showing, for each error, the line number and description of the error. You can
then used ":cnext", ":cprev", etc. to visit each of the error lines.
By default, '<Leader>r' (mnemonic: 'run') and '<S-F9>' are mapped to
"BuildAndViewTexPdf", while '<Leader>m' (mnemonic: 'make') and '<F9>' are
mapped to "BuildTexPdf"
If you prefer not to have any of the above keys mapped, then include the
following in your '~/.vimrc':
let g:tex_pdf_map_keys = 0
If you prefer not to have the '\r' and '\m' leader keys mapped but keep the
function key mapping, you can include the following in your '~/.vimrc':
let g:tex_pdf_map_leader_keys = 0
Alternatively, you can keep the leader keys mapped but by-pass the function key
mapping by including the following in your '~/.vimrc':
let g:tex_pdf_map_func_keys = 0
You can, of course, map any keys that you want to the commands. For example,
by including the following in your '~/.vimrc', you will map Command-V to the
"compile and view" command and Command-T to the "just compile" command in
both normal and insert modes:
noremap <silent> <D-V> <Esc>:BuildAndViewTexPdf<CR>
inoremap <silent> <D-V> <Esc>:BuildAndViewTexPdf<CR>
noremap <silent> <D-T> <Esc>:BuildTexPdf<CR>
inoremap <silent> <D-T> <Esc>:BuildTexPdf<CR>
|Unarchive the file while in your Vim home directory: this will result in the bundled file, "tex_pdf.vim" being copied to "~/.vim/ftplugin/tex". Alternatively, you can just unpack and copy the file to this location yourself manually.|
Click on the package to download.
ip used for rating: 18.104.22.168