Graphics, Figures & TablesFigure Inclusion by new Environment

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
marcusa
Posts: 8
Joined: Wed Aug 08, 2012 6:27 pm

Figure Inclusion by new Environment

Post by marcusa »

Hi everyone,

I have recently switched from TeXnicCenter (TXC) on Windows to Kile on Ubuntu. I have a problem building my PDF output from the source files that I have written in TXC when I want to build them in Kile.

I have been using an simplified way to include figures in my documents via using a new environment. Here the code.

Code: Select all

% automatisierte Bildeinfügung
\newenvironment{image}[5]{%
  \begin{figure}[#1]
    \centering
    \includegraphics[width=#2\linewidth]{#3}
    \caption{#4}
    \label{#5}
  \end{figure}%
}
In the document I used then the following for including figure

Code: Select all

\begin{image}{h}{0.4}{./pics/solgel.jpg}{Scheme of sol gel process.}{fig:solgel}
\end{image}
This method has always worked in TXC, but now in Kile he claims
package pdftex.def Error: file'./pic/solgel.jpg' not found
I don't know what's the problem because the figure is surely in the right place. does Kile not comprehend the new environment?

I have also tried including the graphic by just using \includegraphics and it seems to work. However I don't want to change all figure including code. I would very much appreciate some assistance.

Recommended reading 2024:

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

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

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Figure Inclusion by new Environment

Post by Stefan Kottwitz »

Hi marcusa,

welcome to the board!

In the code you use

Code: Select all

./pics/solgel.jpg
, but the error refers to ./pic/solgel.jpg, so it seems there's just the problem that the directory name doesn't match, verify if the file path in the code and the actual file path on disk are the same.

Stefan
LaTeX.org admin
marcusa
Posts: 8
Joined: Wed Aug 08, 2012 6:27 pm

Figure Inclusion by new Environment

Post by marcusa »

hi thanks for the quick reply but the missing "s" is not the problem i just made a typing error when writting my question
the error message is
package pdftex.def Error file'.pics/solgel.jpg' not found
User avatar
Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Re: Figure Inclusion by new Environment

Post by Stefan Kottwitz »

Perhaps post the .log file here, as attachment to a post. Click the "Upload attachment" link below the text edit field, when writing. The information there could be useful.

Stefan
LaTeX.org admin
marcusa
Posts: 8
Joined: Wed Aug 08, 2012 6:27 pm

Re: Figure Inclusion by new Environment

Post by marcusa »

here the log file. i hope this is what you had in mind
Attachments
4thphdreport.log
the corresponding log file
(27.13 KiB) Downloaded 446 times
User avatar
Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Figure Inclusion by new Environment

Post by Stefan Kottwitz »

Obviously some pictures work, as seen in the log file:

Code: Select all

<./pics/photoelectron.jpg, id=128, 233.37187pt x 202.50656pt>
File: ./pics/photoelectron.jpg Graphic file (type jpg)

<use ./pics/photoelectron.jpg>
So, the code is ok. I still think the actual file names differ. Linux/Unix is much more sensible than Windows: while Windows ignores capitalization, it's important for Linux. So, for example, if the actual file name is `./pics/Solgel.jpg' it's not found because of the capital S.

Stefan
LaTeX.org admin
marcusa
Posts: 8
Joined: Wed Aug 08, 2012 6:27 pm

Re: Figure Inclusion by new Environment

Post by marcusa »

wow that was really it! thank you very much! but why is linux so much more sensible to capital letter writing than windows?
User avatar
Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Re: Figure Inclusion by new Environment

Post by Stefan Kottwitz »

It comes from the Unix history, where file names are case-sensitive. Unix (and Linux) are more deterministic: different input, different results. It may come from the scientific background. Just imagine generated file names "a.csv", "b.csv", ... , "A.csv", ... - and you have more options if you don't merge uppercase and lowercase characters. And if you make a and A the same, perhaps you have should in consequence treat a, A, ä, Ä, á, Á, à, À, ... all the same too.

Windows is more for home users. It makes life easier if you don't care about upper or lower case.

Stefan
LaTeX.org admin
Post Reply