in this lesson we will learn how to put
images in a latex document to put images
we have to use a package called graphics
so first we put a command use package
graphics with an X so first let me show
you my file structure so these are my
images and my program is this one
inserting images in a latex document and
this is the folder path so in C I have a
folder latex in which my text file is
residing and there is a folder my images
and in this folder I have all these
images so this is a simple path I
designed for this lecture so there are
different ways to include an image so if
you want to have your images in the same
folder in which your program resides
then you don't have to give any paths in
your latex document but since I have a
folder inside so I have to include a
path so that all my images are well
organized and separate folder so I will
include a command called graphics path
and I have to put a pair of curly
brackets and inside this curly bracket
another pair of curly bracket and since
my folder is in one step down so I will
put this dot is for current directory
and then inside the current directory I
have a folder my images and then I have
to put another backslash don't forget to
put this you can also put an absolute
path if you want and I'll show you after
this
so now inside the document where I want
to put an image so this is just a dummy
text for example I want to put my image
here so in order to put an image I
should start an environment which is
called figure environment so begin
figure and let's end it first and within
that environment I have to use a command
include graphics and then I can put some
options I can put width height scale
angle
so these are some of the most used
options and in this deadly bracket I
have to put the name of the file so
these are my files so image - one image
- two three and four so these are the
names of the images so let me include
the first image so image - one so what
is here so first let me compile without
any scale or width or height so see how
it looks so my text is aligned and my
image is of this size which is covering
nearly all the text width and it is
going towards right and this image looks
a little bit bigger in size how can i
scale this I can put a scale of 0.9 and
if I recompile now see if it comes a
little bit towards center still it looks
big so let us put a scale of 0.5 we
reduce the size of the image and now the
image size has been reduced and let's
see if we can Center the image and now
the image has been centered and as you
can see that this text is going a little
bit beyond this square so in this case
you must consider that your image starts
somewhere in this area so if you even if
you Center it it looked at this the
whole image will be centered so keep in
mind that what you really want to Center
if you want to Center this square then
you have to keep your text within this
limit otherwise you will not get the
desired result even this 1200 is going a
little bit out then outer than square so
it you should when sometimes the image
doesn't look like center although it is
centered so first you should prepare
your image with an exact dimensions and
you should also know those dimensions
and in order to find the current
dimension of the image you just right
click and properties and these details
so these are the dimensions of the image
749 pixels into 563 hi
so with tonight so you should know these
dimensions
because sometime for example if I put
this second image so let's see the
dimension of this image so as you can
see this is a very wide image it has
1,100 pixels and it is roughly a square
image 1100 by 1076 so it's a square
image so if I put this so see what
happens if I put image too so let me
change this to image - and if I compile
now so see this image is going out
because it's very big image it is
centered image and it is 1/9 scale so
it's nearly a flee the full image so let
me reduce it to 0.3 of the scale means
30 percent of the size and then it will
appear more like as we want and now as
you can see that this image is looking
in the center and appearing much better
than before so you have you have to
prepare this image in exact dimension
which you want and then you will get the
expected results because sometimes you
don't get results because there is some
image the blank part of the image which
is going outside this visible area and
you think that it's not properly
centering so therefore you have to take
into consideration all these type of
things you can rotate this image by
putting an angle for example let's say
30 degree and all your image is rotated
this is making 30 degree with the
horizontal the left bottom is the center
point of rotation and it rotates to 30
degree on the towards counterclockwise
if you want the other direction you can
put either minus 30 degree or 330 degree
so this is minus 30 degree so in this
way you can rotate the image now if you
want to have an image of a particular
size so you can put width and height
width equals 6 centimeter height equals
5 centimeter
so now you are forcing lated to put
these dimensions and these dimensions
sometime if you look carefully this may
distort your image if it's not in a
proper proportion so width to height
ratio should be appropriate so that you
can get a good image so keep in mind
this width to height should be the same
so first prepare the image in proper
dimensions and then you will be able to
get the results as per expectations
putting images is very simple just begin
this environment even if you don't begin
this environment let's remove this and
try to compile you can still put the
images but within the environment now if
you look here your whole text is
centered and it looks a little bit odd
because we want only image to be
centered we want to play with the image
therefore it's good to have this begin
and end environment of the in figure and
if you want to give a absolute path so
look at my absolute path so the absolute
path of my file is C backslash latex
backlash my images so I can also put
this in path here so C colon backslash
latex and backslash my images this will
also work let me recompile and this path
also works fine so you can give the path
from the current directory with dot or
the absolute path of the image folder so
you can also put another path to this
graphics path for example let me create
another folder so this is my images if I
want to have my images in two folders so
I can create another folder and let me
name it my image is - - and now if I put
one of these image for example this
image for I just cut this and I put in
this folder let's say like this
and now I want to add this second folder
into my path and now I can include this
folder from the current directory my
image is - - and then put another
backslash at the end and now there is
only one file in this folder which is
four so let me recompile and hopefully I
will be able to extract that image and
now as you can see this is image four so
this is from the other folder from this
folder we have four so in this way you
can add multiple paths into this
graphics path command if you want to put
images in a separate page so you give
option to this begin figure environment
if you put key he means the top of the
page the other options you have I can
put here B means the bottom of the page
and P means on a separate page it's
already on the top of the page so let's
be put on a separate page P let me
compile as you can see that after all
the text my image is on a separate page
so if you want all your images on a
separate page you can put it here and
the other advantage of B figure
environment is that you can also give
some captions and some labeling if you
want to refer this image somewhere as
you can put a label here and you can
also put a caption here if you want the
put caption at the end so just before
and figure you can put your caption a
second image for example this is my
title of the image so now if I compile
as you can see that this is the caption
of the image if you want the size of the
image to be equal to the text width
which you are not sure how much is so
you can put width equals x - it
backslash text width
so now this is the full text width image
so you can put point five backslash text
width and the figure will be half of
your text width so if you want to scale
figure like this you can do that so this
is half of your text width so for
example if you have two figures so you
can put half of your text width and then
the other figure has besides this the
half of the text width so let me copy
this and paste here and I put the image
number one here so the best thing is put
the width a little bit less than 0.5
when for is better because otherwise it
will be at the very edge so we want a
little bit of margin on both sides and
then instead of include graphics we have
to use another command back slash soft
load and then you can put this command
inside your sub float and similarly the
second one the float and you have to
include a package use package sub fake
so pick and this will give access to
this command so float no if I recompile
I don't have this pack in at the moment
this is a new installation so no as you
can see that the latex is asking me to
install the package and I simply install
it
and now as you can see that both of our
figures are side by side so this is how
you put two images beside each other so
in this way you can insert images