When imported svg into a beamer presentation that uses \pgfsetfillopacity, semi transparency stops working.
For example the code below produces different results with and without loading the package
Without the svg package:
With the svg package:
Is there a way to patch svg or a workaround to use it with beamer semitransparent features? (or maybe the problem is related to pgf?)
% code from http://tex.stackexchange.com/a/44716/7561
\documentclass[compress]{beamer}
\usecolortheme{rose}
% switch this on or off
%\usepackage{svg}
\usebackgroundtemplate{\centering
\includegraphics[width=\paperwidth,height=\paperheight]{example-image-a}}
\addtobeamertemplate{block begin}{\pgfsetfillopacity{0.5}}{\pgfsetfillopacity{1}}
\addtobeamertemplate{block alerted begin}{\pgfsetfillopacity{0.5}}{\pgfsetfillopacity{1}}
\addtobeamertemplate{block example begin}{\pgfsetfillopacity{0.5}}{\pgfsetfillopacity{1}}
\begin{document}
\begin{frame}{}
\begin{theorem}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus. Sed sit amet ipsum mauris. Maecenas congue ligula ac quam viverra nec consectetur ante hendrerit. Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue.
\end{theorem}
\begin{alertblock}{Alert!!!}
Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
\end{alertblock}
\begin{exampleblock}{Example}
Aenean ut gravida lorem. Ut turpis felis, pulvinar a semper sed, adipiscing id dolor. Pellentesque auctor nisi id magna consequat sagittis. Curabitur dapibus enim sit amet elit pharetra tincidunt feugiat nisl imperdiet. Ut convallis libero in urna ultrices accumsan. Donec sed odio eros.
\end{exampleblock}
\end{frame}
\end{document}
Extended example, that includes an .svg file.
% code from http://tex.stackexchange.com/a/44716/7561
\documentclass[compress]{beamer}
\usepackage{filecontents}
\begin{filecontents*}{sample.svg}
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="19.581747mm"
height="37.898418mm"
viewBox="0 0 69.384143 134.28573"
id="svg2"
version="1.1"
inkscape:version="0.91 r13725"
sodipodi:docname="example.svg">
<defs
id="defs4" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.35"
inkscape:cx="-280.71427"
inkscape:cy="48.571435"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
inkscape:window-width="1331"
inkscape:window-height="750"
inkscape:window-x="29"
inkscape:window-y="18"
inkscape:window-maximized="1" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-254.2857,-446.64791)">
<path
style="fill:#000000;fill-rule:evenodd;stroke:#000000;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 271.42857,580.93363 c 62.85714,-37.14285 51.42857,-85.71428 51.42857,-85.71428 l -68.57143,-48.57143 31.42858,71.42857 z"
id="path4136"
inkscape:connector-curvature="0" />
</g>
</svg>
\end{filecontents*}
\usecolortheme{rose}
% this definition creates an error on the last frame
\makeatletter
\@namedef{transparent}%
\makeatother
% switch this on or off
\usepackage{svg}
\usebackgroundtemplate{\centering
\includegraphics[width=\paperwidth,height=\paperheight]{example-image-a}}
\addtobeamertemplate{block begin}{\pgfsetfillopacity{0.5}}{\pgfsetfillopacity{1}}
\addtobeamertemplate{block alerted begin}{\pgfsetfillopacity{0.5}}{\pgfsetfillopacity{1}}
\addtobeamertemplate{block example begin}{\pgfsetfillopacity{0.5}}{\pgfsetfillopacity{1}}
\begin{document}
\begin{frame}{}
\begin{theorem}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus. Sed sit amet ipsum mauris. Maecenas congue ligula ac quam viverra nec consectetur ante hendrerit. Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue.
\end{theorem}
\begin{alertblock}{Alert!!!}
Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
\end{alertblock}
\begin{exampleblock}{Example}
Aenean ut gravida lorem. Ut turpis felis, pulvinar a semper sed, adipiscing id dolor. Pellentesque auctor nisi id magna consequat sagittis. Curabitur dapibus enim sit amet elit pharetra tincidunt feugiat nisl imperdiet. Ut convallis libero in urna ultrices accumsan. Donec sed odio eros.
\end{exampleblock}
\end{frame}
% this produces an error when \@namedef is used
\begin{frame}
\includesvg{sample}
\end{frame}
\end{document}



\RequirePackage{transparent}. – samcarter_is_at_topanswers.xyz Sep 02 '16 at 14:22svg.styto your working directory, rename it and comment out line 43\@ifpackageloaded{transparent}{}{\RequirePackage{transparent}}%and use\usepackage{my_svg}. This will probably give issues with transparency in svgs... – samcarter_is_at_topanswers.xyz Sep 02 '16 at 14:45transparentwas the culprit. However, I don't want to lose the full svg auto-conversion capability. As that is the idea of using the package in the first place. Any idea, if there is another way of using thetransparentpackage withpgf? – adn Sep 02 '16 at 20:12transparentandpgfinteract. But can you try if the method withouttransparentworks for your svgs? – samcarter_is_at_topanswers.xyz Sep 02 '16 at 20:57transparentis enabling transparency in the PDF colour stack directly. Beamer creates transparency by mixing with the background colour. I don't know what PGF does. – cfr Sep 05 '16 at 03:17transparentare competing with each other to inject code into the PDF in ways which conflict e.g. one overwriting the other or something like that. But I'm just guessing. – cfr Sep 05 '16 at 03:24.svgon the fly? or to use thetransparentpackage withpgf? – adn Sep 05 '16 at 17:42tcolorboxhas the same problem. – samcarter_is_at_topanswers.xyz Sep 29 '16 at 14:34