3. 極簡教程¶
本章意在提供最簡短而必要的步驟,以使用戶快速上手。
在應用本章步驟前,請先保證所有需要的軟件和配置已完成。
3.1. 轉換為SVG¶
把本教程附帶的
util
文件夾複製到需要轉換的TEX文件所在之目錄下。對需要轉換的TEX的文件的
documentclass
進行如下配置:1 2 3 4 5 6 7 8
\documentclass[tikz, convert, convert={outext=.svg, command=\unexpanded{ % 'out_svg'是用来存放SVG的文件夹 % 'out_svg'是用來存放SVG的文件夾 % 'out_svg' is the destination folder for SVG files call ./util/mk_folder out_svg && cd /d out_svg && call ../util/pdf_to_svg ../\infile\space \outfile\space }}]{standalone}
使用
-shell-escape
參數對TEX文件進行編譯。例如(需要把尖括號,及其所包裹的內容更換成你的TEX文件的文件名):xelatex -synctex=1 -interaction=nonstopmode -shell-escape <你TEX文件的文件名>.tex
轉換好的SVG文件將存放在
out_svg
文件夾下。
3.2. 轉換為PNG¶
把本教程附帶的
util
文件夾複製到需要轉換的TEX文件所在之目錄下。對需要轉換的TEX的文件的
documentclass
進行如下配置:1 2 3 4 5 6 7 8
\documentclass[tikz, convert, convert={command=\unexpanded{ % 'out_png'是用来存放PNG的文件夹 % 'out_png'是用來存放PNG的文件夾 % 'out_png' is the destination folder for PNG files call ./util/mk_folder out_png && cd /d out_png && call ../util/pdf_to_png.bat 600 ../\infile\space }}]{standalone}
使用
-shell-escape
參數對TEX文件進行編譯。例如(需要把尖括號,及其所包裹的內容更換成你的TEX文件的文件名):xelatex -synctex=1 -interaction=nonstopmode -shell-escape <你TEX文件的文件名>.tex
轉換好的PNG文件將存放在
out_png
文件夾下。
3.3. 轉換為EMF¶
把本教程附帶的
util
文件夾複製到需要轉換的TEX文件所在之目錄下。對需要轉換的TEX的文件的
documentclass
進行如下配置:1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
\documentclass[tikz, convert, convert={outext=.pdf, command=\unexpanded{ % 'out_emf'是用来存放EMF的文件夹 % 'out_emf'是用來存放EMF的文件夾 % 'out_emf' is the destination folder for EMF files call ./util/mk_folder out_emf && call ./util/gs_split_pdf.bat out_emf \outfile\space \infile\space && cd /d out_emf && call ../util/pdf_to_emf.bat && del /F *.pdf \sapce }}]{standalone} % inkscape只能实现单张的PDF转换EMF,所以要先用ghostscript把LaTex生成的 % PDF分页,然后调用inkscape做循环,把所有单页的PDF转换为EMF,最后删除所 % 有单页的PDF,只保留EMF。 % inkscape只能實現單張的PDF轉換EMF,所以要先用ghostscript把LaTex生成的 % PDF分頁,然後調用inkscape做循環,把所有單頁的PDF轉換爲EMF,最後刪除所 % 有單頁的PDF,只保留EMF。 % inkscape can only convert single page PDF to EMF. Therefore, the whole % PDF generated by LaTex needs to be split into single pages first, by % ghostscript. Then use inkscape in a loop to convert all single page % PDFs into EMFs. Finally, delete all single page PDFs and keep only the % EMFs.
使用
-shell-escape
參數對TEX文件進行編譯。例如(需要把尖括號,及其所包裹的內容更換成你的TEX文件的文件名):xelatex -synctex=1 -interaction=nonstopmode -shell-escape <你TEX文件的文件名>.tex
轉換好的EMF文件將存放在
out_emf
文件夾下。
3.4. 轉換為EPS¶
把本教程附帶的
util
文件夾複製到需要轉換的TEX文件所在之目錄下。對需要轉換的TEX的文件的
documentclass
進行如下配置:1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
\documentclass[tikz, convert, convert={outext=.pdf, command=\unexpanded{{ % 'out_eps'是用来存放EPS的文件夹 % 'out_eps'是用來存放EPS的文件夾 % 'out_eps' is the destination folder for EPS files call ./util/mk_folder out_eps && call ./util/gs_split_pdf.bat out_eps \outfile\space \infile\space && cd /d out_eps && call ../util/pdf_to_eps.bat && del /F *.pdf \sapce }}}]{standalone} % inkscape只能实现单张的PDF转换EPS,所以要先用ghostscript把LaTex生成的 % PDF分页,然后调用inkscape做循环,把所有单页的PDF转换为EPS,最后删除所 % 有单页的PDF,只保留EPS。 % inkscape只能實現單張的PDF轉換EPS,所以要先用ghostscript把LaTex生成的 % PDF分頁,然後調用inkscape做循環,把所有單頁的PDF轉換爲EPS,最後刪除所 % 有單頁的PDF,只保留EPS。 % inkscape can only convert single page PDF to EPS. Therefore, the whole % PDF generated by LaTex needs to be split into single pages first, by % ghostscript. Then use inkscape in a loop to convert all single page % PDFs into EPSs. Finally, delete all single page PDFs and keep only the % EPSs.
使用
-shell-escape
參數對TEX文件進行編譯。例如(需要把尖括號,及其所包裹的內容更換成你的TEX文件的文件名):xelatex -synctex=1 -interaction=nonstopmode -shell-escape <你TEX文件的文件名>.tex
轉換好的EPS文件將存放在
out_eps
文件夾下。
本章中為了方便排錯,命令是分部進行的(通過 &&
連成一行)。這些命令其實是可以放在同一個腳本中,而簡化 documentclass
的設置的。詳情請看 一步到位 。