Skip to content

Instantly share code, notes, and snippets.

@ethanncyb
Created October 17, 2017 05:44
Show Gist options
  • Select an option

  • Save ethanncyb/47117adfccd54a18d8fae2618159b163 to your computer and use it in GitHub Desktop.

Select an option

Save ethanncyb/47117adfccd54a18d8fae2618159b163 to your computer and use it in GitHub Desktop.
OpenVAS7 latex2pdf whit chinese issus fix autoscirpt. (How to use: latex2pdf.sh filename.tex )
#!/bin/bash
importpack="\\usepackage{CJK}"
firstkeyword="\\begin{CJK*}{UTF8}{bsmi}"
endkeyword="\\end{CJK*}"
if ! grep -Fxq "$importpack" ${1}
then
# if not found
sed -i -e '/\\usepackage\[utf8x\]{inputenc}/a \\\'$importpack ${1}
fi
if ! grep -Fxq "$firstkeyword" ${1}
then
# if not found
sed -i -e '/\\begin{document}/a \\\'$firstkeyword ${1}
fi
if ! grep -Fxq "$endkeyword" ${1}
then
# if not found
sed -i -e '/\\end{document}/i \\\'$endkeyword ${1}
fi
pdflatex --interaction=batchmode -output-format=pdf ${1}
filename=$(sed 's/\..*//' <<< ${1})
echo "File output as: $filename.pdf"
rm $filename.aux $filename.out $filename.toc
#rm $filename.log $filename.synctex.gz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment