1

I have an svg file of an equation as follows

<svg xmlns="http://www.w3.org/2000/svg" xmlns:wrs="http://www.wiris.com/xml/cvs-extension" height="29" width="85" wrs:baseline="20"><!--MathML: <math xmlns="http://www.w3.org/1998/Math/MathML"><mi mathvariant="script">l</mi><msqrt><mpadded lspace="-4px"><mn>8</mn><mi>&#x3C0;</mi><msub><mi>&#x3B5;</mi><mn>0</mn></msub><mi>m</mi><mi>g</mi></mpadded></msqrt></math>--><defs><style type="text/css">@font-face{font-family:'math1437d7d1d97917cd627a34a6a0f';src:url(data:font/truetype;charset=utf-8;base64,AAEAAAAMAIAAAwBAT1MvMi7iBBMAAADMAAAATmNtYXDEvmKUAAABHAAAADRjdnQgDVUNBwAAAVAAAAA6Z2x5ZoPi2VsAAAGMAAAAt2hlYWQQC2qxAAACRAAAADZoaGVhCGsXSAAAAnwAAAAkaG10eE2rRkcAAAKgAAAACGxvY2EAHTwYAAACqAAAAAxtYXhwBT0FPgAAArQAAAAgbmFtZaBxlY4AAALUAAABn3Bvc3QB9wD6AAAEdAAAACBwcmVwa1uragAABJQAAAAUAAADSwGQAAUAAAQABAAAAAAABAAEAAAAAAAAAQEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAgICAAAAAg1UADev96AAAD6ACWAAAAAAACAAEAAQAAABQAAwABAAAAFAAEACAAAAAEAAQAAQAAA8D//wAAA8D///xBAAEAAAAAAAABVAMsAIABAABWACoCWAIeAQ4BLAIsAFoBgAKAAKAA1ACAAAAAAAAAACsAVQCAAKsA1QEAASsABwAAAAIAVQAAAwADqwADAAcAADMRIRElIREhVQKr/asCAP4AA6v8VVUDAAABAFUAAALAAkAAGQBBGAGwGhCwDdSwDRCwB9SwBxCwBNSwBBCwGNQAsBoQsAvUsBoQsALUsBoQsA/UsA8QsBTUsA8QsAY8sA8QsBc8MDElBiMiNQMjERQGKwE2NTQnIhUjNDMhFSMTFALAFUCAAaopAVUqAVVAagIBgQFVVdUBFv7qlUBAlYCWK4BV/urAAAABAAAAAQAA1XjOQV8PPPUAAwQA/////9Y6E3P/////1joTcwAA/yAEgAOrAAAACgACAAEAAAAAAAEAAAPo/2oAABdwAAD/tgSAAAEAAAAAAAAAAAAAAAAAAAACA1IAVQMWAFUAAAAAAAAAKAAAALcAAQAAAAIAXgAFAAAAAAACAIAEAAAAAAAEAADeAAAAAAAAABUBAgAAAAAAAAABABIAAAAAAAAAAAACAA4AEgAAAAAAAAADADAAIAAAAAAAAAAEABIAUAAAAAAAAAAFABYAYgAAAAAAAAAGAAkAeAAAAAAAAAAIABwAgQABAAAAAAABABIAAAABAAAAAAACAA4AEgABAAAAAAADADAAIAABAAAAAAAEABIAUAABAAAAAAAFABYAYgABAAAAAAAGAAkAeAABAAAAAAAIABwAgQADAAEECQABABIAAAADAAEECQACAA4AEgADAAEECQADADAAIAADAAEECQAEABIAUAADAAEECQAFABYAYgADAAEECQAGAAkAeAADAAEECQAIABwAgQBNAGEAdABoACAARgBvAG4AdABSAGUAZwB1AGwAYQByAE0AYQB0AGgAcwAgAEYAbwByACAATQBvAHIAZQAgAE0AYQB0AGgAIABGAG8AbgB0AE0AYQB0AGgAIABGAG8AbgB0AFYAZQByAHMAaQBvAG4AIAAxAC4AME1hdGhfRm9udABNAGEAdABoAHMAIABGAG8AcgAgAE0AbwByAGUAAAMAAAAAAAAB9AD6AAAAAAAAAAAAAAAAAAAAAAAAAAC5BxEAAI2FGACyAAAAFRQTsQABPw==)format('truetype');font-weight:normal;font-style:normal;}@font-face{font-family:'scriptdf906bde6d2bb9848a5f23b35';src:url(data:font/truetype;charset=utf-8;base64,AAEAAAANAIAAAwBQT1MvMlzOErEAAADcAAAATmNtYXAedkzVAAABLAAAAFhjdnQgAEkAkwAAAYQAAAAIZnBnbVO0L6cAAAGMAAACZWdseWZvPbLzAAAD9AAAAVNoZWFkEwIm0gAABUgAAAA2aGhlYRCSFtkAAAWAAAAAJGhtdHhcrhGOAAAFpAAAAAhsb2NhAAfm0wAABawAAAAMbWF4cAFSAjMAA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QBvAG4AIAAxAC4AMFNjcmlwdAAAAAMAAAAAAAAEAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAC4Af+FsAGNAEuwCFBYsQEBjlmxRgYrWCGwEFlLsBRSWCGwgFkdsAYrXFhZsBQrAAA=)format('truetype');font-weight:normal;font-style:normal;}</style></defs><text font-family="scriptdf906bde6d2bb9848a5f23b35" font-size="16" text-anchor="middle" x="4.5" y="20">&#x1D4C1;</text><polyline fill="none" points="12,-22 11,-22 5,0 2,-9" stroke="#000000" stroke-linecap="square" stroke-width="1" transform="translate(9.5,26.5)"/><polyline fill="none" points="5,0 2,-9 0,-8" stroke="#000000" stroke-linecap="square" stroke-width="1" transform="translate(9.5,26.5)"/><line stroke="#000000" stroke-linecap="square" stroke-width="1" x1="21.5" x2="83.5" y1="4.5" y2="4.5"/><text font-family="Arial" font-size="16" text-anchor="middle" x="23.5" y="20">8</text><text font-family="math1437d7d1d97917cd627a34a6a0f" font-size="16" font-style="italic" text-anchor="middle" x="34.5" y="20">&#x3C0;</text><text font-family="Arial" font-size="16" font-style="italic" text-anchor="middle" x="43.5" y="20">&#x3B5;</text><text font-family="Arial" font-size="12" text-anchor="middle" x="51.5" y="25">0</text><text font-family="Arial" font-size="16" font-style="italic" text-anchor="middle" x="61.5" y="20">m</text><text font-family="Arial" font-size="16" font-style="italic" text-anchor="middle" x="72.5" y="20">g</text></svg>

