Graphics, Figures & Tables! Missing \endcsname inserted. error when inserting figure

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
mturan
Posts: 14
Joined: Wed Nov 10, 2010 10:01 pm

! Missing \endcsname inserted. error when inserting figure

Post by mturan »

Hi there,

I am trying to figure out how to get my figure on my document and have no error message. When I use english babel, there is no problem, however when I use the turkish babel, I get the errors as shown below. I need to use the turkish babel for hyphenation. avl.jpg is attached. Do you have any idea why? Thanks for the help in advance

I use Texniccenter and the Miktex

! Missing \endcsname inserted.
<to be read again>
\relax
l.24 ...raphics[width=0.5\textwidth]{avl.jpg}

! Extra \endcsname.
<recently read> \endcsname
l.24 ...raphics[width=0.5\textwidth]{pics/avl.jpg}
I'm ignoring this, since I wasn't doing a \csname.

Code: Select all

\documentclass{article}
\usepackage[latin5]{inputenc}
%\usepackage[english]{babel}
\usepackage[turkish]{babel}
\usepackage{graphicx}
\usepackage[left=4cm, right=2.5cm, top=2.5cm, bottom=2.5cm%, includefoot, headheight=13.6pt
]{geometry}
\renewcommand{\rmdefault}{phv} % Arial
\renewcommand{\sfdefault}{phv} % Arial %added by turan



\begin{document}

\section{MTRN}

\LaTeXe{} 'de Türkçe metin.

Bugün de Devletler Hukukunun başlıca kişileri bağımsız devletler olmakla beraber,bunların yanı sıra yetkileri sınırlı devletler, devlet sayılmayan topluluklar vardır.

\begin{figure}[h]
	\centering
	\includegraphics[width=0.5\textwidth]{pics/avl.jpg}
	\caption{deneme}
	\label{fig:avl}
\end{figure}


Değerlendirme merkezleri ise, işgörenin performansı ve iş yapış şekli ile ilgili olarak örgüt içinde kendisine bir geri bildirim sağlar. İşgörenlerin performansı karşılaştırılır ve kariyer gelişimi için uygun eğitimler belirlenir. 

\end{document}
Attachments
avl.jpg
avl.jpg (24.76 KiB) Viewed 20187 times
Last edited by mturan on Wed Dec 22, 2010 12:31 pm, edited 3 times in total.

Recommended reading 2024:

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

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

User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

! Missing \endcsname inserted. error when inserting figure

Post by frabjous »

Seems to be a bug in babel regarding Turkish typesetting rules for inserting space around =; it's applying it even in the untypeset "width=0.5" part of your includegraphics line.

There's some discussion of this here.

A workaround seems to be to deactivate the = rule temporarily. For example, this works for me:

Code: Select all

\documentclass{article}
\usepackage[utf8]{inputenc}
%\usepackage[english]{babel}
\usepackage[turkish]{babel}
\usepackage{graphicx}
\usepackage[left=4cm, right=2.5cm, top=2.5cm, bottom=2.5cm%, includefoot, headheight=13.6pt
]{geometry}
\renewcommand{\rmdefault}{phv} % Arial
\renewcommand{\sfdefault}{phv} % Arial %added by turan

\begin{document}

\section{MTRN}

\LaTeXe{} 'de Türkçe metin.

Bugün de Devletler Hukukunun başlıca kişileri bağımsız devletler olmakla beraber,bunların yanı sıra yetkileri sınırlı devletler, devlet sayılmayan topluluklar vardır.

\begin{figure}[h]
   \centering
   \shorthandoff{=}
   \includegraphics[width=0.5\textwidth]{avl.jpg}
   \shorthandon{=}
   \caption{deneme}
   \label{fig:avl}
\end{figure}


Değerlendirme merkezleri ise, işgörenin performansı ve iş yapış şekli ile ilgili olarak örgüt içinde kendisine bir geri bildirim sağlar. İşgörenlerin performansı karşılaştırılır ve kariyer gelişimi için uygun eğitimler belirlenir.

\end{document}
(I changed the inputenc line to match my editor's and the forum's character encoding; you may need to change it back.)
mturan
Posts: 14
Joined: Wed Nov 10, 2010 10:01 pm

Re: ! Missing \endcsname inserted. error when inserting figu

Post by mturan »

I read the discussion and used \usepackage{xkeyval} initially which reduced the number of errors from 12 to 2 without a solution. Yours worked fine with me too but would there be any permanent solution to this issue somehow?
mturan
Posts: 14
Joined: Wed Nov 10, 2010 10:01 pm

! Missing \endcsname inserted. error when inserting figure

Post by mturan »

This quote explains why it happens. Does anybody know how/what to change in the dtx file?
The file turkish.dtx defines all the language definition macros for the Turkish language. Turkish typographic rules specify that a little `white space' should be added before the characters `:', `!' and `='. In order to insert this white space automatically these characters are made `active'. Also \frenhspacing is set.
from "Babel, a multilingual package for use with LATEX's
standard document classes"
the way active characters are dealt with is completely changed. They are
called `shorthands'; one can have three levels of shorthands: on the user
level, the language level and on `system level'. A consequence of the new
way of handling active characters is that they are now written to auxiliary
les `verbatim';
http://www.phys.ethz.ch/~ihn/latex/user.pdf
mturan
Posts: 14
Joined: Wed Nov 10, 2010 10:01 pm

! Missing \endcsname inserted. error when inserting figure

Post by mturan »

I made couple of changes in the turkish.ldf file and placed (save as) in the same directory where my project is at. Works fine now

Texniccenter 1.0 stable
Mixtex 2.9

Code: Select all

   
1-%\initiate@active@char{=}

2-\addto\extrasturkish{%
  \bbl@activate{:}\bbl@activate{!}}%\bbl@activate{=}}
3-%\declare@shorthand{turkish}{=}{%
%  \ifmmode
%    \string=%
%  \else\relax
%    \ifhmode
%      \ifdim\lastskip>\z@
%        \unskip\kern\fontdimen2\font
%        \kern-1.4\fontdimen3\font
%      \fi
%    \fi
%    \string=%
%  \fi}

Post Reply