Advertisement
Guest User

pandoc_pdf.sh

a guest
Sep 28th, 2019
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.91 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. #decide which file to convert
  4.  
  5. usage()
  6.         {
  7.                 echo "Use -d for document to be converted"
  8.                 echo "Use -f for LaTex fontfamily to be used"
  9.                 echo "Use -s for serif font (fbb)"
  10.                 echo "Use -a for sans serif font (arev)"
  11.         }
  12. infile=""
  13. font=""
  14. no_args="true"
  15.  
  16. while getopts ":d:f:sa" opt; do
  17.         case $opt in
  18.                 d) infile="$OPTARG" ;;
  19.                 f) font="$OPTARG" ;;
  20.                 s) font="fbb" ;;
  21.                 a) font="arev" ;;
  22.                 *) echo "No args given"
  23.                 ;;
  24.                
  25.         esac
  26.         no_args="false"
  27. done
  28. shift $((OPTIND -1))
  29.  
  30. [[ "$no_args" == "true" ]] && { usage; exit 1; }
  31.  
  32.  
  33.  
  34. #infile=${1?Error: No file given}
  35.  
  36.  
  37. #font=${2?Error: No font given}
  38.  
  39. outfile=${infile%.*}.pdf
  40.  
  41. pandoc --variable fontfamily=$font -f markdown -t latex -o $outfile $infile
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement