zathura

From ArchWiki

zathura is a customizable document viewer with vi-like keybindings. It provides a minimalistic and space-saving interface. Users interact with zathura primarily with the keyboard. Different file formats are supported through plugins. Support is available for PDF, PS, DjVu and comic book files.

See zathura(1) for more information.

Installation

Install the zathura package along with the desired optional dependencies:

Configuration

See zathurarc(5) for more information.

Enable copy to clipboard

~/.config/zathura/zathurarc
set selection-clipboard clipboard

Side-by-side mode

In side-by-side (d) mode, to view odd pages on the left side, enter the command set first-page-column 1:1 into zathura. This is particularly useful for reading two-page illustrations or music scans where typesetting optimizes page-turning on certain pages:

~/.config/zathura/zathurarc
map D set "first-page-column 1:1"
map <C-d> set "first-page-column 1:2"

Make zathura the default pdf viewer

Ensures, for example, that xdg-open(1) will open pdf files with zathura.

First, ensure a desktop entry for zathura exists at /usr/share/applications/org.pwmt.zathura.desktop. If it does not, download the desktop entry from from the zathura repo to /usr/share/applications/org.pwmt.zathura.desktop.

Then, set zathura as default using xdg-mime(1)

$ xdg-mime default org.pwmt.zathura.desktop application/pdf

Emacs keymap

zathura uses vi-like key map by default. Emacs key bindings need to be separately configured. An example can be found here.

Usage

Commands may be entered directly into zathura by pressing :, just like in vi.

zathura automatically reloads documents. When working in compiled documents such as those written in LaTeX, zathura will refresh the output whenever compilation takes place. zathura has the option of enabling inverse search (using "synctex").

zathura can adjust the document to page-fit (a) or to fit width (s), and it can rotate pages (r). It can view pages side-by-side (d) and has a fullscreen mode. Pages can also be recolored to have a black background and white foreground (C-r). Most of vi's movement/scrolling commands are supported.

Links can be followed by clicking them. Additionally, one can press f to highlight all links on the page and assign them a number, typing the number of the link and pressing enter will then jump to the link's location. If F is used, only the location of the link will be shown in the status bar.

zathura can search for text and copy text to the primary X selection. It supports bookmarks and can open encrypted files.

The behavior and appearance of zathura can be customised using a configuration file. zathura has the ability to execute external shell commands. It can be opened in tabs using tabbed.

zathura provides an optional sandbox mode by using seccomp filter to provide a hardened runtime environment.

Page number offset

Many editions of printed books only start counting page numbering at the beginning of the text. However, zathura counts all pages of the PDF, including pages some editions do not: the front cover, edition notice, the initial couple of blank pages, etc. For this reason, zathura's page numbering is sometimes misaligned with the edition, which makes it a hassle to follow page numbers used by the table of contents, or citations.

The command :offset <number> will make zathura take into account an offset when jumping to a page number (by typing <number>G, the command :<number> will not mind the offset [1]). For example, a given book begins counting its pages on the PDF's 17th page (so on page 17, the index is 1; on 18 it is 2, and so on). On setting :offset 16, 245G will jump to the 261st page of the PDF rather than the 245th.

Sandbox

zathura comes with an additional zathura-sandbox binary that provides a secure runtime environment by using seccomp filter and landlock. This sandboxed version of zathura runs without network access, with read only filesystem permissions and a severely limited number of permitted system calls, reducing the kernel attack surface significantly.

Some features are disabled when using zathura-sandbox, such as writing files, printing and bookmarks.

Read Microsoft Office/LibreOffice documents within zathura

The zaread-gitAUR script allows for opening Microsoft Office/LibreOffice documents with zathura.

To use it, run

$ zaread /path/to/document.docx

Troubleshooting

Low font rendering quality

High memory usage with Poppler

According to the issue, switching from zathura-pdf-poppler to zathura-pdf-mupdf might solve the problem. However, if you are searching in a large document, a lot of memory will still be used.