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.

I am writing a paper in Italian and I need to include pseudo code in my latex document so I am currently using the algorithm and algorithmic packages. At the top of every algorithm the label Algorithm 1 is shown, but I'd like for it to be in Italian instead. I have previously included:

\usepackage[italian]{babel}
\usepackage[utf8]{inputenc} 

with no change whatsoever, is there any way to localize it?

\documentclass[a4paper,12pt]{article}
\usepackage{algorithm}
\usepackage{algorithmic}
\usepackage[italian]{babel}
\usepackage[utf8]{inputenc}
\title{ASD}
\author{haunted85}
\date{Ottobre 2012}
\begin{document}
\maketitle
\section{}
\begin{algorithm}
\caption{Questo è un algoritmo.}
\begin{algorithmic}[1]
\STATE int Count(int $N$)
\STATE $sum = 0$
\FOR{$i \leq N$}
\FOR{$j = i \leq N$}
\STATE $sum = sum + 1$
\ENDFOR
\ENDFOR
\RETURN $sum$
\end{algorithmic}
\end{algorithm}
\end{document}
share|improve this question
1  
Welcome to TeX.SX. It is always preferable to post complete minimal working examples rather than code snippets because this helps people to answer you. –  Claudio Fiandrino Oct 10 '12 at 8:57
1  
@ClaudioFiandrino thank you, editing the question right now! –  haunted85 Oct 10 '12 at 8:58

1 Answer 1

up vote 4 down vote accepted

Either use \floatname{algorithm}{Algoritmo} (see section 4.4 of the algorithms manual) or, if you want to be able to switch between Italian and English caption names, redefine \ALG@name using babel macros.

\documentclass{article}

\usepackage[english,italian]{babel}

\usepackage{algorithmic}
\usepackage{algorithm}

% Alternative A
% \floatname{algorithm}{Algoritmo}

% Alternative B
\makeatletter
\addto\captionsitalian{\renewcommand{\ALG@name}{Algoritmo}}
\addto\captionsenglish{\renewcommand{\ALG@name}{Algorithm}}
\makeatother

\begin{document}

\begin{algorithm}
\caption{An algorithm}
\begin{algorithmic}
\STATE Some text.
\end{algorithmic}
\end{algorithm}

\end{document}
share|improve this answer
2  
I've deleted my answer since yours provides better solutions :) –  Claudio Fiandrino Oct 10 '12 at 9:29

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.