INCLUDING GRAPHICS 0.1. Including graphic files into a latex

advertisement
INCLUDING GRAPHICS
Contents
0.1.
Including graphic files into a latex document
1
0.2.
Creating beamer slides to be inserted into a latex document
2
0.3.
Colors
3
0.1. Including graphic files into a latex document. Graphic files contain “pictures”
which are called “figures in latex. This is done in the form
\begin{figure}[h!]
\begin{center}
\includegraphics[width=5cm]{1.pdf}
\caption{Text.}
\end{center}
\end{figure}
0.1.1. The figure environment: placement of pictures. The first and the last line open and
close the figure environment. Notice the format of the first line:
\begin{figure}[“placement specifier”]
Here, “placement specifier” says what strategy should be used in placing the picture on
the page. We will use the placement specifier “h!”.
A placement specifier is a sequence of “Float Placing Permissions” :
• “h” means here, at the very place in the text where the figure environment
occurs in the Latex file. (This is most useful for small figures.)
• ‘t” and “b” mean the top of the page and the bottom of the page.
• “p” means on a special page that contains only figures.
• “!” overrides some standard mechanisms of latex which would influence the placement.
Date: ?
1
2
0.1.2. When pictures run away. When pictures run away to the top of the page this
usually means that that the placement specifier has been omitted. However, even if
you did everything right, sometimes latex still manages to override your positioning of
pictures. For such occasions one should add a package “here” by adding a line in the
preamble:
\usepackage{here}
Then the positioning instruction “h!” in \begin{figure}{h!} is replaced by “H”, i.e., one
uses the line
\begin{figure}{H}
0.1.3. Centering. The commands \begin{center} and \end{center} have the effect of placing the figure in the center of the page (instead of placing it at the left margin).
0.1.4. Including graphic files. This is done by the command
\includegraphics[Parameter=length]{FileName}
Here word “length” should be replaced by a specific choice of a length say “5cm” or
“4.2in”.
The word “Parameter” should be replaced by one of the following commands
• width which means that the picture in the graphic file will be rescaled so that
its length is as specified by the value of “length”.
• height means rescaling so that the height is equal to the value of “length”.
Finally “FileName” is the name of the graphic file that should be included.
More precisely, if this file is in the same folder as your Latex document you really just
need the name of the file, say “Susan.jpg”. If the file is in some other folder or maybe
somewhere on internet you need the complete address of the file.
0.1.5. Caption. In the command
\caption{Text}
one should replace the word “Text” by the text of the caption that appears at the bottom
of the picture and describes its role.
0.1.6. More. You can also put a label inside the figure environment by
\label{CN}
where “CN” means the code name for the picture that you will later use to refer to this
picture by the command \ref{CN} .
0.2. Creating beamer slides to be inserted into a latex document. The homewrk
actually requires typing three latex documets. The main document is in the “article”
documentclass. However, you will also have to create two more documents in the “beamer”
documentclass in order to produce the two slides (pictures 3 and 4 in the homework).
3
Each of the slides consist of two boxes called “Example” and “Solution”. These boxes are
created by two environments as you may remember from a previous homework. (1)
0.2.1. Predefined environments: “example”. Beamer already has some predefined environments with their particular color schemes.
The environment “example” is predefined in beamer.
Remark. If you want a longer title in the dark green field, say not just “Example”, but
instead you want “Example. Twin asteroids” (something like that does appear in the
homework); then
\begin{example}
should be replaced by
\begin{example}[Twin asteroids]
0.2.2. Environments you define. You may also need extra environments that you will have
to define yourselves.
For instance, there is no environment for solutions. If you try to define a new environment
with the code name “solution” you will actually run into a trouble. There is no new
environment “solution”, however there is a predefined command “\solution”. The way
you avoid the clash is to use some other code name, say “sol”.
0.3. Colors.
0.3.1. Colors for the environments created by \newtheorem command. The newtheorems
that you create will be in the “default color”. The “default color” for beamer is set in the
beamer document class command, say:
\documentclass[blue]{beamer}
If it is not set explicitly here then default color is blue.
0.3.2. Predefined environments: “example”. The environment “example” is predefined in
beamer so that it comes in the dark green color that you can see on the slides. So for
examples you should use this predefined environment “example”.
0.3.3. Environments you define. The enviroments that are not predefined come in the
default color, i.e., in blue. This is again as in the slides.
0.3.4. Colors in the text. These we have used before. There are commands in the preamble
that produce four colors you will need. For instance “\red{YES}” produces word “YES”
in red.
1Also,
as you may remember, what is needed for the boxes to be created by the environment is that
you out-comment the “beamershadow” package in the preamble.
Download