-
-
Save lou-k/9390966 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
filename="${1}" | |
no_extension=${filename%.*} | |
# echo "Converting Markdown to LaTeX..." | |
# multimarkdown -t latex ${no_extension}.md > ${no_extension}.tex | |
echo "Running LaTeX..." | |
latex -interaction=nonstopmode ${no_extension} > /dev/null | |
echo "Running Biber..." | |
biber ${no_extension} > /dev/null | |
echo "Running LaTeX again..." | |
latex -interaction=nonstopmode ${no_extension} > /dev/null | |
echo "Running LaTeX one more time..." | |
latex -interaction=nonstopmode ${no_extension} > /dev/null | |
echo "Converting to .odt..." | |
tex4ht ${no_extension} > /dev/null | |
mk4ht oolatex ${no_extension} > /dev/null | |
echo "Converting to .docx (wait while Open/LibreOffice opens and converts the file)..." | |
## CHANGE THE PATH TO OPEN/LIBREOFFICE HERE! | |
/Applications/LibreOffice.app/Contents/MacOS/soffice.bin --invisible --convert-to docx "${no_extension}".odt | |
## | |
echo "Cleaning up..." | |
rm "${no_extension}".4ct | |
rm "${no_extension}".4tc | |
rm "${no_extension}".aux | |
rm "${no_extension}".bbl | |
rm "${no_extension}".bcf | |
rm "${no_extension}".blg | |
rm "${no_extension}".dvi | |
rm "${no_extension}".idv | |
rm "${no_extension}".lg | |
rm "${no_extension}".log | |
rm "${no_extension}".run.xml | |
rm "${no_extension}".tmp | |
rm "${no_extension}".xref | |
echo "...done!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment