Importing PDF to SWP document

rdt's picture

I'm having trouble getting .pdf images into a Scientific Workplace document. I've tried inserting a line like the following in a TeX field:

\includegraphics{name_figure.pdf}

Since my .pdf file is held in a folder that isn't familier to Scientific Workplace, I added a line like the following to the preamble:

\graphicspath{G:/folder_1/folder_2/folder_3/}

where folder_3 is the folder the image sits in.

When I compile the document (e.g., Preview PDF) I always get a fatal error saying that the PDF can't be found, such as:
Error: pdflatex.exe (file name_figure.pdf)
: cannot find image file
 ==> Fatal error occurred, the output PDF file is not finished!
 name_figure.pdf
[pdfLaTeX finished]

Suggestions greatly appreciated.

tomprice's picture

 Hello, I was able to get

 Hello,

I was able to get testgr_0.tex to format using SWP 5.5; both axis_0.pdf and Pulse_pdf were included in the typeset file; please see the attached files. (Note that the posted name of the first graphic file was axis.pdf but the call was for axis_0.pdf.) I did this by including the entire graphics path in the includegraphics commands; you can not have spaces in this path. I hope this helps.

Tom

John MacKendrick's picture

You should try placing two

You should try placing two sets of {{}} around the argument of the \graphicspath statement so that it reads

 

\graphicspath{{G:/folder_1/folder_2/folder_3/}}

rdt's picture

I tried adding the extra { }

I tried adding the extra { } as suggested, and got basically the same error message. I subsequently also tried adding double {} to the \includegraphics command and also got same message. The error was as follows:

! Missing $ inserted.
<inserted text>
                $
l.1937 ...name_figure.pdf}}
                                                  %
?
LaTeX Warning: File `{name_figure.pdf}' no
t found on input line 1937.
Error: pdflatex.exe (file name_figure.pdf)
: cannot find image file
 ==> Fatal error occurred, the output PDF file is not finished!
 name_figure.pdf
[pdfLaTeX finished]

Adobe Reader tried to open, but there I got the message: "There was an error opening this document. The file is damaged and could not be repaired."

Right now the PDFs I'm trying to import are saved on a USB drive (my G:\ drive), could that be part of the problem?

altintas's picture

I upgraded my SW5.0 to 5.5

I upgraded my SW5.0 to 5.5 but I am still having the same problem. It does not find pdf graphics, regardless of the versin of PDF. I am attaching a very simple - one figure SW file which I used for testing.This is the message I keep getting

(c:/swp55/temp/swp0000.tex
LaTeX2e <2003/12/01>
Babel <v3.8a> and hyphenation patterns for american, english, french, german, n
german, loaded.
(c:/swp55/TCITeX/tex/latex/base/article.cls
Document Class: article 2004/02/16 v1.4f Standard LaTeX document class
(c:/swp55/TCITeX/tex/latex/base/size10.clo))
(c:/swp55/TCITeX/tex/latex/required/graphics/graphicx.sty
(c:/swp55/TCITeX/tex/latex/required/graphics/keyval.sty)
(c:/swp55/TCITeX/tex/latex/required/graphics/graphics.sty
(c:/swp55/TCITeX/tex/latex/required/graphics/trig.sty)
(c:/swp55/TCITeX/tex/latex/required/graphics/graphics.cfg)
(c:/swp55/TCITeX/tex/latex/required/graphics/pdftex.def)))
(c:/swp55/TCITeX/tex/latex/amsfonts/amsfonts.sty)
(c:/swp55/TCITeX/tex/latex/contrib/hyphenat/hyphenat.sty)
(c:/swp55/TCITeX/tex/latex/contrib/geometry/geometry.sty
(c:/swp55/TCITeX/tex/latex/contrib/oberdiek/ifpdf.sty)
(c:/swp55/TCITeX/tex/latex/contrib/oberdiek/ifvtex.sty)
(c:/swp55/TCITeX/tex/latex/contrib/geometry/geometry.cfg))
(c:/swp55/TCITeX/tex/latex/SWmacros/tcilatex.tex
TCILATEX Macros for Scientific Word and Scientific WorkPlace 5.5 <06 Oct 2005>.

NOTICE: This macro file is NOT proprietary and may be freely copied and distrib
uted.
(c:/swp55/TCITeX/tex/latex/amsmath/amsmath.sty
For additional information on amsmath, use the `?' option.
(c:/swp55/TCITeX/tex/latex/amsmath/amstext.sty
(c:/swp55/TCITeX/tex/latex/amsmath/amsgen.sty))
(c:/swp55/TCITeX/tex/latex/amsmath/amsbsy.sty)
(c:/swp55/TCITeX/tex/latex/amsmath/amsopn.sty)))
No file swp0000.aux.
*geometry auto-detecting driver*
*geometry detected driver: pdftex*

