Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I make a PNG picture by using PowerPoint, and include that picture in my slide. However, the picture's background is neither white or transparent. What should I do? You can see the slide below:

enter image description here

The code snipt below:

\begin{figure}
  \centering \includegraphics[scale=0.5]{fig/lowering_flow.png}
\end{figure}
share|improve this question
    
Wellcome to ts! Can you, please, provide a sample code to see what's going on? –  Thanos Jan 22 '13 at 8:05
2  
It's just an idea. But have you thought about reconstructing the picture by yourself with tikz? I think this shouldn't be an hard thing for this picture. –  Dave Jan 22 '13 at 8:07
1  
Additional to @Dave: tex.stackexchange.com/q/78310/18674 might help –  Benedikt Bauer Jan 22 '13 at 8:16
    
Reconstructing the picture as suggested by Dave would be better. If you want to make the background white or transparent, you have to modify the picture itself, e.g. by using The Gimp or equivalent software. Depending on color dithering, it could be more or less complicated –  Lionel MANSUY Jan 22 '13 at 8:48
    
If you ask yourself how to cite a reconstructed graphic. I had the same problem and asked on academia: academia.stackexchange.com/questions/7238/… –  Dave Jan 22 '13 at 18:16
show 2 more comments

1 Answer 1

I agree with Dave which suggest to directly draw the picture with TikZ: on the site you will find lots of starting points (one could be define one style module customizable for the colors and then use a matrix to position the nodes, or just place them via the positioning library - perhaps someone will post another answer).

I prefer another way because this is something that could be done easily also in a object-oriented fashion. The problem, or the beauty of the approach (I see it more in this way), is that one should implement itself all.

The code is commented, so it is possible to follow the reasoning behind.

\documentclass{beamer}
\usepackage{lmodern}

\usepackage{tikz}
\usepgfmodule{oo}
\usetikzlibrary{positioning}

