TeX-PDF : Lightweight



script karma Rating 52/20, Downloaded by 3542 Comments, bugs, improvements Vim wiki created by Jeet Sukumaran script type ftplugin description Description

===========



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.



Features

========



- 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.



Usage

=====

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

installed.



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

unsuccessful build.



Operation

=========



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 PDF.



The build logic is:



(1) If a Makefile is found in the current directory, then "make" will be

invoked.

(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.



Key Mapping

===========



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>

install details 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. rate this script Life Changing Helpful Unfulfilling script versions (upload new version) Click on the package to download. package script version date Vim version user release notes tex-pdf.tar.gz 1.4.2 2014-05-17 7.0 Jeet Sukumaran - Add `-shell-escape` to command invocation tex_pdf.tar.gz 1.41 2012-07-14 7.0 Jeet Sukumaran Restore header guard tex_pdf.tar.gz 1.4 2012-07-14 7.0 Jeet Sukumaran - Jump to first error line on previous window on error tex_pdf.tar.gz 1.3A 2010-09-17 7.0 Jeet Sukumaran Correct compression protocol used (previous upload was actually bzip2). tex-pdf.tar.gz 1.3 2010-09-09 7.0 Jeet Sukumaran Fixed failure to redraw in console Vim when running external make/rubber. tex-pdf.tar.gz 1.2 2010-09-08 7.0 Jeet Sukumaran On successful compiles, cursor is restored to original position. On compile error, smarter jumping to location of first error. tex-pdf.tar.gz 1.1 2010-09-08 7.0 Jeet Sukumaran Better handling of compile errors, automatically jumping to first error line. tex-pdf.tar.gz 1.0 2010-09-08 7.0 Jeet Sukumaran Re-upload. ip used for rating: 34.123.205.132