Graphics, Figures & Tablespstricks eps png files

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
kacz
Posts: 2
Joined: Fri May 02, 2014 10:08 am

pstricks eps png files

Post by kacz »

Hi,

I am a pstricks newbie and sticking with including a picture in a pstricks environement. Usually I create my documents with pdflatex using png files.
Now I wanna like to use pstricks to draw some arrows, lines, ... to my pictures. I read but haven't been able to solve the problem.

Using the tutorial
http://tug.org/PSTricks/main.cgi?file=p ... autopstpdf
enabled to inculde png files and create pstricks pictures (with command pdflatex --shell-escape file.tex) but I fail to combine both.

Would be great if you can give me a hint what has been going wrong! Have no idea!
Thanks!
Cheers, Kacz

Code: Select all

\documentclass[a4paper]{article}
\usepackage{ifpdf}
\ifpdf%
  \usepackage{pdftricks}
  \begin{psinputs}
    \usepackage{pstricks}
    \usepackage{auto-pst-pdf}
    \usepackage{pst-all}
    \newsavebox{\Imagebox}
  \end{psinputs}
\else
    \usepackage{pstricks}
    \usepackage{auto-pst-pdf}
    \usepackage{pst-all}
        \newsavebox{\Imagebox}
  \newenvironment{pdfpic}{}{}
\fi
 
\begin{document}


\begin{figure}[htb]
\includegraphics[width=0.5\textwidth]{pic.png}
\end{figure}



\begin{figure}[htb]
\begin{pdfpic}
\savebox{\Imagebox}{\includegraphics[width=0.7\textwidth]{pic.png}}
        \begin{pspicture}(\wd\Imagebox,\ht\Imagebox)
          \psset{unit=0.04\wd\Imagebox}
      \psgrid[subgriddiv=0,griddots=10, gridlabels=7pt](0,0)(\wd\Imagebox,\ht\Imagebox) 
          \rput[lb](0,0){\usebox{\Imagebox}}
          \rput[lb](3.5,13.3){\textbf{\Large KCl}}
        \end{pspicture}
\end{pdfpic}
\end{figure}

\end{document}

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Re: pstricks eps png files

Post by Johannes_B »

Seems to be more complicated than it should. Two alternatives: Use Xe(La)TeX, it can process ps natively.

Use TikZ instead of pstricks.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
kacz
Posts: 2
Joined: Fri May 02, 2014 10:08 am

Re: pstricks eps png files

Post by kacz »

Thanks!
Post Reply