You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
899 B
Bash
38 lines
899 B
Bash
#!/bin/bash
|
|
# Based on notes from https://medium.com/@zhelinchen91/how-to-convert-from-latex-to-ms-word-with-pandoc-f2045a762293
|
|
|
|
while [[ $# -gt 0 ]]; do
|
|
case $1 in
|
|
-f|--filename)
|
|
FILE_STEM="${2%.tex}"
|
|
shift # past argument
|
|
shift # past value
|
|
;;
|
|
-h|--help)
|
|
echo "$0 -f|--filename FILENAME [-h|--help] [-b|--bibliography BIBLIOGRAPHY] "
|
|
exit 0
|
|
;;
|
|
-b|--bibliography-file)
|
|
BIBLIOGRAPHY="${2}"
|
|
shift # past argument
|
|
shift # past value
|
|
;;
|
|
-*|--*)
|
|
echo "Unknown option $1"
|
|
exit 1
|
|
;;
|
|
*)
|
|
#POSITIONAL_ARGS+=("$1") # save positional arg
|
|
#shift # past argument
|
|
echo "Unknown option $1"
|
|
exit 1
|
|
;;
|
|
esac
|
|
done
|
|
|
|
|
|
|
|
#if there is a bibliography
|
|
pandoc "${FILE_STEM}.tex" --bibliography="${BIBLIOGRAPHY}" -o "${FILE_STEM}.docx"
|
|
pandoc "${FILE_STEM}.tex" -o "${FILE_STEM}.docx"
|