Login

Welcome, Guest. Please login or register.

April 18, 2024, 04:53:16 pm

Author Topic: Graphics in Latex  (Read 7124 times)  Share 

0 Members and 1 Guest are viewing this topic.

/0

  • Victorian
  • ATAR Notes Legend
  • *******
  • Posts: 4124
  • Respect: +45
Graphics in Latex
« on: April 18, 2010, 10:24:59 pm »
0
I've looked online and apparently to insert graphics in latex you need to use

Code: [Select]

\usepackage{graphicx}

\includegraphics{image.jpg}


Where "image.jpg" is the name of the file.

But how does it know where to look for the file? I've checked all the tutorials and they never mention where you actually have to put the file so Latex will recognise it, help plz !

Cthulhu

  • Guest
Re: Graphics in Latex
« Reply #1 on: April 18, 2010, 10:26:24 pm »
0
Have you tried just giving the path to the image? That's all I can think of really. Or perhaps the directory you will compile the latex into PDF?

TrueTears

  • TT
  • Honorary Moderator
  • Great Wonder of ATAR Notes
  • *******
  • Posts: 16363
  • Respect: +667
Re: Graphics in Latex
« Reply #2 on: April 18, 2010, 10:36:43 pm »
0
I've looked online and apparently to insert graphics in latex you need to use

Code: [Select]

\usepackage{graphicx}

\includegraphics{image.jpg}


Where "image.jpg" is the name of the file.

But how does it know where to look for the file? I've checked all the tutorials and they never mention where you actually have to put the file so Latex will recognise it, help plz !
put it in whereever u installed texnic editor

this tutorial might help

http://www.artofproblemsolving.com/Wiki/index.php/LaTeX:Math
PhD @ MIT (Economics).

Interested in asset pricing, econometrics, and social choice theory.

/0

  • Victorian
  • ATAR Notes Legend
  • *******
  • Posts: 4124
  • Respect: +45
Re: Graphics in Latex
« Reply #3 on: April 18, 2010, 10:38:31 pm »
0
Thanks Cthulthu, but that also gives the following error:

! Undefined control sequence.
<argument> C: \Desktop \Schrodinger\apparatus
l.12 ...\Desktop\Schrodinger\apparatus.jpg}
                                                 
?

Previously:
Code: [Select]
\includegraphics[width=5mm,height=5mm]{apparatus.jpg}
I got:

<apparatus.jpg, id=1, 646.66594pt x 396.7322pt> <use apparatus.jpg>
Runaway argument?
{
! Paragraph ended before \Gin@ii was complete.
<to be read again>
                   \par
l.37

TrueTears

  • TT
  • Honorary Moderator
  • Great Wonder of ATAR Notes
  • *******
  • Posts: 16363
  • Respect: +667
Re: Graphics in Latex
« Reply #4 on: April 18, 2010, 10:42:13 pm »
0
Thanks Cthulthu, but that also gives the following error:

! Undefined control sequence.
<argument> C: \Desktop \Schrodinger\apparatus
l.12 ...\Desktop\Schrodinger\apparatus.jpg}
                                                 
?

Previously:
Code: [Select]
\includegraphics[width=5mm,height=5mm]{apparatus.jpg}
I got:

<apparatus.jpg, id=1, 646.66594pt x 396.7322pt> <use apparatus.jpg>
Runaway argument?
{
! Paragraph ended before \Gin@ii was complete.
<to be read again>
                   \par
l.37
for ur code delete the width and stuff, just put name of file.
PhD @ MIT (Economics).

Interested in asset pricing, econometrics, and social choice theory.

/0

  • Victorian
  • ATAR Notes Legend
  • *******
  • Posts: 4124
  • Respect: +45
Re: Graphics in Latex
« Reply #5 on: April 18, 2010, 10:43:45 pm »
0
Thanks TT, but

It still gives the same result :/
except it also says too wide now (that's why I tried to make it smaller)

/0

  • Victorian
  • ATAR Notes Legend
  • *******
  • Posts: 4124
  • Respect: +45
Re: Graphics in Latex
« Reply #6 on: April 18, 2010, 11:03:32 pm »
0
Woops sorry peeps, I made an error elsewhere in the code, it works now  ;D

Cthulhu

  • Guest
Re: Graphics in Latex
« Reply #7 on: April 19, 2010, 11:01:33 pm »
0
Excellent. +1 for not using LyX

enwiabe

  • Putin
  • ATAR Notes Legend
  • *******
  • Posts: 4358
  • Respect: +529
Re: Graphics in Latex
« Reply #8 on: April 19, 2010, 11:44:48 pm »
0
why on earth wouldn't you use lyx

to insert graphics in lyx you click like 3 buttons

then you can crop it rotate it etc. as you please

i don't understand this obsession with reinventing the wheel >_>

Cthulhu

  • Guest
Re: Graphics in Latex
« Reply #9 on: April 19, 2010, 11:56:04 pm »
0
I just prefer writing proper . Makes me feel all manly.

/0

  • Victorian
  • ATAR Notes Legend
  • *******
  • Posts: 4124
  • Respect: +45
Re: Graphics in Latex
« Reply #10 on: April 19, 2010, 11:57:45 pm »
0
Oh lol, I never heard of Lyx before

But I'm sticking with Latex, I'm too familiar with it now xD

TrueTears

  • TT
  • Honorary Moderator
  • Great Wonder of ATAR Notes
  • *******
  • Posts: 16363
  • Respect: +667
Re: Graphics in Latex
« Reply #11 on: April 20, 2010, 12:05:37 am »
0
texnic ftw
PhD @ MIT (Economics).

Interested in asset pricing, econometrics, and social choice theory.

enwiabe

  • Putin
  • ATAR Notes Legend
  • *******
  • Posts: 4358
  • Respect: +529
Re: Graphics in Latex
« Reply #12 on: April 20, 2010, 12:07:47 am »
0
LyX *IS* proper latex

I don't get why people think it isn't. It just takes the menial, time consuming "coding" part out of it. Coding in latex isn't special. It's just commands. But you have to type out all those commands, why waste the time? You're not special for doing it. Anyone can waste the time.

Instead of typing out THOUSANDS of extra characters in code, you can just fire up LyX use button clicks and short cut commands :-/

Not to mention, you can spend hours wondering where you fucked up in your code. Where you forgot a $ sign, or didn't call an appropriate package etc. LyX will TELL you when you make an error, it will tell you why, and how. But most importantly, in nearly every case it won't LET you make the error, because it will tell you "don't do this or you'll fuck it up"... With texnic it's "compile and see", "compile and see" etc. every like 20 lines or so to make sure you didn't screw up. Tiiiiiiiiiime waaaaaaaaaaaste. So unnecessary.

You'd probably save hundreds of hours over the course of your degree... And thousands over your professional mathematical career. In conclusion, reinventing the wheel is just stupid...
« Last Edit: April 20, 2010, 12:13:32 am by enwiabe »

Cthulhu

  • Guest
Re: Graphics in Latex
« Reply #13 on: April 20, 2010, 12:29:11 am »
0
I just prefer writing source. I've never been a wysiwyg person. Everyone has their own preference though.

Mao

  • CH41RMN
  • Honorary Moderator
  • Great Wonder of ATAR Notes
  • *******
  • Posts: 9181
  • Respect: +390
  • School: Kambrya College
  • School Grad Year: 2008
Re: Graphics in Latex
« Reply #14 on: May 24, 2010, 04:07:16 am »
0
Resurrecting this, but for anyone who's interested, here's the template file I use. Built this myself over the years, kinda does everything a professional document needs to do.

Code: [Select]
\documentclass[a4paper]{article}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{fancyhdr}
\usepackage{multicol}
\usepackage{verbatim}
\usepackage{url}
\usepackage[top=2.5cm,bottom=2.5cm,left=2cm,right=2cm]{geometry}

\usepackage{listings}
\lstset{basicstyle=\footnotesize, language=Matlab, numbers=left, stepnumber=1, numbersep=5pt}

\pagestyle{fancy}
\fancyhead{}
\fancyfoot{}
\lhead{MTH3051 - Introduction to Computational Mathematics}
\chead{}
\rhead{Assignment 1}
\lfoot{Mao Yuan Liu - 21513856}
\cfoot{}
\rfoot{Page \thepage}

\title{MTH3051 Assignment 1}
\author{Mao Yuan Liu}

\begin{comment}
Sample Code for inserting graphics
\begin{figure}[h]
\centering
\caption{CAPTION}
\includegraphics[width=0.5\textwidth]{C:/Users/picture.png}
\end{figure}

Sample Code for multicol
\begin{multicols}{2}
\end{multicols}

Sample footnotes
\footnote{text}

Sample Code snippet
\begin{lstlisting}
CODE HERE
\end{lstlisting}
\end{comment}

\begin{document}

\maketitle


\end{document}
Editor for ATARNotes Chemistry study guides.

VCE 2008 | Monash BSc (Chem., Appl. Math.) 2009-2011 | UoM BScHon (Chem.) 2012 | UoM PhD (Chem.) 2013-2015