LaTeX Warning: File `axis.pdf' not found on input line 49.

!pdfTeX error: pdflatex.exe (file axis.pdf): cannot find image file
 ==> Fatal error occurred, no output PDF file produced!
[pdfLaTeX finished]
 

 

The sample document you

The sample document you posted did not include a \graphicspath statement.  I was able to compile without errors after I added an appropriate (for my directory structure) \graphicspath statement.  Attached is the resulting PDF file.

The error message indicates

The error message indicates that LaTeX is expecting to be in math mode but is in text mode.  This is being triggered by the underscore in the file name of the graphics.  Rename your graphics to not use underscores in the name and you should be able to avoid this error.

rdt's picture

Thanks! For the record, that

Thanks! For the record, that solved the problem. I also had to change the directory names under \graphicspath in the preamble so that the underscores were removed from that.

Then I was getting an error message about how the PDFs I am using are version 1.6, but the compiler can only work with PDFs up to version 1.4. I saw somewhere else that I could fix that by adding the following 2 lines into the preamble:

\pdfoptionpdfinclusionerrorlevel=0
\pdfoptionpdfminorversion=6

Everything looks good now.

 

aladino's picture

It looks very strange that it

It looks very strange that it works!

The issue is that it works fine with any latex compiler but not with SWP 5.5 (even after removing the underscore from the file name)
Here I put the code; I placed the file axis0.pdf in the same folder where the .tex is saved, so that there is no need to set the path

\documentclass{article}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[pdftex]{graphicx}
\usepackage{amsfonts}
\usepackage{hyphenat}
\usepackage{geometry}
\usepackage[pdftex]{graphicx}
\usepackage[pdftex]{hyperref}

%TCIDATA{OutputFilter=LATEX.DLL}
%TCIDATA{Version=5.50.0.2953}
%TCIDATA{}
%TCIDATA{BibliographyScheme=Manual}
%TCIDATA{Created=Thursday, September 23, 2010 16:22:49}
%TCIDATA{LastRevised=Thursday, November 27, 2014 01:06:46}
%TCIDATA{}
%TCIDATA{}
%TCIDATA{CSTFile=40 LaTeX article.cst}

\input{tcilatex}

\begin{document}

This is a test \
\begin{figure}[h]
\begin{center}
\includegraphics{axis0.pdf}
\end{center}
\caption{Caption describing the Figure}
\label{figure1}
\end{figure}

\end{document}

You don't have a

You don't have a \graphicspath command in your document premable, so the graphics files cannot be found.  Use the command in the form:

\graphicspath{{c:/swp55/graphics/}}

Be sure to use forward slashes, end with a slash.  More than one directory can be listed, so each directory is included in a set of braces inside the braces for the macro.  So, if you move the document between computers where the graphics files are in different directories, you can use a command of the form:

\graphicspath{{c:/swp55/graphics/}{c:/Documents/graphics/}}

 

aladino's picture

Thanks for your reply.

Thanks for your reply. Unfortunately it doesn't work even if I specify the path
/b<

Error: pdflatex.exe (file C:/swp55/Graphics/miefigure/rampini_cycle.pdf): xpdf:
reading PDF image failed
==> Fatal error occurred, the output PDF file is not finished!
[pdfLaTeX finished]

Whereas this is the code I used (updated after your suggestion to include the \graphicspath command)

\documentclass[12pt]{article}
\usepackage{graphics}
\usepackage[onehalfspacing]{setspace}
\usepackage[pdftex]{graphicx}
\setcounter{MaxMatrixCols}{10}
\graphicspath{{C:/swp55/Graphics/miefigure/}}
\DeclareGraphicsExtensions{.m,.eps,.pdf,.png,.jpg,.tif,.fig}

\input{tcilatex}

\begin{document}

This is a test

\begin{figure}[tbph]
\includegraphics{axis0.pdf}
\caption{Name of the figure}
\end{figure}

\end{document}

aladino's picture

It could be something related

It could be something related to the version of the pdf?

Error: PDF version 1.6 -- xpdf supports version 1.4 (continuing anyway)
Error (0): PDF file is damaged - attempting to reconstruct xref table...
Error: Couldn't find trailer dictionary
Error: Couldn't read xref table

Bottom line:

1) it seems that it is not possible to import figures in pdf into SWP 5.5
2) the problem is not solved if you specify the path (either if you save the image.pdf in the same working directory where the tex file is, or if you specify explicitely the folder where image.pdf is saved by means of \graphicspath{{subd1}{subd2}...{subdN}})

Notice the error.  You are

Notice the error.  You are using a version 1.6 PDF file, but pdflatex supports including only version 1.4.  See http://forum.mackichan.com/node/99#comment-112 for my previous reply to this message (that I forgot that I had written but found after doing an Internet search).

aladino's picture

Thanks for your reply.

Thanks for your reply. Unfortunately it doesn't work even if I specify the path
/b<

Error: pdflatex.exe (file C:/swp55/Graphics/miefigure/rampini_cycle.pdf): xpdf:
reading PDF image failed
==> Fatal error occurred, the output PDF file is not finished!
[pdfLaTeX finished]

Whereas this is the code I used (updated after your suggestion to include the \graphicspath command)

\documentclass[12pt]{article}
\usepackage{graphics}
\usepackage[onehalfspacing]{setspace}
\usepackage[pdftex]{graphicx}
\setcounter{MaxMatrixCols}{10}
\graphicspath{{C:/swp55/Graphics/miefigure/}}
\DeclareGraphicsExtensions{.m,.eps,.pdf,.png,.jpg,.tif,.fig}

\input{tcilatex}

\begin{document}

This is a test

\begin{figure}[tbph]
\includegraphics{axis0.pdf}
\caption{Name of the figure}
\end{figure}

\end{document}

It is successful to complie

It is successful to complie it following your instruction, but only with your .pdf image. When I use my one, it fails. The pdf image I used is printed as pdf from visio. It is attached.

What is wrong? Is it related to the way how to generate the pdf image?

the result is shown as

....

NOTICE: This macro file is NOT proprietary and may be freely copied and distrib
uted.
(c:\swp55\TCITeX/tex/latex/amsmath/amsmath.sty
For additional information on amsmath, use the `?' option.
(c:\swp55\TCITeX/tex/latex/amsmath/amstext.sty
(c:\swp55\TCITeX/tex/latex/amsmath/amsgen.sty))
(c:\swp55\TCITeX/tex/latex/amsmath/amsbsy.sty)
(c:\swp55\TCITeX/tex/latex/amsmath/amsopn.sty))) (./testgr1.aux)
(c:\swp55\TCITeX/tex/latex/contrib/hyperref/nameref.sty) (./testgr1.out)
(./testgr1.out)

