1
<?xml version="1.0" encoding="UTF-8"?>
2
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
3
"DTD/xhtml1-transitional.dtd">
4
<html xmlns="http://www.w3.org/1999/xhtml">
5
<!-- XML file produced from file: manual.tex
6
using Hyperlatex v 2.6 (c) Otfried Cheong
7
on Emacs 22.2.1, Wed Dec 9 15:44:23 2009 -->
9
<title>Ipe Manual -- 11 Using Ipe figures in Latex</title>
11
<style type="text/css">
12
.maketitle { text-align : center }
13
div.abstract { margin-left: 20%; margin-right: 10%; }
14
h3.abstract { text-align : center }
15
div.verse, div.quote, div.quotation {
21
<link rel="stylesheet"
22
href="manual.css" type="text/css"><meta http-equiv="Content-Type"
23
content="text/html; charset=UTF-8">
25
<body bgcolor="#ffffe6">
26
<table width="100%" cellpadding=0 cellspacing=2><tr>
27
<td bgcolor="#99ccff"><a href="manual_48.html"><img border="0" alt="12 Command line options and environment variables" src="next.png"></a></td><td bgcolor="#99ccff"><a href="manual.html"><img border="0" alt="Top" src="up.png"></a></td><td bgcolor="#99ccff"><a href="manual_ipe6_to_ipe7.html"><img border="0" alt="10 If you have used Ipe 6 before" src="previous.png"></a></td><td align="center" bgcolor="#99ccff" width="100%"><b>11 Using Ipe figures in Latex</b></td></tr></table>
28
<h1>11 Using Ipe figures in Latex</h1>
30
<p>Most Latex installations support the inclusion of figures in
31
Encapsulated Postscript (EPS) format (the "Encapsulated" means that
32
there is only a single Postscript page and that it contains a bounding
34
<p>The standard way of including EPS figures is using the <code>graphicx</code>
35
package. If you are not familiar with it, here is a quick overview.
36
In the preamble of your document, add the declaration:
40
One useful attribute to this declaration is <code>draft</code>, which stops
41
LaTeX from actually including the figures--instead, a rectangle
42
with the figure filename is shown:
44
\usepackage[draft]{graphicx}
46
<p>To include the figure "figure1.eps", you use the command:
48
\includegraphics{figs/figure1}
50
Note that it is common <em>not</em> to specify the file extension
51
".eps". The command <code>\includegraphics</code> has various options to
52
scale and rotate the figure. For instance, to scale the same figure
55
\includegraphics[scale=0.5]{figs/figure1}
57
To scale such that the width of the figure becomes 5 cm:
59
\includegraphics[width=5cm]{figs/figure1}
61
Instead, one can specify the required height with <code>height</code>.
62
<p>Here is an example that scales a figure to 200% and rotates it by
63
45 degrees counter-clockwise. Note that the scale argument should be
64
given <em>before</em> the <code>angle</code> argument.
66
\includegraphics[scale=2,angle=45]{figs/figure1}
68
<p>Let's stress once again that these commands are the standard commands
69
for including EPS files in a LaTeX document. Ipe files neither
70
require nor support any special treatment. If you are used to other
71
commands for EPS inclusion, such as the old-fashioned <code>epsfig</code>
72
package,<sup><a href="manual_54.html#id4">4</a></sup> you can use them as well for Ipe figures. If
73
you want to know more about the LaTeX packages for including
74
graphics and producing colour, check the <code>grfguide.tex</code> document
75
that is probably somewhere in your TeX installation.
77
<p>If you are a user of Pdflatex (a version of Latex that produces PDF
78
instead of DVI output), you cannot include EPS files. Instead, save
79
your Ipe figures in PDF format, and include them in the way described
81
<p>There is a slight complication here: Each page of a PDF document can
82
carry several "bounding boxes", such as the <em>MediaBox</em> (which
83
indicates the paper size), the <em>CropBox</em> (which indicates how the
84
paper will by cut), or the <em>ArtBox</em> (which indicates the extent
85
of the actual contents of the page). Ipe automatically saves, for
86
each page, the paper size in the <em>MediaBox</em>, and a bounding box
87
for the drawing in the <em>ArtBox</em>. Ipe also puts the bounding box
88
in the <em>CropBox</em> unless this has been turned off by the stylesheet.
89
<p>Now, when including a PDF figure, Pdflatex will (by default) first
90
look at the CropBox, and, if that is not set, fall back on the
91
MediaBox. It does not inspect the ArtBox, and so it is important that
92
you use the correct stylesheet for the kind of figure you are
93
making--with cropping for figures to be included, without cropping
94
for presentations (as otherwise Acrobat Reader will not display full
95
pages--Acrobat Reader actually crops each page to the CropBox).
96
<p>If you have a recent version of Pdflatex (1.40 or higher), you can
97
actually ask Pdflatex to inspect the ArtBox by saying
98
<code>\pdfpagebox5</code> in your Latex file's preamble.
99
<p>You can save all your figures in both EPS and PDF format, so that you
100
can run both Latex and Pdflatex on your document--when including
101
figures, Latex will look for the EPS variant, while Pdflatex will look
102
for the PDF variant. (Here it comes in handy that you didn't specify
103
the file extension in the <code>\includegraphics</code> command.)
104
<p>It would be cumbersome to have to save an Ipe figure in both formats
105
each time you modify it. What you should do instead, is to always
106
save in one format--let's say EPS. You can then write a shell script
107
or batch file that calls <a href="manual_48.html">ipetoipe</a> to
108
do the conversion to PDF. Alternatively, you can enable
109
auto-exporting from EPS to PDF in Ipe.
111
<p>On the other hand, if you <em>only</em> use Pdflatex, you might opt to
112
exploit a feature of Pdflatex: You can keep all the figures for a
113
document in a single, multi-page Ipe document, with one figure per
114
page. You can then include the figures one by one into your document
115
by using the <code>page</code> argument of <code>\includegraphics</code>.
116
<p>For example, to include page 3 from the PDF file "figures.pdf"
117
containing several figures, you could use
119
\includegraphics[page=3]{figures}
122
<table width="100%" cellpadding=0 cellspacing=2><tr>
123
<td bgcolor="#99ccff"><a href="manual_48.html"><img border="0" alt="12 Command line options and environment variables" src="next.png"></a></td><td bgcolor="#99ccff"><a href="manual.html"><img border="0" alt="Top" src="up.png"></a></td><td bgcolor="#99ccff"><a href="manual_ipe6_to_ipe7.html"><img border="0" alt="10 If you have used Ipe 6 before" src="previous.png"></a></td><td align="center" bgcolor="#99ccff" width="100%"><b>11 Using Ipe figures in Latex</b></td></tr></table></body></html>