Menu

Inkscape+LaTeX SVG to PDF

← TOC    ↑ Home    I+L SVG TeX TeX PDF EPS SVG PNG JPEG ICO XPM

Inkscape+LaTeX SVG to PDF

This page shows how to convert an SVG file x-il.svg from inkscape containing LaTeX special text into a standalone PDF file.

If the base file name before the extension ends in "-il" the gxhconvert script assumes the file is an SVG file created by the inkscape program requiring LaTeX to process the texts.


Choice 1: Use gxhconvert

Procedure

gxhconvert -o=pdf x-il.svg

See the [gxhconvert manual] for a full description of the gxhconvert script.

Further options

Option Purpose
--svg-area=area String. Area to export, one from:
  • drawing
    to export just the area containing drawing elements,
  • snap
    to enlarge the drawing area to the next snap grid points,
  • page
    to export the entire page.
--svg-latex Required, if the file name does not end in "-il" to indicate the texts must be processed by LaTeX.

Choice 2: Manual conversion

Procedure

Step 1: Create x-il.pdf and x-il.pdf_tex

inkscape --batch-process --export-type=pdf --export-overwrite --export-filename=x-il.pdf --export-area-drawing --export-latex x-il.svg

Step 2: Find image dimensions

The x-il.pdf_tex file sets a unit length in bp, a width factor and a height factor. Multiplication of the factors with the unit length results in width and height in bp. Round both values upwards to the next integer number.

Step 3: Write x.tex file

In line 14 and 15 replace the numbers 210 and 58 by the values just calculated.

\documentclass[12pt]{article}
% begin font setup
\usepackage[T1]{fontenc}
\usepackage{mathptmx}
\usepackage[scaled=.92]{helvet}
\usepackage{courier}
% end font setup
% begin other packages
\usepackage{textcomp}
\usepackage[intlimits]{amsmath}
% end other packages
\usepackage{graphicx}
\usepackage{color}
\setlength{\paperwidth}{210bp}
\setlength{\paperheight}{58bp}
\pagestyle{empty}
\setlength{\voffset}{-1in}
\setlength{\topmargin}{0bp}
\setlength{\headheight}{0bp}
\setlength{\headsep}{0bp}
\setlength{\topskip}{0bp}
\setlength{\hoffset}{-1in}
\setlength{\oddsidemargin}{0bp}
\setlength{\evensidemargin}{0bp}
\setlength{\marginparwidth}{0bp}
\setlength{\marginparsep}{0bp}
\setlength{\textwidth}{\paperwidth}
\setlength{\textheight}{\paperheight}
\setlength{\parskip}{0bp}
\setlength{\parindent}{0bp}
\setlength{\pdfpagewidth}{\paperwidth}
\setlength{\pdfpageheight}{\paperheight}
\begin{document}%
\input{x-il.pdf_tex}%
\end{document}

Step 4: Run pdflatex

pdflatex x

Temporary files

  • x.tex
  • x.log
  • x.aux
  • x-il.pdf
  • x-il.pdf_tex
← TOC    ↑ Home    I+L SVG TeX TeX PDF EPS SVG PNG JPEG ICO XPM

Related

Wiki: gxhconvert manual