# Referencing a table vs. a figure in LyX, format

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?

-

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

-

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").

-