I have a diagram that I created with qtree, but would like to add a caption to it. How can this be done?

  • Welcome to TeX.sx! how about putting it in a figure and using \caption? – cmhughes Mar 8 '13 at 20:04
  • This seems to always give Figure 1. <my caption>, and places the diagram in the center of the next page, rather than inline with the text. Is there any alternative to this? – Rich Ashworth Mar 8 '13 at 20:05
  • Should the desired caption have a particular formatting? I mean do you want to number the diagram and have a label for it as in Diagram 1: tree showing....? – Gonzalo Medina Mar 8 '13 at 20:08
  • 1
    Please post a minimal working example (MWE) that shows what you want to achieve. – hpesoj626 Mar 8 '13 at 20:08
  • @GonzaloMedina - yes, exactly – Rich Ashworth Mar 8 '13 at 20:10

One option would be to use the newfloat package to define a new floating object, so then you can use the standard \caption command:




\Tree [.S This [.VP [.V is ] \qroof{a simple tree}.NP ] ]\par
\caption{the caption for this diagram}


enter image description here

The package offers some other customization possibilities and it cooperates with the caption package.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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