2

I am trying to use smartdiagram but with a background image clipped to the shape of the node for the "title" node. Then write over this some text. The MWE below shows an example of as far as I got but without the clipping. Is this possible?

\documentclass{article}
\usepackage{smartdiagram}
\usepackage[percent]{overpic}
\begin{document}
\smartdiagram[descriptive diagram]
{{
{
\begin{overpic}[width=\textwidth]{sil}
\put(1,30){Overlay}
\end{overpic}},{Description}},
{Another one, description},
}
\end{document}

Final result

  • 1
    Could try to better explain what you want the result to look like? I don't quite understand the problem. – Steven B. Segletes Jan 6 '14 at 17:45
  • 1
    Sorry about that. I want the background image "TeX" to cover the whole red circle, clipped into that circular shape. While at it, I would like to be able to reduce the opacity of the background image too. – ulugeyik Jan 6 '14 at 18:07
2

Is this what you want? I will edit/update if required.

\documentclass{article}
\usepackage{smartdiagram}
\usepackage[percent]{overpic}
\begin{document}
\smartdiagram[descriptive diagram]
{
  {
    {\begin{overpic}[width=\textwidth]{sil}
      \put(1,30){}
     \end{overpic}},{Description}
  },
  {Another one, description},
}
\end{document}

Using the image here (I just downloaded from TeX.SE and cropped it), I get:

enter image description here

  • I believe only difference from the one I have shown is that this new image has a transparent background. What I want is something like this. The image is cropped to the circle and text is overlaid. oi60.tinypic.com/fdyqzr.jpg – ulugeyik Feb 24 '14 at 8:54
  • @ulugeyik I'm confused about the "overlay" text in your MWE. Is this meant to be in the final output or just to illustrate what you want overlaid? – Paul Gessler Feb 24 '14 at 16:58
  • The idea is to use a picture, for example, of an instrument as the background of the circle, then overlay a descriptive text over it. I do not want to include the text as part of the graphic since the text may change for every presentation. – ulugeyik Feb 25 '14 at 8:47
1

Sorry, Claudio, another hack. One can "hack" single nodes by introducing a counter and tell TikZ what to do with that node. It is advantageous to do these hacks within a TeX group (but of course for a document consisting only of that diagram this does not really matter). The "hack" steps a counter and will modify a certain node (node # 1 in this case) with a \tikzset command. In this case, one can use a path picture because this will be clipped at the node boundaries.

\documentclass{article}
\usepackage{smartdiagram}
\newcounter{pft}
\begin{document}
\begingroup
\newcommand\hack{\tikzset{nodes={/utils/exec={\stepcounter{pft}
\ifnum\value{pft}=1\relax
\tikzset{path picture={\node at (path picture bounding box.center)
{\includegraphics{example-image-duck}};}}
\fi}}}}
\tikzset{every picture/.append style={execute at begin picture=\hack}}
\setcounter{pft}{0}%
\smartdiagram[descriptive diagram]
{{
{Overlay},{Description}},
{Another one, description},
}
\endgroup
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.