LaTeX forum ⇒ Graphics, Figures & TablesGraphics File in custom Folder not found Topic is solved

Information and discussion about graphics, figures & tables in LaTeX documents.
Yashar
Posts: 3
Joined: Sun Nov 18, 2012 5:48 pm

Graphics File in custom Folder not found

Postby Yashar » Sun Nov 18, 2012 7:02 pm

Hi,

I'm using TeXnicCenter editor with MikTeX 2.9. I want to insert a PDF page, that I called "abc.pdf", in my PDF document. I opened a folder and called it "myfiles", this is where all my source files and "abc.pdf" are. The code related to "abc.pdf" is the following:
  1. \makeatletter
  2. \AddToShipoutPictureBG*{
  3. \setlength{\@tempdimc}{.06\paperheight}
  4. \setlength{\unitlength}{1pt}
  5. \put(\strip@pt\@tempdimb,\strip@pt\@tempdimc){
  6. \includegraphics{abc.pdf}
  7. }
  8. }
  9. \makeatother

But when I compile the document from Latex to PDF, "abc.pdf" does not appear in my document and I get the error message:
  1. Package pdftex.def error: file "abc.pdf" not found.

By the way, I am sure that there is nothing wrong with the code.
Thanks

Link:
BBcode:
HTML:
Hide post links
Show post links

hugovdberg
Posts: 133
Joined: Sat Feb 25, 2012 6:12 pm
Location: 's-Hertogenbosch, Netherlands

Postby hugovdberg » Sun Nov 18, 2012 10:31 pm

Could you please clarify your directory structure? Is your main tex-file in the same folder as the abc.pdf? From what folder are you calling latex?
Furthermore please provide a compilable minimal working example, this snippet requires packages that are not mentioned in your post.
Ubuntu 13.10 + Tex Live 2013 + Texmaker / Windows 7 Pro + MikTex 2.9 + TexnicCenter / Android 4.3 + TexPortal + DroidEdit

Link:
BBcode:
HTML:
Hide post links
Show post links

Yashar
Posts: 3
Joined: Sun Nov 18, 2012 5:48 pm

Postby Yashar » Mon Nov 19, 2012 1:44 am

Ok, the document is my thesis. All chapters (tex files) of the thesis with the abc.pdf file are in one folder called "myfiles" and this folder is in My Documents. The main tex file is outside of this folder but still in My Documents.
The main tex file looks something like this:

  1. \documentclass[11pt]{report}
  2. \usepackage{pdfpages}
  3. \usepackage{anysize,fancyhdr,graphics}
  4. \usepackage{csthesis}
  5. \usepackage{makeidx}
  6. \usepackage[titletoc]{appendix}
  7.  
  8. \makeindex
  9. \makeatletter
  10. \newcommand\otherlist{%
  11. \if@twocolumn
  12. \@restonecoltrue\onecolumn
  13. \else
  14. \@restonecolfalse
  15. \fi
  16. \chapter*{\otherlistname
  17. \@mkboth{\MakeUppercase\otherlistname}%
  18. {\MakeUppercase\otherlistname}}%
  19. \@starttoc{lop}%
  20. \if@restonecol\twocolumn\fi
  21. }
  22. \newcommand*\l@program{\@dottedtocline{1}{1.5em}{2.3em}}
  23. \newcounter{program}[chapter]
  24. \renewcommand\theprogram{\thechapter.\@arabic\c@program}
  25. \def\fps@program{tbp}
  26. \def\ftype@program{3}
  27. \def\ext@program{lop}
  28. \def\fnum@program{\programname~\theprogram}
  29. \newenvironment{program}
  30. {\@float{program}}
  31. {\end@float}
  32. \newenvironment{program*}
  33. {\@dblfloat{program}}
  34. {\end@dblfloat}
  35. \makeatother
  36.  
  37. \begin{document}
  38. \setlength{\pdfpagewidth}{8.5in}
  39. \setlength{\pdfpageheight}{11in}
  40. \figurespagetrue
  41. \tablespagetrue
  42. \dedicationpagetrue
  43. \quotationpagetrue
  44. \include{myfiles/title}
  45. \newpage
  46. \addcontentsline{toc}{chapter}{put whatever you like}
  47. \mbox{}
  48. \makeatletter
  49. \AddToShipoutPictureBG*{
  50. \setlength{\@tempdimc}{.06\paperheight}
  51. \setlength{\unitlength}{1pt}
  52. \put(\strip@pt\@tempdimb,\strip@pt\@tempdimc){
  53. \includegraphics{abc.pdf}
  54. }
  55. }
  56. \makeatother
  57. \newpage
  58.  
  59. \include{myfiles/abs}
  60. \include{myfiles/ack}
  61. \lists
  62. \include{myfiles/int}
  63. \beforetext
  64. \include{myfiles/intro}
  65. \include{myfiles/chap1}
  66. \include{myfiles/chap2}
  67. \include{myfiles/chap3}
  68. \include{myfiles/chap4}
  69. \include{myfiles/chap5}
  70. \include{myfiles/bib}
  71. \end{document}


I downloaded the pdf page from internet and put it in that folder. So maybe that's not enough.

Link:
BBcode:
HTML:
Hide post links
Show post links

hugovdberg
Posts: 133
Joined: Sat Feb 25, 2012 6:12 pm
Location: 's-Hertogenbosch, Netherlands

Postby hugovdberg » Mon Nov 19, 2012 1:58 am

Have you tried changing the path to myfiles/abc.pdf? As far as I can see it is included from your main file.

When you include the abc.pdf from a file in myfiles you still have to give the path relative to your main file since the content of that file is sort of on-the-fly copy-pasted into the main file.
Another option is the currfile package which allows you to also include files relative to the included file. So if you have three files (main.tex, myfiles/included.tex and myfiles/abc.pdf) you can refer in included.tex to just abc.pdf as long as you use the package currfile.
Ubuntu 13.10 + Tex Live 2013 + Texmaker / Windows 7 Pro + MikTex 2.9 + TexnicCenter / Android 4.3 + TexPortal + DroidEdit

Link:
BBcode: Topic is solved[/url]" title="Click to select post's link in BBcode format" onclick="this.focus();this.select();" />
HTML: Topic is solved</a>" title="Click to select post's link in HTML format" onclick="this.focus();this.select();" />
Hide post links
Show post links

Yashar
Posts: 3
Joined: Sun Nov 18, 2012 5:48 pm

Postby Yashar » Mon Nov 19, 2012 4:04 am

Thank you so much, I just changed \includegraphics{abc.pdf} to \includegraphics{myfiles/abc.pdf} and it worked! So simple! Thanks again, you are awesome!
Last edited by cgnieder on Mon Nov 19, 2012 12:52 pm, edited 1 time in total.
Reason: inline code markup

Link:
BBcode:
HTML:
Hide post links
Show post links


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: No registered users and 4 guests