Generalreferencing and changing text in figures

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
dmt
Posts: 82
Joined: Sat Mar 15, 2008 8:13 pm

referencing and changing text in figures

Post by dmt »

Two hopefully simple questions. I am using the figure environment to show some illustrations. I want to know how to do two things.

1) I want to change the default text from "Figure" to something else (the pdf is in another language, so I don't want the English word there).

2) I added a label after my caption command but when I use ref to create a reference to that label I only get the number and not the full text "figure 1". How do I change this so it automatically uses the text in front of the numbering as well?

thanks!

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

balf
Posts: 158
Joined: Sat Jan 12, 2008 1:11 am

Re: referencing and changing text in figures

Post by balf »

1): use the caption package (+ babel).

2): the cleveref seems to do what you want.

B.A.
User avatar
Juanjo
Posts: 657
Joined: Sat Jan 27, 2007 12:46 am

referencing and changing text in figures

Post by Juanjo »

If you don't need additional features from the caption and cleveref packages, here you may find some alternatives:

1) If you do not use the babel package:

Code: Select all

\renewcommand{\figurename}{Your selected figure name}
If you do use it:

Code: Select all

\addto\captionslanguage{\renewcommand{\figurename}{Your selected figure name}}
where language should be replace by french, german, spanish or whatever you need and babel could offer (the macro is called \captionsfrench, \captionsgerman, etc.).

2) Define the macro \figref as follows

Code: Select all

\newcommand{\figref}[1]{\figurename~\ref{#1}}
and use it instead of \ref for referencing figures.
dmt
Posts: 82
Joined: Sat Mar 15, 2008 8:13 pm

Re: referencing and changing text in figures

Post by dmt »

oops, noticed bad timing on my post here, edited and will try these options. Thanks.
dmt
Posts: 82
Joined: Sat Mar 15, 2008 8:13 pm

Re: referencing and changing text in figures

Post by dmt »

Thanks again Juanjo, worked simply and perfectly!!!
Post Reply