<< | Page list | >>
Frequently Asked Questions about Figures and Graphics
§ What is the difference between a "figure" and a "figure float"?
This is an example of less-than-ideal terminology. "Figure" is what I would really call a "graphic"; it basically means insert a picture file. "Figure float" is more what one means by a figure in a paper: it includes the graphic, the caption, the figure label, etc. You should almost always insert a figure float first, then put a figure inside that.
Tables work in the same manner. Put a table float in first, then insert the table within that.
§ How do I get LyX to put the figure exactly where I want it?
Select Document→Settings.... In the Float Placement section, unset "Use Default Placement" and select "Top of Page", "Page of Floats", "Here, if possible" and "Ignore LaTeX rules". This tells LaTeX to try really hard to put the figure here first, then the top of a page, then on a page by itself. This is a global setting: all figure will then obey this rule set. If you want to control how each figure behaves, right-click in the figure float and you will get a dialog allowing to control the figure behavior.
If you really insist, you can also simply select "Here definitely". This will insert the figure by all means at the current place. Note, though, that chances are high that this leads to ugly unbalanced pages. Usually, LaTeX does a rather good job in float placement if you do not restrict it too much.
§ How can I restrict float placement to within a region?
Use the placeins package. Documentation can be found here.
§ How can I put two figures side by side?
I would like to put two floating figures side by side in Lyx as Fig 1 and Fig 2
FIG 1 : ..... FIG 2 : ...................
§ But I want the figures to be labeled 1a and 1b!
I would like to put two floating figures side by side in Lyx, but not as described in the previous question, but rather like this:
FIG 1a : ..... FIG 1b : ...................
OK, you want subfigures. Do this:
§ How can I create a floating figure with a centered image?
Also see the question below about centering the image.
The default behaviour used to be that paragraph was centered, but this was changed since it didn't match LaTeX's behaviour. If you don't like this, consider making a keyboard shortcut that centers the current paragraph, or perhaps to do all of the items above. For more details on keyboard shortcuts, see CommandSequences.
§ How can I center an image in a float?
Put the cursor in the paragraph with the image and open the dialog with Paragraph_Settings (Edit→Paragraph Settings...) and set the alignment of the paragraph to centered.
§ How do I center an image that's too big horizontally?
Inserting an image that's a little to big horizontally causes the centering mechanism to break down. The left edge gets aligned, and the right edge sticks out even more.
To fix this, do as follows:
An alternative to this which works for tables, images, and even verbatim textboxes is to:
§ How can I put text over/on top of an image?
§ How can I adjust the numbering of figures?
See this FAQ section.
§ How can I adjust the captions of figure floats?
Example preamble command for converting eg. "Figure n:" -> "Fig. n:"
For more complicated things use caption package. Example conversion from "Figure n:" into "Figure (n)"
§ How do I convert a .ps-file to .eps?
Perhaps the best option is to use ps2eps (it is better than ps2epsi which comes with ghostscript).
§ How to make a Gantt chart with LyX?
If you want to create a Gantt chart in Lyx you need LaTeX-package pst-gantt (http://mirror.its.uidaho.edu/pub/tex-archive/graphics/pstricks/contrib/pst-gantt/(approve sites)) in your preamble document. As well pst-gantt loads by default the following packages: pst-node, pst-grad, xkeyval and pstricks, so all them should be already part of your local TEX installation. As pst-gantt loads pstricks package you can only export/view your document to PostScript, DVI or PDF(ps2pdf).
For example adding this TeX Code in your document you can to make a simple Gantt chart:
For additional information and examples click here http://mirror.its.uidaho.edu/pub/tex-archive/graphics/pstricks/contrib/pst-gantt/pst-gantt-doc.pdf(approve sites)
§ How do I use figures defined with MetaPost in LyX?
Obviously you can produce EPS with mpost (figure files get the figure number as the extension, rename them to .mps) or you can produce PDF figures from MetaPost with mptopdf, or use the MetaPost converter for LyX which allows you to include .mp files directly.
§ How can I preserve figure locations on different computers?
You should use relative, not absolute paths. From Wikipedia: " a relative path starts from some given working directory, avoiding the need to provide the full absolute path.".
You can achieve this in two ways.
§Put everything in one folder
Example directory structure:
§Manually edit path in Lyx
If you want to have your figures in a different folder then the lyx files. You can follow this procedure:
Example directoy structure:
In the insert graphics dialogue of file lyxfilename.lyx you would enter the following path:
§ How can I redefine the command \listoffigures
To do this, you want to know the current definition of \listoffigures, because you probably don't know how to re-implement it. Getting this is trivial:
Start latex with no parameters (i.e. type
This is TeX, Version 3.14159 ([[Web2C]] 7.3.7) **
If this works flawlessly, change the definition by putting your
If you know some latex you'll see a good spot. If not - experiment.
Too early and you get the "page before" problem, too late and
you'll get the "last page" problem.
Look for a place in the macro after the new page/chapter has started,
before the actual listing begins. Somewhere around the heading perhaps.
Make sure to put your