\pgfooclass{module}{

 % class attributes
 \attribute text;
 \attribute text width=2.5cm;
 \attribute border color=orange;
 \attribute top color=none;
 \attribute bottom color=none;
 \attribute text color=black;
 \attribute label;
 \attribute width=3cm;
 \attribute height=1cm;

 % constructor method
 \method module() {
 }

 \method text(#1) {
  \pgfooset{text}{#1}
 }

 \method set text width(#1) {
  \pgfooset{text width}{#1}
 }

 \method set border color(#1) {
  \pgfooset{border color}{#1}
 }

 \method set top color(#1) {
  \pgfooset{top color}{#1}
 }

 \method set bottom color(#1) {
  \pgfooset{bottom color}{#1}
 }

 \method set text color(#1) {
  \pgfooset{text color}{#1}
 }

 \method set label(#1) {
  \pgfooset{label}{#1}
 }

 \method set width(#1) {
  \pgfooset{width}{#1}
 }

 \method set height(#1) {
  \pgfooset{height}{#1}
 }

 \method draw(#1,#2) {
  \node [rectangle,
    rounded corners,
    draw=\pgfoovalueof{border color},
    top color=\pgfoovalueof{top color},
    bottom color=\pgfoovalueof{bottom color},
    text=\pgfoovalueof{text color},
    align=center,
    text width=\pgfoovalueof{text width},
    minimum width=\pgfoovalueof{width},
    minimum height=\pgfoovalueof{height},
    ] (\pgfoovalueof{label}) at (#1,#2) {\pgfoovalueof{text}};
 }

 \method place(#1) {
  \node [rectangle,
    rounded corners,
    draw=\pgfoovalueof{border color},
    top color=\pgfoovalueof{top color},
    bottom color=\pgfoovalueof{bottom color},
    text=\pgfoovalueof{text color},
    align=center,
    text width=\pgfoovalueof{text width},
    minimum width=\pgfoovalueof{width},
    minimum height=\pgfoovalueof{height},
    #1
    ] (\pgfoovalueof{label}) {\pgfoovalueof{text}};
 }

 % shortcut method to easily set labels, text and draw
 % use the \pgfoothis to refer to the current object
 \method set and draw(#1,#2,#3,#4) {
  \pgfoothis.set label(#1)
  \pgfoothis.text(#2)
  \pgfoothis.draw(#3,#4)
 }

 % shortcut method to easily set labels, text and place
 % objects
 \method set and place(#1,#2,#3) {
  \pgfoothis.set label(#1)
  \pgfoothis.text(#2)
  \pgfoothis.place(#3)
 }

 % shortcut method to easily set the style
 \method set style(#1,#2,#3) {
  \pgfoothis.set border color(#1)
  \pgfoothis.set top color(#2)
  \pgfoothis.set bottom color(#3)
 }

 % shortcut method to easily set the dimensions
 \method set dimensions(#1,#2,#3) {
  \pgfoothis.set width(#1)
  \pgfoothis.set height(#2)
  \pgfoothis.set text width(#3)
 }

}

\begin{document}
\begin{frame}{Lowering Flow Overview}
\begin{tikzpicture}[node distance=1.5cm,scale=0.75, transform shape]
% declaring the new object with the constructor method
\pgfoonew \mod=new module()

% method set style: 
% #1= border color
% #2= top color
% #3= bottom color
\mod.set style(blue,blue!40,blue!5)

% method set and draw: 
% #1= label of the node
% #2= text
% #3,#4= coordinates
\mod.set and draw(mod1,LLVM IR,0,0)

\mod.set style(blue!50!cyan,blue!50!cyan!40,blue!50!cyan!5)

% method set dimensions: 
% #1= module width
% #2= module height
% #3= text width
\mod.set dimensions(5cm,1cm,4.9cm)

% method set and place: 
% #1= label of the node
% #2= text
% #3= position with respect to another node identified with a label
\mod.set and place(mod2,{\mbox{DAG of Target Operation} (might be illegal)} ,below of=mod1)
\mod.set and place(mod3,{\mbox{DAG of Target Operation} (legal)} ,below of=mod2)

\mod.set style(green!30!lime,green!30!lime!40,green!30!lime!5)
\mod.set and place(mod4,{\mbox{DAG of Machine}\\ Instructions} ,below of=mod3)

\mod.set style(orange,orange!40,orange!5)
\mod.set and place(mod5,{Sequence \mbox{of Machine} Instructions} ,below of=mod4)

\mod.set dimensions(3.25cm,1cm,3cm)
\mod.set style(violet!80!purple,violet!80!purple!40,violet!80!purple!5)
\mod.set and place(mod6,{Object File} ,right=3cm of mod1)

\mod.set and place(mod7,{Assembly File} ,below right=0.75cm of mod6)

\mod.set dimensions(5cm,1cm,4.9cm)
\mod.set style(red,red!40,red!5)
\mod.set and place(mod8,{\mbox{Machine Code Layer}\\ (MCInst)} ,below =2cm of mod6)

\mod.set style(orange,orange!40,orange!5)
\mod.set and place(mod9,{Sequence \mbox{of Machine} Instructions} ,below of=mod8)

% since here we repeat the same text we just need to place the object
\mod.place(below of=mod9)
\end{tikzpicture}
\end{frame}
\end{document}

The result:

enter image description here

share|improve this answer
    
O.K., now I install print/latex-beamer port on the FreeBSD machine and compile your example. I get error like this: No file mclinker-2013-chenwj.aux. ... No file mclinker-2013-chenwj.nav. ... ! Package xcolor Error: Undefined color lime. What should I do? Install the missing color or the error comes from elsewhere? –  chenwj Jan 23 '13 at 4:02
    
I would recommend you to install a complete version of TeXLive not just some packages, but I don't know the FreeBSD OS. On Debian/Ubuntu a reference point is How to install “vanilla” TeXLive on Debian or Ubuntu?. –  Claudio Fiandrino Jan 23 '13 at 8:20
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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