LaTeX Warning: File `Pulse.pdf' not found on input line 32.

Error: pdflatex.exe (file Pulse.pdf): cannot find image file
 ==> Fatal error occurred, the output PDF file is not finished!
 PulseCompression.pdf
[pdfLaTeX finished]
 

The error message is the the

The error message is the the file Pulse.pdf was not found.  You either need to included the complete path in the \includegraphics statement or use a \graphicspath statement so the included graphics file can be located at compile time.  See Tom's example above (http://forum.mackichan.com/node/90#comment-1275).  I didn't try Tom's example, but I'm sure it will work.

rdt's picture

Oh, and I forgot to mention

Oh, and I forgot to mention (regarding message above), that I added the packages hyperref and graphicx and let pdftex be specified as the graphics driver option for both.

ambropo's picture

I tried to follow your

I tried to follow your advices, but I still get an error message when compiling:

===============================================

! LaTeX Error: Option clash for package graphicx.

See the LaTeX manual or LaTeX Companion for explanation.

Type  H <return>  for immediate help.

 ...                                              

l.7 \usepackage

               [pdftex]{hyperref}

===============================================

Which version of Scientific Workplace are you using? I have the 5.0.

Thanks in advance,

Ambrogio

 

 

rdt's picture

I'm using version 5.50.

I'm using version 5.50. However (in my very limited expertise) I don't think it's a version problem. Your error message "Option clash" is one I haven't seen before. I quickly googled

scientific workplace "option clash"

and found the following comment string among others:

http://www.latex-community.org/forum/viewtopic.php?f=4&t=1749&start=0

Looks like this could help.