LaTeX Putting Excel graph into LaTeX

Let me preface this by saying I am reasonably intelligent overall, but I'm a complete idiot when it comes to computers and technology. I've been trying for hours to put a graph onto LaTeX for a physics labs, but I'm getting nowhere and very frustrated. I've tried to follow guides online, but none has worked for me. I've copied the graph into Paint, the tried saving it variously as a PDF, PNG AND JPEG and gotten the same result with each -- just a plain white box with some text on the left side of the box stating the name I gave the file, such as graph.png.

Here are the lines of input I have

\begin{figure}[h]
\centering
\includegraphics[width=5in]{chart.jpg}
\caption{This figure shows the velocity vs time graph for the given data.}
\end{figure}

I can't tell what I'm doing wrong. I feel very stupid and very frustrated.

I've also tried putting both the graph and the .tex in the same folder, but that hasn't borne any fruit. Help would be very greatly appreciated.
 
263
70
Did you include graphicx package in your preamble? That is, you need put a line \usepackage{graphicx} before \begin{document}
You also need to compile by using pdflatex.
 
Did you include graphicx package in your preamble? That is, you need put a line \usepackage{graphicx} before \begin{document}
You also need to compile by using pdflatex.
Yes, I do have \usepackage{graphicx} before \begin{document}. We're using sharelatex and as far as I can tell I went right off of my professor's template, yet I can't get it right. I could post all the input I have (not that much), but I'm not sure if I'm allowed to do that here.
 
1,726
41
Try to convert you graphics file to EPS format. It works for me.

Eugene.
 

robphy

Science Advisor
Homework Helper
Insights Author
Gold Member
5,394
666
This works on sharelatex.


\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}

\title{test1}
\author{robphy}
\date{February 2018}

\begin{document}

\maketitle

\section{Introduction}

\begin{figure}[h]
\centering
\includegraphics[width=5in]{chart.jpg}
\caption{This figure shows the velocity vs time graph for the given data.}
\end{figure}

\end{document}


I uploaded a chart.jpg file (a screen capture of part of the browser window).
upload_2018-2-10_22-42-57.png


Here is the output.
upload_2018-2-10_22-43-13.png
 

Attachments

This works on sharelatex.


\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}

\title{test1}
\author{robphy}
\date{February 2018}

\begin{document}

\maketitle

\section{Introduction}

\begin{figure}[h]
\centering
\includegraphics[width=5in]{chart.jpg}
\caption{This figure shows the velocity vs time graph for the given data.}
\end{figure}

\end{document}


I uploaded a chart.jpg file (a screen capture of part of the browser window).
View attachment 220135

Here is the output.
View attachment 220136
As far as I can tell, I have the same as you, but I'm not getting the same result. I've uploaded a picture of most of my input and a picture of what should be my graph.
 

Attachments

robphy

Science Advisor
Homework Helper
Insights Author
Gold Member
5,394
666
Is chart.jpg uploaded and located alongside main.tex, as shown the screen capture of my code?

Is chart.jpg actually a working jpg file?
Can you upload it here?
 
OK I solved the problem. I didn't realize I had to upload the file there. So I have that problem fixed. Now my problem is that it's putting the graph the wrong order. I wanted it to be before the conclusion, but for some reason it started the conclusion first and then place the graph the next page. Hopefully I can figure this one out on my own.
Edit: I figured that out too. Thanks for your help.
 
Last edited:

Related Threads for: Putting Excel graph into LaTeX

Replies
11
Views
8K
  • Last Post
Replies
2
Views
3K
  • Last Post
Replies
4
Views
13K
  • Last Post
Replies
5
Views
22K
  • Last Post
Replies
3
Views
4K
Replies
4
Views
51K
  • Last Post
Replies
6
Views
581
  • Last Post
Replies
3
Views
2K
Top