Home > graphics > Inserting an Image in Latex - Basics

Inserting an Image in Latex - Basics

April 15Hits:1
Advertisement

It is my very very first time using LaTeX and I only need this program for preparing a homework which must include some graphics. For that I've been reading what to do for inserting an image but still not being able to add one, I seek for any kind of help. Would be very nice if you can explain this problem below and give me an advice.

! LaTeX Error: Can be used only in preamble.See the LaTeX manual or LaTeX Companion for explanation.Type H <return> for immediate help.... \usepackage 

What I typed is this:

\documentclass[10pt]{article} \begin{document}  \usepackage{graphics}  \includegraphics[scale=1]{ad.png}  \end{document}  

Thank you in advance.

Answers

Loading packages with \usepackage{...} has to be done in the preamble, in other words before issuing \begin{document}.

So your code should be

\documentclass[10pt]{article}
\usepackage{graphics}

\begin{document}
\includegraphics[scale=1]{ad.png}
\end{document}

Also, see Packages: graphics vs graphicx as to why you should use the graphicx (x for eXtended) package rather than the graphics package.

Tags:graphics

Related Articles

  • Inserting an Image in Latex - BasicsApril 15

    It is my very very first time using LaTeX and I only need this program for preparing a homework which must include some graphics. For that I've been reading what to do for inserting an image but still not being able to add one, I seek for any kind of

  • Inserting document compiled from LaTex code inside a .tex fileSeptember 24

    Is there a way to insert a document within a document? The inserted code is fully .tex compliant and could be compiled as a document on its own. I envision an article document, where inside the document, I show multiple beamer documents. The purpose

  • Ways of inserting a + sign in latex (package menukeys)

    Ways of inserting a + sign in latex (package menukeys)November 30

    I have a problem with a + sign. I use package "menukeys" and if i write down a command \keys{Eclipse C++ Development tool} the package keys will split my command analogous to three key commands: \keys{Eclipse C} \keys{} \keys{Development tool} I

  • How Do I insert a image in LaTex from my computer

    How Do I insert a image in LaTex from my computerAugust 9

    How do I create a file in windows from where LaTex can extract the pdf or Jpg file I want to insert in my document? In other words I need an example of inserting either images or pdf files in my document Here's the image I want to insert The Image wi

  • How to insert an image into LaTeX document?May 26

    I have already included graphicx package and include \ifCLASSINFOpdf \usepackage[pdftex]{graphicx} % declare the path(s) where your graphic files are \graphicspath{{../pdf/}{D:\ImagesforProjectLatex}} % and their extensions so you won't have to speci

  • Problem inserting a figure in LaTeXJanuary 5

    I am writing a research paper using LaTeX. I have certain images to insert. Now when we observe the images from the research paper, they have the following format: image its caption I am trying to replicate this using the following code \begin{figure

  • Insert PDF file in LaTeX April 17

    I compiled the following file (through MiKTeX which I have just updated all files), and I do not get the junk.pdf file inserted. \documentclass{report} \usepackage{pdfpages} \begin{document} qwe \includepdf[pages=-]{./junk.pdf} \end{document} The .lo

  • insert MAPLE algorithm to LaTeX

    insert MAPLE algorithm to LaTeXAugust 21

    I am writing my dissertation through LaTeX, and I want to insert the code from MAPLE, it is about 2 pages and I am not sure how to include the algorithm, do you have any idea how am I going to do it? --------------Solutions------------- Maple (I assu

  • Insert PDF file in LaTeX document

    Insert PDF file in LaTeX documentMarch 27

    I have a problem when I insert a PDF file in LaTeX: \usepackage[final]{pdfpages} \includepdf[pages=-]{file.pdf} The problem is that the PDF page is not centered: I've tried to place tags center, but nothing works. Thank you for your response. I still

  • Insert multiple figures in Latex

    Insert multiple figures in LatexJune 18

    I need to insert 10 figures (in two columns- side by side) in LaTeX that will have one global caption, but also I need to name each figure (1a, 1b, 1c, ... ect.). So they will look like: 1a 1b 1c 1d 1e 1f 1g 1h 1i 1j Figure 1: plots of.... I would re

  • How do I evaluate Mathematica expressions and insert them in a LaTeX file?

    How do I evaluate Mathematica expressions and insert them in a LaTeX file?December 2

    I want to make use of Mathematica as the backend to solve some computations used in my LaTeX input file. As I have no knowledge to make it in Mathematica, I used Maxima as explained in the following steps that I got somewhere on the internet. Step 1

  • Insert an image in LaTeX and create a pdf using: pdflatex file.texDecember 11

    An image is (attempted to be) inserted using the following script in file.tex: \begin{figure} \includegraphics{/rdata/report/images/buckets.data.csv.png} \end{figure} Running the following code, pdflatex file.tex I receive this error ! LaTeX Error: U

  • what is the best package/way to insert Mathematica code in latex docs?June 21

    I know that this question is not about strictly mathematica issue, but I think that in this site should be many pepople that use latex to distribute mathematica source code/examples. If the moderators think that I should delete this question, please

  • How to insert an image into Latex IEEE document by using miktex?

    How to insert an image into Latex IEEE document by using miktex?July 2

    I wish to include my 1.png image into the LaTeX document, however I get the error when using the command as below: \begin{figure} \centering \includegraphics{1.png} \caption{Figure 1: A picture of the same gull looking the other way! } \label{fig:ver

  • Mathjax can't render some of LaTeX basic commands

    Mathjax can't render some of LaTeX basic commands July 10

    Sorry this is probably a very silly question as I'm too new to LaTeX. Mathjax has issues rendering basic LaTeX commands like /xspace and /ensuremath There are some custom macros in my LaTeX files, and I define them in MathJax config as; MathJax.Hub.C

  • Insert a image to Latex preamble in LYXDecember 10

    I am writing a survey report and I need used a template as a cover page from here. It is working fine and now I need to add my university logo into that cover page. Cover page has been included in to Latex Preamble. Is inserting image to Latex preamb

  • problem to insert inkscape pdf into latex

    problem to insert inkscape pdf into latexJuly 10

    I'm trying to insert the 1.pdf_tex which was generated by Inkscape into my article and I always get this error message: ! Package keyval Error: page undefined. See the keyval package documentation for explanation. Type H for immediate help. ... ! LaT

  • Insert .tif figures in latex August 4

    There several types of graphics files. In no particular order .jpeg .eps .pdf .png .tif .jif (and no doubt others). Some work with latex, dvips and some work with pdflatex. How am I supposed to know which? Just to confuse matters, metapost produces .

  • How do I insert pictures into my LaTeX document? December 23

    Related: Convert gif image to png on the fly I have an image file -- a gif file, which is the graph of a function. How do I add it to a LaTeX file? Will it come out OK in the subsequent pdf file? --------------Solutions------------- Use movie15 packa

  • PNG and JPG quality loss inserting webpage screenshot into LaTeX document

    PNG and JPG quality loss inserting webpage screenshot into LaTeX documentJuly 28

    I have tried using both a png and jpg file format for my images but I still loose a significant amount of quality when I run pdflatex. Is there some way to work around this? \documentclass[12pt, a4paper, twoside]{article} \usepackage[margin=1in,bindi

Copyright (C) 2018 ceus-now.com, All Rights Reserved. webmaster#ceus-now.com 14 q. 0.563 s.