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
的设置的。详情请看 一步到位 。