#!/bin/bash # Compile document with correct settings sed -i 's/%\\color/\\color/g' preamble_article.tex cp master_article.tex dist.tex xelatex dist.tex sed -i 's/\\color/%\\color/g' preamble_article.tex # Convert pdf to image convert -verbose -density 150 dist.pdf -strip -quality 100 -sharpen 0x1.0 -append dist.png convert dist.png -trim dist.png