it looks like this image-name.svg

I am trying to import this into my PDF with the \includesvg command from the svg package. The package converts it into the file image-name_svg-tex.pdf which looks like below

image-name_svg-tex.pdf

When rendering my PDF it gives a package inputenc error, unicode character not found. I am guessing because when the svg package tries to render this as a simple latex and not math.

How do I get \includesvg command to render my math characters?

6
  • 2
    Welcome to TeX.SE... Can you post your code as MWE ?
    – MadyYuvi
    Commented Oct 7, 2020 at 13:55
  • 2
    You tagged this question unicode-math, but you say you are getting an error from inputenc. No TeX engine supports both inputenc and unicode-math. Could you please post a MWE and say which program you are compiling it in?
    – Davislor
    Commented Oct 7, 2020 at 13:58
  • Besides trying to get the svg to work, maybe you can also consider to write the equation in LaTeX directly? $\ell \sqrt{8\pi\varepsilon_0mg}$ seems a good approximation.
    – Marijn
    Commented Oct 7, 2020 at 14:26
  • What's an MWE? I used LaTeX directly earlier. But now I have a bunch of SVG files that I need to put into a PDF.
    – Vikramark
    Commented Oct 7, 2020 at 14:33
  • I am compiling with pylatex and the compiler is pdflatex. I've also tried latexmk. Those are the two options available in pylatex @Davislor
    – Vikramark
    Commented Oct 7, 2020 at 14:40

1 Answer 1

1

You have a few different options, depending on which problem you actually need to solve.

If you aren’t trying to generate the same output, but to include a SVG graphic that your converter does not support, you might convert the SVG to a PDF with embedded fonts, using an external tool (or generate a PDF with \documentclass{standalone}). Then, include the PDF with graphicx instead of a SVG. This can embed OpenType fonts into a PDFTeX document, and allows them to be copied and searched. It is also a good way to insert words or short phrases from a language with a complex script when you’re forced to use legacy tools.

If you can use unicode-math, you can write this expression in Arial, or a sans-serif math font, without going through a SVG or MathML.

\documentclass{article}
\usepackage{unicode-math}

\defaultfontfeatures{ Scale=MatchLowercase, Ligatures=TeX }
\setmainfont{Arial}[Scale=1.0]
\setmathfont{Fira Math}
\setmathfont{Arial}[range=up]
\setmathfont{Arial Italic}[range=it]
\setmathfont{Arial Bold}[range=bfup]
\setmathfont{Arial Bold Italic}[range=bfit]

\newcommand\epsilonnought{\varepsilon_{\scriptscriptstyle 0}}

\begin{document}
\[ \ell \sqrt{8 \pi \epsilonnought m g }
\]
\end{document}

Arial + Fira Math sample

(Yes, the subscript 0 is too low in this font.)

If you are using PDFLaTeX, you can use URW Arial as a substitute:

\documentclass{article}
\usepackage{amsmath}
\usepackage[T1]{fontenc}
\usepackage{arevmath}
\usepackage{uarial}
\renewcommand\familydefault{\sfdefault}
\usepackage[italic]{mathastext}

\newcommand\epsilonnought{\varepsilon_{\scriptscriptstyle 0}}

\begin{document}
\[ \ell \sqrt{8 \pi \epsilonnought m g }
\]
\end{document}

URW Arial + Arev Math sample

3
  • This doesn't answer the question. OP is trying to import SVG, not produce an equivalent equation without SVG. Commented Oct 7, 2020 at 16:46
  • @HenriMenke The last paragraph does say how to do precisely that. As I stated, there are several possible solutions, depending on which problem the OP is actually trying to solve.
    – Davislor
    Commented Oct 7, 2020 at 16:48
  • @HenriMenke I moved that paragraph to the top, so people won’t miss it.
    – Davislor
    Commented Oct 7, 2020 at 16:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .