Take the 2-minute tour ×
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.

Currently, when I reference things using labels I have setup LyX simply inserts the table number. I would like it to insert Table N where N is the table number. Similarly, I would like it to insert Figure N for figures. Is this possible or is there no way for LyX to know that my label refers to a figure or table?

share|improve this question

2 Answers 2

up vote 3 down vote accepted

Load the cleveref package and use \cref (or \Cref at the beginning of a sentence) instead of \ref.

share|improve this answer

The LyX way to do this would be to set "Format" (defaults to <reference>) to Formatted reference in the Cross-reference dialog. This uses either the package prettyref (English only) or refstyle depending on your settings in Document > Settings.

See "6.1 Cross-References" in the User Guide for more details.

The nice thing with that is that no ERT is required and the necessary package is loaded automatically.

However, Gonzalo's answer of using the cleveref package seems better because it doesn't rely on the name of the reference to determine whether it is a table or a figure where I think prettyref and refstyle do (they want reference names to be prefixed with "fig" or "tab").

share|improve this answer

Your Answer

 
discard

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.