Rabbit Slide Show

Get productive with vimtex for LaTeX

2016-06-16

Description

Given at http://vimberlin.de/june-2016-meetup. My learnings for setting up this tool for Vim-LaTeX editing

Text

Page: 1

Get
productive
with vimtex
for LaTeX
2016/06/16

Page: 2

Benefits I
PDF viewer of your choice
MuPDF, Zathura,
Okular, qpdfview or
SumatraPDF
continuous compilation

Page: 3

Benefits II
text-objects:
ae … LaTeX environments (e.g.
\begin{itemize})
ac … commands
i$ … inline math structure
a$ … whole math structure

Page: 4

Benefits III
motions and mappings:
[[|]] … move to next/previous
section
% … move between matching
delimeters
dse|cse … delete/change the
surrounding environment
dsc|csc … delete/change the
surrounding command

Page: 5

Benefits IV
omni completion, improved
syntax highlighting and
indentation

Page: 6

Prerequisite I
latexmk is a perl script that
runs the desired/necessary
LaTeX command the correct
number of times to resolve
cross references.
grab the latest one 22
April 2016. Version 4.45

Page: 7

Prerequisite II
ensure that libsynctex
exists in the system for
forward and backward
searching!

Page: 8

Prerequisite III
install girara
make sure zathura is
compiled with synctex
support

Page: 9

Install latexmk
$
$
$
$
$
cd /tmp
wget http://users.phys.psu.edu/%7Ecollins/software/latexmk-jcc/latexmk-445.zip
unzip latexmk*.zip
sudo cp latexmk/latexmk.pl /usr/local/bin
sudo mv /usr/local/bin/latexmk.pl /usr/local/bin/latexmk

Page: 10

Install libsynctex
#!/bin/bash
cd /tmp && rm -rf libsynctex*
if [ "$(uname -m)" == "x86_64" ]
then
wget http://de.archive.ubuntu.com/ubuntu/pool/main/t/texlive-bin/libsynctex1_2015.20160222.37495-1_amd64.deb
wget http://de.archive.ubuntu.com/ubuntu/pool/main/t/texlive-bin/libsynctex-dev_2015.20160222.37495-1_amd64.deb
else
wget http://de.archive.ubuntu.com/ubuntu/pool/main/t/texlive-bin/libsynctex1_2015.20160222.37495-1_i386.deb
wget http://de.archive.ubuntu.com/ubuntu/pool/main/t/texlive-bin/libsynctex-dev_2015.20160222.37495-1_i386.deb
fi
sudo dpkg -i libsynctex1* && sudo dpkg -i libsynctex-dev*

Page: 11

Install girara and
zathura
#!/bin/bash
GIRARA_VERSION=0.2.6
ZATHURA_VERSION=0.3.6
rm -rf /tmp/girara /tmp/zathura
# otherwise the own girara compilation will not work
sudo apt-get remove libgirara-dev
# need for zathura compilation
sudo apt-get install libmagic-dev
cd
cd
cd
cd
/tmp && git clone https://git.pwmt.org/pwmt/girara.git
girara && git checkout $GIRARA_VERSION && make && sudo make install
/tmp && git clone https://git.pwmt.org/pwmt/zathura.git
zathura && git checkout $ZATHURA_VERSION && make WITH_SYNCTEX=1 && sudo make install

Page: 12

vimtex: Basics
\ll|:VimtexCompileToggle:
compile and it will open the
pdf in your prefered pdf-
viewer
watch for latexmk
compile: started
continuous mode in the
statusline

Page: 13

vimtex: set default
pdf viewer
let g:vimtex_view_method = 'zathura'

Page: 14

vimtex: forward and
backward search

Page: 15

vimtex: forward search
\lv|:VimtexView: Open the
generated PDF
works with vim’s
servername feature or with
gvim/MacVim out of the box
for zathura

Page: 16

vimtex: backward
search
press <C-Click> on the PDF
and you jump right to the
place in the terminal.
works with gvim/MacVim out
of the box for zathura

Page: 17

vimtex: Commands I
:VimtexTocOpen|:VimtexTo
cToggle: open a clickable
toc in the left pane (q will
close the window)
:VimtexLabelsOpen|:Vimte
xLabelsToggle: open table
of labels.

Page: 18

vimtex: Commands II
:VimtexInfo: print basic
information
:VimtexCountWords|:Vimte
xCountLetters: count the
number of words/letters in
the document. It will also
show the number of math
environments, and similar.

Page: 19

vimtex: Commands III
:VimtexCompileOutput:
show the output form the
compilation command (i.e.
from latexmk)
:VimtexClean: clean
auxilliary files like *.aux,
*.out, etc.
Use :VimtexClean! to

Page: 20

vimtex: Commands IV
:VimtexErrors:open
quickfix window if there are
errors or warnings.

Page: 21

Who am I
@wikimatze
writing @padrinobook
running @vimberlin
updating @padrinorb
and organizing @vim_fest

Other slides

Vim and flog Vim and flog
2019-03-29
cmus and vim cmus and vim
2017-01-19