# Beamer crashes with babel Turkish package

I just started to learn beamer and noticed that the problem in \usepackage[turkish]{babel} and \includegraphics inconcistency question applies for beamer and \shorthandoff{=} solution does not work. Has anyone have another solution? Thanks.

\documentclass{beamer}
\mode<presentation>
\usepackage[utf8]{inputenc}
\usepackage[turkish]{babel}
\usepackage{graphicx}

\begin{document}
\begin{frame}
\begin{figure}
\centering
\shorthandoff{=}
\includegraphics[scale=0.3]{resimler/stmornek2.png}
\shorthandon{=}
\end{figure}
\end{frame}
\end{document}

-
Can you show a minimal example, please? –  egreg May 20 '12 at 22:04

It works if you move the commands outside the frame:

\documentclass{beamer}
\mode<presentation>
\usepackage[turkish]{babel}
\usepackage{graphicx}

\begin{document}
\shorthandoff{=}
\begin{frame}
\begin{figure}
\centering
\includegraphics[scale=0.3]{resimler/stmornek2.png}
\end{figure}
\end{frame}
\shorthandon{=}
\end{document}


or if you add the fragile option to the frame:

\documentclass{beamer}
\mode<presentation>
\usepackage[turkish]{babel}
\usepackage{graphicx}

\begin{document}

\begin{frame}[fragile]
\begin{figure}
\shorthandoff{=}
\centering
\includegraphics[scale=0.3]{resimler/stmornek2.png}
\shorthandon{=}
\end{figure}
\end{frame}

\end{document}


As egreg mentions in his comment, you are using the utf8 option for inputenc, so you don't really need the = shorthands for the turkish module of babel, and you can simply deactivate them after \begin{document}:

\documentclass{beamer}
\mode<presentation>
\usepackage[utf8]{inputenc}
\usepackage[turkish]{babel}
\usepackage{graphicx}

\begin{document}
\shorthandoff{=}

\begin{frame}
\begin{figure}
\centering
\includegraphics[scale=0.3]{resimler/stmornek2.png}
\end{figure}
\end{frame}

\end{document}

-
lets hope that other things in the frame wont be affected, anyway Thank you. –  Ahmet Sadık Yorulmaz May 20 '12 at 22:24
@AhmetSadıkYorulmaz If you use UTF-8, you won't need the = shorthands for Turkish, so you can say \shorthandoff{=} after \begin{document} and forget about it. –  egreg May 20 '12 at 22:33
Gonzalo, @AhmetSadıkYorulmaz: Did anyone tried to use the [fragile] option of frame? It will handle most verbatim issues, and this seems to be one. –  Martin Scharrer May 21 '12 at 0:38
@MartinScharrer in fact, egreg mentioned the use of fragile in the chat room, but taking into account his comment (the shorthand will not be needed anyway), I decided not to include this option. I will however do so, since it could be useful for the case in which utf8 is not used. –  Gonzalo Medina May 21 '12 at 0:44