Skip to content

Commit

Permalink
Fixes xuhdev#46
Browse files Browse the repository at this point in the history
Run tex engine before and after bib executable
Add support for both `bibtex` and `biber`
 - Add global variable `g:latexlivepreview_use_biber`
Add Bibliography section to README
 - Detail usage of `g:latexlivepreview_use_biber`
 - Detail usage with `biblatex`
Clean up calls to bibexec commands
Remove `cd` from processing of bib commands
 - Move code that selects this option to the initializer
Give more meaningful feedback when `engine` and `preview` commands are not valid
 - Throw errors from this context
Catch errors in the initializer and then stop execution
Move README section about bibliographies
Update README to reflect change of g:latexlivepreview_biber
Add section in Known Issues about bibliographies to README
Add auto handling of certain bib setting mismatches
Fix bugged warning when `biblatex` not used
Add latex label to latex code in README
Use snake_case not camelCase
  • Loading branch information
sunwukonga committed May 19, 2020
1 parent 8fe8e87 commit c26c136
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ Please note that the package `biblatex` can use both `bibtex` and the newer
`biber`, but uses `biber` by default. To use `bibtex`, add `backend=bibtex`
to your `biblatex` usepackage declaration.

```
```latex
\usepackage[backend=bibtex]{biblatex}
```

Expand Down Expand Up @@ -181,7 +181,7 @@ See [issue #46](https://github.com/xuhdev/vim-latex-live-preview/issues/46) and
If you're using `biblatex` this is most likely caused by not also setting
`g:livepreview_use_biber = 1` in your `.vimrc`. Or if you intended to use
`bibtex` not using that option when using the `biblatex` package. i.e.
```
```latex
\usepackage[backend=bibtex]{biblatex}
```

Expand Down
18 changes: 9 additions & 9 deletions plugin/latexlivepreview.vim
Original file line number Diff line number Diff line change
Expand Up @@ -101,24 +101,24 @@ function! s:StartPreview(...)
if ( l:position != 0 )
let l:matches = matchstr(getline(l:position), specific_pattern)
if ( l:matches == '' )
" expect s:useBiber=1
if ( s:useBiber == 0 )
let s:useBiber = 1
" expect s:use_biber=1
if ( s:use_biber == 0 )
let s:use_biber = 1
echohl ErrorMsg
echom "g:livepreview_use_biber not set or does not match `biblatex` usage in your document. Overridden!"
echohl None
endif
else
" expect s:useBiber=0
if ( s:useBiber == 1 )
let s:useBiber = 0
" expect s:use_biber=0
if ( s:use_biber == 1 )
let s:use_biber = 0
echohl ErrorMsg
echom "g:livepreview_use_biber is set but `biblatex` is explicitly using `bibtex`. Overridden!"
echohl None
endif
endif
else
" expect s:useBiber=0
" expect s:use_biber=0
" `biblatex` is not being used, this usually means we
" are using `bibtex`
" However, it is not a universal rule, so we do nothing.
Expand Down Expand Up @@ -217,7 +217,7 @@ EEOOFF
\ l:tmp_root_dir . '/' . bib_fn) " TODO: may fail if same bibfile names in different dirs
endfor

if s:useBiber
if s:use_biber
let s:bibexec = 'biber --input-directory=' . l:tmp_root_dir . '--output-directory=' . l:tmp_root_dir . ' ' . l:root_file
else
" The alternative to this pushing and popping is to write
Expand Down Expand Up @@ -286,7 +286,7 @@ EEOOFF
let s:previewer = s:ValidateExecutables('livepreview_previewer', [get(g:, 'livepreview_previewer', ''), 'evince', 'okular'])

" Select bibliography executable
let s:useBiber = get(g:, 'livepreview_use_biber', 0)
let s:use_biber = get(g:, 'livepreview_use_biber', 0)

return 0
endfunction
Expand Down

0 comments on commit c26c136

Please sign in to comment.