Skip to content

Instantly share code, notes, and snippets.

@RicardoEPRodrigues
Created July 21, 2022 13:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RicardoEPRodrigues/78cc435c5e4847ebda5711240690da73 to your computer and use it in GitHub Desktop.
Save RicardoEPRodrigues/78cc435c5e4847ebda5711240690da73 to your computer and use it in GitHub Desktop.
From Latex to Epub with Pandoc
#!/bin/bash
# This script makes use of Pandoc (https://pandoc.org/) to convert from Latex to Epub
# While interesting, this solution does require further work on the Latex document. Here follows some suggestions:
#
# (1) Change document class to memoir. \documentclass{memoir}
# (2) Simple figures compile just fine, but subfigures and more complex solutions will be ignored. Convert complex solutions into simple, multiple figures to fix this.
# (3) The same applies to tables. Only very simple tables will be rendered. My suggestion is to take a high-resolution screenshot of the table and use a figure instead.
set -e
set -x
SOURCE_FILE="main.tex"
TARGET_FILE="output.epub"
BIBLIOGRAPHY="references.bib"
pandoc --bibliography=${BIBLIOGRAPHY} --filter=pandoc-citeproc -s ${SOURCE_FILE} -o ${TARGET_FILE} --metadata link-citations=true --metadata link-bibliography=true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment