How to include pdf image in tikzpicture enviroment?

2,981

If the example is run with pdflatex, the following warning appears:

Package pdftex.def Warning: Option `bb' does not make sense,
(pdftex.def)                using `viewport' instead on input line 30.

Remove the wrong option with the empty bounding box/viewport bb=0 0 0 0.

If you want to put the math stuff on top of the image, then move the image node at the beginning before the math stuff nodes.

Share:
2,981

Related videos on Youtube

Heiko Oberdiek
Author by

Heiko Oberdiek

Updated on August 01, 2022

Comments

  • Heiko Oberdiek
    Heiko Oberdiek over 1 year

    with the following script the pdf image does not appear..., why not?

    \documentclass[12pt]{article}
    \usepackage{tikz,amsmath, amssymb,bm,color}
    \usepackage[margin=0cm,nohead]{geometry}
    \usepackage[active,tightpage]{preview}
    % needed for BB
    \usetikzlibrary{calc}
    
    \usepackage{amsmath,sectsty,booktabs,fixltx2e,setspace}
    \usepackage{siunitx}
    \usepackage{tikz}
    \tikzset{every picture/.style={font issue=\footnotesize},
            font issue/.style={execute at begin picture={#1\selectfont}}
            }
    \usepackage{pgfplots}
    \newcommand{\td}{\mathrm{d}}
    
    \begin{document}
    
    \begin{tikzpicture}
    
    \node[draw=none,fill=none] at (3.7,3.7) {${\bm\varepsilon }$};
    \node[draw=none,fill=none] at (2.4,0.3) {${\bm\varepsilon ^{\rm{e}}}$};
    \node[draw=none,fill=none] at (5.1,0.3) {${\bm\varepsilon ^{\rm{i}}}$};
    \node[draw=none,fill=none] at (3.7,3.1) {${\bf{C}}$};
    \node[draw=none,fill=none] at (2.7,1.6) {${{\bf{C}}^{\rm{M}}}$};
    \node[draw=none,fill=none] at (4.8,1.6) {${{\bf{C}}^{\rm{V}}}$};
    \node[draw=none,fill=none] at (7.7,1.9) {${\bm\sigma }$};
    \node[draw=none,fill=none] at (-0.2,1.9) {${\bm\sigma }$};
    
    \node[draw=none,fill=none] at (0,0){\includegraphics[bb=0 0 0 0]{sls.pdf}};
    
    \end{tikzpicture}
    
    
    \end{document}
    
    • John Kormylo
      John Kormylo about 8 years
      BTW, you have tikz installed twice, and color is redundant. I had to remove the preview package (whatever that does) in order to get a useful PDF. Your geometry settings make me wonder if the standalone class might be more useful.
  • John Kormylo
    John Kormylo about 8 years
    Or use the backgrounds tikzlibrary.