Hello,
I have an svg graphic that I would like to include in my latex doc. It has a transparent background, and I have converted it to png to include in the latex file and the edges of the image are pixelated. I opened it up in inkscape and tried to export to eps, but the edges were still pixelated. Does anyone have any ideas? Inkscape has an export to latex with pstricks, but I can't seem to figure out how to actually bring that into my latex doc.
Thank you everyone
Graphics, Figures & Tables ⇒ SVG with transparency in Latex
NEW: TikZ book now 40% off at Amazon.com for a short time.

Re: SVG with transparency in Latex
Example code, please. If you're using pdflatex (or xelatex), PNG should work fine.
-
- Posts: 5
- Joined: Fri Jan 08, 2010 7:46 pm
SVG with transparency in Latex
Here Is the code
And I attached the png and the eps depending on how you want to compile it.
thank you everyone
Code: Select all
\documentclass{article}
\usepackage{calc}
\usepackage{framed}
\usepackage{tikz}
\usetikzlibrary{decorations.text}
\usepackage{lipsum}
\renewenvironment{shaded}{%
\def\FrameCommand{\colorbox{blue!20}}%
\MakeFramed {\FrameRestore}}%
{\endMakeFramed}
\newlength\mylena
\newlength\mylenb
\setlength\mylena{1.5cm}
\setlength\mylenb{.9\textwidth - \mylena}
\newenvironment{myenv}
{\begin{shaded}%
\begin{minipage}[c][1cm][c]{\mylena}
\includegraphics{dialog-information}
\end{minipage}%
\begin{minipage}[t]{\mylenb}}
{\end{minipage}\end{shaded}}
\begin{document}
\lipsum[1]
\begin{myenv}
Some short text.
\end{myenv}
\lipsum[1]
\begin{myenv}
\lipsum[1]
\end{myenv}
\lipsum[1]
\end{document}
thank you everyone
- Attachments
-
- test.pdf
- The output of the code
- (14.82 KiB) Downloaded 391 times
-
- images.zip
- The eps and png image
- (14.2 KiB) Downloaded 242 times
Re: SVG with transparency in Latex
You may try exporting your SVG file as PNG, but at higher resolution (300dpi and higher, though it still may look ugly) or, better, try exporting as PDF file (this way you'll still have a vector object and no pixelization will occur). I created something similar as the info-sign in Inkscape and exported it at 300dpi (PNG and PDF). PDF looks OK, while PNG was OK only at certain zoom levels (but not with all pdf viewers: in Okular actually PNG was better-looking than PDF). If you intent for your document to be read from screen, you'll get better results with PDF. For printing, there may be no difference, both should do fine.
Notice that the very first occurrence of info-sign in attached file is PNG file, while all others are PDF file(s).
Notice that the very first occurrence of info-sign in attached file is PNG file, while all others are PDF file(s).
- Attachments
-
- test.pdf
- (59.85 KiB) Downloaded 339 times
-
- Posts: 5
- Joined: Fri Jan 08, 2010 7:46 pm
Re: SVG with transparency in Latex
I tried to convert the svg I have of the logo to pdf and it becomes square. I know this is an inkscape problem, so it is off-topic but does anyone have any ideas? I attached the svg and the pdf.
thanks,
thanks,
- Attachments
-
- images2.zip
- (5.65 KiB) Downloaded 281 times
Re: SVG with transparency in Latex
Unfortunately, .svg is problematic because every application has its own interpretation of it. So, the same file looks different in every app
You may try with Scribus or some other vector editing app, but you'll definitely lose some details here and there (although you probably wouldn't end up with such a difference as getting a square from a circle). But keep in mind that PDF viewer may also be the source of display problems (OK, apart from that square, of course; and there is cairo too)...
