Putting Excel graph into LaTeX

In summary, I am trying to put a graph onto LaTeX for a physics labs, but I'm getting nowhere and very frustrated.
  • #1
Blue Kangaroo
41
1
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.
 
Physics news on Phys.org
  • #2
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.
 
  • #3
eys_physics said:
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.
 
  • #4
Try to convert you graphics file to EPS format. It works for me.

Eugene.
 
  • #5
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

  • upload_2018-2-10_22-42-57.png
    upload_2018-2-10_22-42-57.png
    10.6 KB · Views: 1,007
  • upload_2018-2-10_22-43-13.png
    upload_2018-2-10_22-43-13.png
    14.9 KB · Views: 928
  • #6
robphy said:
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

  • snip2.PNG
    snip2.PNG
    41.7 KB · Views: 683
  • snip1.PNG
    snip1.PNG
    1.7 KB · Views: 678
  • #7
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?
 
  • #8
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:

1. How do I convert an Excel graph into a LaTeX document?

To convert an Excel graph into a LaTeX document, you can use a software tool like Excel2LaTeX or CopyFig. These tools allow you to save your Excel graph as a .tex file, which can then be inserted into your LaTeX document.

2. Can I customize the appearance of my Excel graph in LaTeX?

Yes, you can customize the appearance of your Excel graph in LaTeX by using the options provided by the software tool you are using, or by manually editing the .tex file. You can change the colors, fonts, and other visual elements to match your preferences or the requirements of your document.

3. How do I ensure that my Excel graph is properly aligned and scaled in my LaTeX document?

To ensure that your Excel graph is properly aligned and scaled in your LaTeX document, you can use the \centering command to center the graph and the \resizebox command to adjust its size. You can also use the \caption command to add a caption and label to your graph.

4. Can I update my Excel graph in my LaTeX document if I make changes to the original graph?

Yes, you can update your Excel graph in your LaTeX document if you make changes to the original graph. Simply save the updated graph as a .tex file and replace the old graph in your LaTeX document with the new one. This will ensure that your graph is always up-to-date.

5. How do I handle errors or formatting issues when inserting an Excel graph into LaTeX?

If you encounter errors or formatting issues when inserting an Excel graph into LaTeX, you can try troubleshooting the issue by checking for any missing packages, ensuring that the file paths are correct, and making sure that your graph is properly formatted. You can also consult online resources or seek help from forums or colleagues who have experience with incorporating Excel graphs into LaTeX.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
4K
  • Other Physics Topics
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
5K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
11
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
11
Views
26K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
41K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
9
Views
4K
  • Introductory Physics Homework Help
Replies
2
Views
1K
Back
Top