[texhax] How to create legend in Latex

Steve Schwartz s.schwartz at imperial.ac.uk
Mon Nov 1 18:45:14 CET 2010

Dear Mostafa,

On Mon, 2010-11-01 at 15:22 +0000, Mostafa ali wrote:
> So I am wondering, if there is any way to create legends in latex

Have a look at the overpic package, and use pict2e for more control over
drawing lines and things.


See appended tested document. Alternatively, just put the legend-drawing
bits in a picture environment and, for example, put the figure in one
row of a tabular environment and the picture in the next row. I'd prefer
overpic because you can place the legend anywhere, including inside your







  \put(0, -5){\color{red}{\line(1,0){20}}\quad apples}
  \put(0, -10){\color{blue}{\line(1,0){20}}\quad pears}
% this is a kludge because I've put the text outside the figure
% The result from overpic will always occupy the space of the
% graphic only, not the picture elements.
\caption{How does this look?}



Professor Steven J Schwartz        Phone: +44-(0)20-7594-7660
Head, Space & Atmospheric Physics  Fax:   +44-(0)20-7594-7772
The Blackett Laboratory            E-mail: s.schwartz at imperial.ac.uk
Imperial College London            Office: Huxley 6M67A 
London SW7 2AZ, U.K.               Web: www.sp.ph.ic.ac.uk/~sjs

More information about the texhax mailing list