GeneralRedefine figure label while using babel

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
zaradek
Posts: 22
Joined: Fri Jun 27, 2008 9:49 pm

Redefine figure label while using babel

Post by zaradek »

How is it possible to redefine the label used in figure captions if babel package is loaded. Because in the code below the third line doesn't have effect until you omit the second line.

Thanks, Máté

Code: Select all

\documentclass{article}
\usepackage[english]{babel}
\renewcommand{\figurename}{Fig.}

\begin{document}

\begin{figure}
\caption{Title.}
\end{figure}

\end{document} 

Recommended reading 2024:

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

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

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Redefine figure label while using babel

Post by localghost »

The best way is to use the caption package. It lets you customize captions in many ways. But it's also possible with babel. An example will show that.

Code: Select all

\documentclass[11pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage[english]{babel}
\usepackage[font=small,labelfont=bf]{caption}
\usepackage{bindingoffset=1cm,centering,includeheadfoot,margin=2cm]{geometry}
\usepackage{txfonts}
\usepackage{blindtext}

% Renaming floats with caption
\captionsetup{%
  figurename=Fig.,
  tablename=Tab.
}

% Renaming floats with babel
%\addto{\captionsenglish}{%
%  \renewcommand{\figurename}{Fig.}
%  \renewcommand{\tablename}{Tab.}
%}

\begin{document}
  \blindtext

  \begin{figure}[!ht]
    \centering
    \rule{8cm}{4.5cm}
    \caption{A dummy figure}\label{fig:dummy}
  \end{figure}

  \blindtext
\end{document}
Take look at the documentation of the babel package if you don't (want to) use the caption package.


Best regards
Thorsten¹
zaradek
Posts: 22
Joined: Fri Jun 27, 2008 9:49 pm

Re: Redefine figure label while using babel

Post by zaradek »

Thanks.
I like the caption package. It makes the labels even bold witch is good.

Máté
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Redefine figure label while using babel

Post by localghost »

zaradek wrote:[…] I like the caption package. It makes the labels even bold witch is good. […]
But that's not the default setting. Take a look at its options when included in the preamble. These options could be moved into the list of \captionsetup.
Post Reply