Skip to content
Benct Philip Jonsson edited this page May 15, 2024 · 1 revision

Pandoc’s precompiled, static ARM binary works with Termux the terminal emulator app for Android:

To make pandoc available in Termux follow the steps below.

  1. Create the directory ${HOME}/bin and put it in your PATH if you haven’t done so already.

  2. Download the ARM .tar.gz archive from Pandoc’s release page.

  3. Unpack the archive. (tar -xzvf <archive>)

  4. cd to the bin subdirectory in the unpacked directory.

  5. mv or cp the pandoc binary to ${HOME}/bin (mv pandoc ${HOME}/bin).

  6. Do cd ${HOME}/bin

  7. Make sure pandoc is executable (chmod +x pandoc).

  8. WARNING! Pandoc’s interactive Lua mode doesn’t work in Termux. It hangs the session and the only way out is to kill Termux in Android’s Settings/Apps interface. pandoc lua <filename> works fine!

  9. You may want to define an environment variable with the path to the default Pandoc data directory..In my ~/.zshenv file I have export PDC_DATA_DIR="$HOME/.local/share/pandoc"; others may want to put it in ~/.bashrc. Don’t forget to mkdir -p $HOME/.local/share/pandoc/filters etc.

  10. You may not want to install LaTeX support which requires some huge packages. IMO the best way to produce PDF with Pandoc in Termux is html/weasyprint. There is no Termux package for weasyprint so you will have to install Python 3 and [other dependencies][] and install it with pip.install weasyprint.

  11. If you are using filters

    • You may want to make sure luarocks is installed.
    • You want to set your LUA_PATH variable properly.
    • External C libraries don’t work with Lua via the static pandoc binary. The helper modules included with pandoc are pretty comprehensive though, and pipes work fine, so you may be able to work around some limitations with external tools and scripts. Note in particular that you can create and pass around JSON to/from external scripts.