Created
October 17, 2017 05:44
-
-
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 )
This file contains hidden or 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
| #!/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