About: Open pdf to the current location in a LaTeX file   Sponge Permalink

An Entity of Type : owl:Thing, within Data Space : 134.155.108.49:8890 associated with source dataset(s)

Add the following code to your tex.vim file (~/.vim/ftplugin/tex.vim on Unix, or $HOME/vimfiles/ftplugin/tex.vim on Windows). Also add one of the OpenPDF functions listed below, depending on your operating system. The first function looks through the aux files created by compiling the latex file for the label passed in as a parameter. If it finds the label, it loads the page number and then loads the pdf to the given page. If you use the hyperref package, replace the pattern '.\{}{\zs.*\ze}}' in the call to matchstr() in function LoadEvinceByLabel with: 'newlabel{.*}' To use them, add something like:

AttributesValues
rdfs:label
  • Open pdf to the current location in a LaTeX file
rdfs:comment
  • Add the following code to your tex.vim file (~/.vim/ftplugin/tex.vim on Unix, or $HOME/vimfiles/ftplugin/tex.vim on Windows). Also add one of the OpenPDF functions listed below, depending on your operating system. The first function looks through the aux files created by compiling the latex file for the label passed in as a parameter. If it finds the label, it loads the page number and then loads the pdf to the given page. If you use the hyperref package, replace the pattern '.\{}{\zs.*\ze}}' in the call to matchstr() in function LoadEvinceByLabel with: 'newlabel{.*}' To use them, add something like:
Version
  • 7(xsd:integer)
dbkwik:vim/property/wikiPageUsesTemplate
Previous
  • 0(xsd:integer)
Category
  • LaTeX
Author
  • Wuzzeb
Subpage
  • /201111
Complexity
  • basic
Created
  • 2011-11-28(xsd:date)
ID
  • 0(xsd:integer)
NEXT
  • 0(xsd:integer)
abstract
  • Add the following code to your tex.vim file (~/.vim/ftplugin/tex.vim on Unix, or $HOME/vimfiles/ftplugin/tex.vim on Windows). Also add one of the OpenPDF functions listed below, depending on your operating system. "Load PDF to the page containing label function! LoadEvinceByLabel(l) for f in split(glob("*.aux")) let label = system('grep "^.newlabel{' . a:l . '" ' . f) let page = matchstr(label, '.\{}{\zs.*\ze}}') if ! empty(page) call OpenPDF(substitute(f, "aux$", "pdf", ""), page) return endif endfor endfunction "Load PDF to the page containing the nearest previous label to the cursor function! EvinceNearestLabel() let line = search("\\label{", "bnW") if line > 0 let m = matchstr(getline(line), '\\label{\zs[^}]*\ze}') if empty(m) echomsg "No label between here and start of file" else call LoadEvinceByLabel(m) endif endif endfunction The first function looks through the aux files created by compiling the latex file for the label passed in as a parameter. If it finds the label, it loads the page number and then loads the pdf to the given page. If you use the hyperref package, replace the pattern '.\{}{\zs.*\ze}}' in the call to matchstr() in function LoadEvinceByLabel with: 'newlabel{.*}' This is because the hyperref package adds three additional fields after the page number to the label definition line in the .aux files. The second function searches for the nearest label from the current position and calls LoadEvinceByLabel. To use them, add something like: nnoremap e :call EvinceNearestLabel() Now \e will load the pdf viewer to the page containing the nearest label to the current cursor position (assuming the default backslash for the LocalLeader key). This works well on multi-file projects since the aux file is searched to find the pdf name. So you can jump around in Vim using its wonderful tools, then tell the pdf viewer to jump to the same page. If you have set up tags, you can also add: command! -nargs=1 -complete=tag Pdf call LoadEvinceByLabel("") to create command :Pdf so you can use Tab completion on labels to jump to a given location.
Alternative Linked Data Views: ODE     Raw Data in: CXML | CSV | RDF ( N-Triples N3/Turtle JSON XML ) | OData ( Atom JSON ) | Microdata ( JSON HTML) | JSON-LD    About   
This material is Open Knowledge   W3C Semantic Web Technology [RDF Data] Valid XHTML + RDFa
OpenLink Virtuoso version 07.20.3217, on Linux (x86_64-pc-linux-gnu), Standard Edition
Data on this page belongs to its respective rights holders.
Virtuoso Faceted Browser Copyright © 2009-2012 OpenLink Software