Skip to main content

Pandoc

Creating an ebook with Pandoc

For example, a pdf ebook can be generated in this folder using the following command:

pandoc --toc -o ebook.pdf index.md jekyll-for-github-pages.md pandoc.md travis-ci.md

Converting a Templated Latex File to Docx

Get CSL file for reference styles from here. We can do something like this in order to convert a latex file to a docx file:

pandoc main.tex -f latex --bibliography=references.bib --csl=ieee.csl -t docx -o output.docx

Or alternatively using docker:

FOLDER=$1
FILE_PATH=$2
TRAVIS_BUILD_DIR=$(pwd)
PANDOC_DOCKER="nimamahmoudi/latex-parser"
REFERENCE_FILE="references.bib"
CSL_FILE="ieee.csl"
docker run -t --rm --mount src=$TRAVIS_BUILD_DIR/,target=/repo,type=bind \
    $PANDOC_DOCKER /bin/bash -c \
        "cd /repo/$FOLDER && pandoc $FILE_PATH -f latex \
        --bibliography=$REFERENCE_FILE --csl=$CSL_FILE \
        -t docx -o output.docx"