TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

It may be a bit difficult sometimes to deal with the legend of a figure in a LaTeX document. Depending on the context, you may have to place the legend over the existing curves because of a lack of space. You may also have to place it on the side making the centering of the main content difficult. Some people choose to put the legend in the caption thus discarding the above mentioned difficulties. Below is a solution with pstricks:


    \psline[linestyle=dashed,dash=1pt 2pt,linewidth=0.04,linecolor=blue](0,0.1)(0.6,0.1)

        \psplot[linewidth=1.5pt,algebraic=true,linecolor=blue,linestyle=dashed,dash=1pt 2pt]
    \caption{Vibrations of the structure; wheel~\usebox{\LegendeA} and


What are your strategies?

share|improve this question
Open-ended questions such as this with no definitive answer should be a community wiki … because otherwise they invite an ill-received practice called “rep-whoring”. I’ve converted the question for you. – Konrad Rudolph Sep 8 '10 at 18:00
what about the tikz users on that matter? – pluton Oct 22 '10 at 14:04
As this question has not received an upvoted answer in two months (even after having been converted to community wiki), I suggest to close it. – lockstep Nov 8 '10 at 21:57
Is not receiving any answers really a reason to close? I'm pretty sure it isn't... – Seamus Nov 8 '10 at 22:33
There, you prodded me into writing an answer ;-) – Yossi Farjoun Nov 8 '10 at 22:56
up vote 5 down vote accepted

At one point I had a situation like you describe. What I ended up doing is putting the legend so that it juts out a little and fiddled with the boundingbox of the resulting figure so that it remains the same as when the legend does not jut out.

I wrote a "script" that steals the BBox of one .eps file and plops it into another:

#take the bounding box of the first argument, and plop it into the second.

BB=`grep %%BoundingBox $1`
sed "s/%%BoundingBox.*/$BB/" $2 

This script simply outputs the resulting .eps file to stdout. if you want to direct it to a third file you'd use it like so:

% copyBB goodBB.eps niceLegend.eps > combined.eps

(It's a bash script, sorry windows users...but then, it isn't so complicated...so you could re-implement it for your shell.) Caveat Empor! I did not test this for many cases. My use-case was as follows: create two versions of the same figure, one with the correct bounding box, and one with the legend jutting out (upper right corner, in my case). Then, I use the script to steal the BB from the "clean" figure and place it onto the legended one. This allowed me to align figures more easily than otherwise (in my case I also wanted to signal that the same legend can be used for the four figures): alt text

(The lower left figure was created using copyBB, the remaining 3 were unmodified)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.