1

As the title suggests, I am putting an image into my pdf document using the \includegraphics command. It works, and puts my output main.pdf in the same directory as expected.

Here's where my question starts, I have this "compile" script written by this guy here bilalakil.me which generates a log and uses mv to move the main.pdf to an "output" folder. I can live without the script, but it would be cool if someone had a quick solution to this.

Compile script:

mkdir output
rm -rf .tmp-compiling
mkdir .tmp-compiling

cd .tmp-compiling cp ../main.bib .

pdflatex ../main.tex bibtex main pdflatex ../main.tex pdflatex ../main.tex

cp main.pdf ../output

cd .. rm -rf .tmp-compiling

Doing it this way, suddenly the images no longer work.

Expected output: Image Diagram working Using compile script output (not working as expected): Missing Image

I've already looked through this discussion and tried everything : Stack Exchange Image not Found \includegraphics

Proof that my .tex file and .png image are in the same directory:

Directory image A paste from the error log:

LaTeX Warning: File `orbitd1.png' not found on input line 16.

! Package pdftex.def Error: File `orbitd1.png' not found: using draft setting.

Here is the tex document named "main.tex" :

\documentclass{article}
\title{Homework 5}
\author{Kleiner Warden}
\date{date}

\usepackage{graphicx}

\begin{document}

\maketitle

\includegraphics{orbitd1.png}

\end{document}

Long story short, I found a script that was helpful but it breaks the usage of \includegraphics{image}.

  • 1
    all paths are relative to the current directory of the tex process, not relative to the file, so your image would need to be in .tmp-compiling. It is almost always better to cd to the directory with the document and use pdflatex file rather than use a path such as pdflatex ../file on the commandline. – David Carlisle Feb 16 '21 at 01:17
  • I've modified my script to the following : `mkdir output rm -rf .tmp-compiling mkdir .tmp-compiling

    cd .tmp-compiling cp ../main.bib . cd .. pdflatex main.tex cd .tmp-compiling bibtex main cd .. pdflatex main.tex pdflatex main.tex

    cp main.pdf output

    rm -rf .tmp-compiling` It now works. Thanks for the tip.

    – KleinerWarden Feb 16 '21 at 02:18
  • why not do bibtex at top level as well you are just runningthat in .tmp-compiling and it would seem you would need to copy the .aux file there and copy the generated bbl file back – David Carlisle Feb 16 '21 at 02:21
  • I haven't yet tested a document using bibtex with this bash script. What problem would be caused if I keep it the way it is? – KleinerWarden Feb 16 '21 at 02:30
  • I can't see how it works at all either as posted in the question or as I guess you mean in the comment (hard to read the second one with no line breaks) – David Carlisle Feb 16 '21 at 10:26

0 Answers0