convert2docx.sh 491 B

12345678910111213141516171819202122
  1. #!/usr/bin/env bash
  2. set -euo pipefail
  3. # reference doc:
  4. # pandoc --print-default-data-file reference.docx > pandoc_reference.docx
  5. infile="$1"
  6. outfile="$2"
  7. tmpfile="$(mktemp --suffix=.tex)"
  8. python3 preprocess_tex_for_word.py "$infile" "$tmpfile"
  9. pandoc "$tmpfile" \
  10. --reference-doc=pandoc_reference.docx \
  11. --lua-filter resolve_equation_labels.lua \
  12. -F pandoc-crossref \
  13. -M autoEqnLabels \
  14. -M tableEqns \
  15. --citeproc \
  16. --bibliography=Ref.bib \
  17. -o "$outfile"
  18. rm -f "$tmpfile"