LaTeX Using LaTeX with TexnicCenter: Inserting Pictures

  • Thread starter Thread starter NEWO
  • Start date Start date
  • Tags Tags
    Latex
AI Thread Summary
To insert a picture into a LaTeX document using TexnicCenter, the graphicx package must be included in the document preamble. The correct command is \usepackage{graphicx}. The figure can be added using the \begin{figure} environment and the \includegraphics command. It is crucial to ensure that the file path does not contain spaces, as LaTeX may struggle with such paths. Keeping all graphics files in the same directory as the LaTeX document simplifies the process, allowing for commands like \includegraphics{potstep.jpg} or \includegraphics{somefolder/potstep.jpg} if the image is in a subfolder. If issues persist, verifying the file path and ensuring the graphicx package is properly referenced in the preamble are essential steps.
NEWO
Messages
93
Reaction score
0
hi there, I am writing a report on texnicCenter that uses Latex.

I have a picture drawn on the computer and i need to be able to insert the picture into my document using latex as a figure. If anyone knows the commands for such a thing i would be gratefull if you coul tell me thank you very much

newo
 
Physics news on Phys.org
NEWO said:
hi there, I am writing a report on texnicCenter that uses Latex.

I have a picture drawn on the computer and i need to be able to insert the picture into my document using latex as a figure. If anyone knows the commands for such a thing i would be gratefull if you coul tell me thank you very much

newo

google for "put figure in latex document"
 
ive done so and tried the following commands however it doesn't seem to work

\begin{figure}
\includegraphics[height=60mm]{C:\Documents and Settings\Owen Booler\My Documents\My Pictures\potstep.jpg}
\caption{Diagram showing the tunneling in the step potential problem}
\end{figure}

My file that i want to insert is located in C:\Documents and Settings\Owen Booler\My Documents\My Pictures\potstep.jpg

Whats going wrong?

Thanks for any help
 
NEWO said:
ive done so and tried the following commands however it doesn't seem to work

\begin{figure}
\includegraphics[height=60mm]{C:\Documents and Settings\Owen Booler\My Documents\My Pictures\potstep.jpg}
\caption{Diagram showing the tunneling in the step potential problem}
\end{figure}

My file that i want to insert is located in C:\Documents and Settings\Owen Booler\My Documents\My Pictures\potstep.jpg

Whats going wrong?

Thanks for any help

Did you remember to use the graphix package in your preamble before you begin the document?
 
1. you did not type the filelocation correctly.
2. LaTeX does not (i belive) like spaces in the path. atleast i cannot include a pictures located in 'E:/Documents/My Pictures/' but i can include one that is placed in 'E:/Documents/'

The following works fine with MikTeX and pdflatex

Code:
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\includegraphics{E:/Documents/stone} % stone.jpg <--!
\end{document}

If you have all your pictures located in the same folder the following could perhaps come in handy:
Code:
\documentclass{article}
\usepackage{graphicx}
\graphicspath{{E:/Documents/}} 
\begin{document}
\includegraphics{stone} % stone.jpg <--!
\end{document}
 
Last edited:
Its best to keep all files related to a given document in the same folder, this prevents problems with a given LaTeX distribution. You might try using "My Pictures" (include the double quotes in the path name).
 
thanks for you help so far, however I have tried to do what you said and it still won't work. What is the graphicx is it a programme that I should have?

this is what I have done;

\begin{figure}[h]
\usepackage{graphicx}
\includegraphics{C:/potstep.jpg}
\caption{Diagram showing the wavefunction $\psi\left(x\right)_{1}$ in the left region and $\psi\left(x\right)_{2}$ in the right}
\end{figure}

thanks for any help

newo
 
I do not know how you do it in TexnicCenter (why not use emacs/aucTeX? :D) somewhere you should be able to tell TexnicCenter what packages you wish to use. graphicx is one such package and is nessesary for includeing graphics. I am sure you have that package installed but you need to add it to your document. The way I showeded it \usepackage{graphicx} was called *before* the actually document started. You need to do something similar in TexnicCenter, it does *not* work to include it inside a figure enviroment.
 
NEWO said:
thanks for you help so far, however I have tried to do what you said and it still won't work. What is the graphicx is it a programme that I should have?

this is what I have done;

\begin{figure}[h]
\usepackage{graphicx}
\includegraphics{C:/potstep.jpg}
\caption{Diagram showing the wavefunction $\psi\left(x\right)_{1}$ in the left region and $\psi\left(x\right)_{2}$ in the right}
\end{figure}

thanks for any help

newo

that would work fine as long as potstep.jpg is at the root folder of your C: drive. The easiest and probably best thing is to do what franz and triss said and keep your graphics files in the same folder (or a subfolder) as your LaTeX/TeX file. That way all the includegraphics line need to say is
Code:
\includegraphics{potstep.jpg}
or
Code:
\includegraphics{somefolder/potstep.jpg}
if you put it in a subfolder.
 
  • #10
imabug said:
that would work fine as long as potstep.jpg is at the root folder of your C: drive. The easiest and probably best thing is to do what franz and triss said and keep your graphics files in the same folder (or a subfolder) as your LaTeX/TeX file.

It will only work if \usepackage{graphicx} is called in the preamble, latex is not *that* smart :wink:
 
  • #11
Triss said:
It will only work if \usepackage{graphicx} is called in the preamble, latex is not *that* smart :wink:
right, yeah, good catch. i totally missed that :blushing:
 

Similar threads

Replies
4
Views
2K
Replies
12
Views
3K
Replies
3
Views
3K
Replies
2
Views
3K
Replies
45
Views
10K
Replies
12
Views
2K
Back
Top