Pol wrote:
Paul A. Rubin wrote:

Pol wrote:
<posted & mailed>

Is there a way to include pictures, I mean simple geometric pictures,
into a lyx file?
Metapost or something like that could be used?
Would either tikz or xy-pic do what you have in mind?


I have never tried those format. Can they be included into a lyx file?
How to do?


TiKZ pictures are written using LaTeX macros, so you can either write the code in an ERT inset or put it in an external text file and include the file (as LaTeX). You will not see the picture in the LyX GUI, but it will show up in the compiled output. Here is a small example, entered as ERT in a beamer presentation:

\begin{tikzpicture}
\draw (0mm, 0mm) node {A};
\draw[->] (5mm, 0mm) -- (15mm,0mm);
\draw (20mm, 0mm) node {B};
\draw[->] (25mm, 0mm) -- (35mm, 0mm);
\draw (40mm, 0mm) node {C};
\draw[->] (45mm, 0mm) -- (55mm, 0mm);
\draw (60mm, 0mm) node {D};
\draw[->] (65mm, 0mm) -- (75mm, 0mm);
\draw (80mm, 0mm) node {E};
\end{tikzpicture}

This plots the density function of a triangular random variable. If you want to see the compiled output, you can download http://mgt.bus.msu.edu/~rubin/MSC871/MSSCM_Z_score_example.pdf. It's on slide 3. The TiKZ package contains some basic shapes, an assortment of lines and arrows, and has a mechanism that lets you create diagrams consisting of nodes and arcs as well as more general drawings.

The xypic package may not be ideal for drawing shapes (other than maybe polygons). You insert diagrams into a special type of matrix structure in a math inset. It seems to be designed for graphs and diagrams with arrows connecting pieces, but you can for example draw a cube with it. Think of each matrix entry as a node or vertex that can be connected via lines to other nodes/vertices. The redeeming feature of xypic would be that, provided you had math preview turned on, you would see what you were drawing in the GUI (following the usual delay for instant preview to catch up to your changes).

It is easy to embed a compiled image (PDF, JPG, PNG, EPS, ...) from a suitable drawing/graphing program. I take it that's not what you want?

/Paul

Reply via email to