Skip to content

Instantly share code, notes, and snippets.

@mzaksana
Created August 8, 2020 11:53
Show Gist options
  • Save mzaksana/e8e1be0623fec7b99323b352865177b0 to your computer and use it in GitHub Desktop.
Save mzaksana/e8e1be0623fec7b99323b352865177b0 to your computer and use it in GitHub Desktop.
Convert svg file to tex using inkscape cli
#!/bin/bash
# Just set of command for generate tex from pdf using inkscape
# depedency :
# - inkscape
# - sed
# some editor/compiler cant find generated pdf file with realtive path by inkscape
# sed using for replace realtive path for *.pdf with absolute path in *.pdf_tex
#
# script only work with single case
# ex :
# path/terminal/
# |-file.svg
# command :
# path/to/svg2tex file
# result :
# path/terminal/
# |-file.svg
# |-file.pdf
# |-file.pdf_tex
# Note : if you move the output file, you need to edit manually the absolute path in .pdf_tex file
# @mzaksana
# convert svg to tex
inkscape -D -z --file=$@.svg --export-pdf=$@.pdf --export-latex;
# result is 2 file : *.pdf and *.pdf_tex
# repalce path .pdf with absolute path in .pdf_tex file
sed -i "s#$@.pdf#$PWD\/$@.pdf#g" $@.pdf_tex
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment