1

I'm trying to insert an image for ShareLaTeX, and I don't know a whole lot about the program. I saved an image to my desktop and this is the following code:

\documentclass{article}
\oddsidemargin -.25in       % Lt Margin adj for odd pages (0 = 1`` margin    )
\evensidemargin -.25in      % Rt Margin adjustment for even pages
\topmargin -.5in            % adj top margin from 1''
\footskip .5in
\textwidth 7in              % width of printed area
\textheight 8.5in             % height of printed area

\usepackage{amsmath,amsthm}
\usepackage{fancyhdr}

\pagestyle{fancy}

...

\usepackage{url}
\usepackage{graphicx}

\begin{document}

...

\includegraphics{bgraph.jpg}

and nothing comes up, I don't see anything about draft in my \documentclass so i don't know what to do.

  • 3
    JPG can only be compiled with pdflatex or xelatex and latex cannot. – kiss my armpit Sep 13 '13 at 2:46
  • 2
    If you're compiling the document online using sharelatex's interface, then you need to make sure that the image is in the same file directory as the .tex file. You can accomplish this by uploading the file to sharelatex. Do this by clicking + New on the left side of your browser when you have your project open on sharelatex. – Adam Liter Sep 13 '13 at 2:46
  • Do I just use the file name it is saved as on my desktop? – seth jameson Sep 13 '13 at 2:59
  • No problem. It's all working now? – Adam Liter Sep 13 '13 at 4:30
  • 1
    @Adam Thanks (voted) was just doing a sweep over the unanswered list:-) – David Carlisle Oct 5 '13 at 13:04
4

The easiest way to \includegraphics is to make sure that the image you want to include is in the same working directory as your .tex file.

Now, sharelatex gives you the ability to upload extra files to the working directory of the project that you're currently working on. This is useful if, for example, you need to add pictures to your document or you want to use a bibliography file that is saved on your computer, among other things.

In order to upload a file or image to the same directory as the .tex file, you need to use the + New function that is visible on the left side of browser window when your current project is open on sharelatex.


Since compilers were also mentioned in the comments here, it might also be worth pointing out that you can change the compiler to either pdflatex, latex, or xelatex. (As of this posting, pdflatex, latex, and xelatex are the only compilers supported by sharleatex.) This can be changed in the Settings, which is also available from the left side of the window when you have your project open.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.