2

In my preample i use the babel to load the greek language along with the txfontsb package for greek letters. In order to create a plot using gnuplot, i use the following code : -synctex=1 -interaction=nonstopmode -enable-write18 next to my pdflatex command.

\documentclass[a4paper,11pt]{article}
\usepackage{pgfplots}
\usepackage{tkz-fct}
\usepackage{psfrag}
\usepackage[english,greek]{babel}
\usepackage[iso-8859-7]{inputenc}
\usepackage{amsmath}
\usepackage[T1]{fontenc}
 \usepackage{txfontsb}
\begin{document}
%Γράφημα
\begin{tikzpicture}[scale=1.25]
\tkzInit[xmin=-5,xmax=5,ymax=2]
\tkzGrid
\tkzAxeXY
\tkzFct[color=red]{2*x**2/(x**2+1)}
\end{tikzpicture}
\end{document}

When i disable the \usepackage[english,greek]{babel} command using % everything works fine. But when i use it i get the folloing errors :

Missing \endcsname inserted \tkzFct[color=red]{2*x**2/(x**2+1)}
Extra \fi \tkzFct[color=red]{2*x**2/(x**2+1)}
Extra \fi \tkzFct[color=red]{2*x**2/(x**2+1)}
Extra \fi \tkzFct[color=red]{2*x**2/(x**2+1)}
Extra \fi \tkzFct[color=red]{2*x**2/(x**2+1)}
Extra \endcsname \tkzFct[color=red]{2*x**2/(x**2+1)}
Missing \endcsname inserted \tkzFct[color=red]{2*x**2/(x**2+1)}
Extra \fi \tkzFct[color=red]{2*x**2/(x**2+1)}
Extra \fi \tkzFct[color=red]{2*x**2/(x**2+1)}
Extra \fi \tkzFct[color=red]{2*x**2/(x**2+1)}
Extra \endcsname \tkzFct[color=red]{2*x**2/(x**2+1)}
Missing $ inserted \tkzFct[color=red]{2*x**2/(x**2+1)}
Extra }, or forgotten $ \tkzFct[color=red]{2*x**2/(x**2+1)}
Extra \fi \tkzFct[color=red]{2*x**2/(x**2+1)}
Missing $ inserted \end{tikzpicture}
Missing } inserted \end{tikzpicture}
running in backwards compatibility mode (unsuitable tick labels; missing features). Consider writing \pgfplotsset{compat=1.11} into your preamble.
Overfull \hbox (41.38289pt too wide) in paragraph

How can i make them work together?

2

The tkz-fct package uses \alph for making internal labels, but this fails when babel-greek is loaded, because \alph (actually the internal version \@alph) is redefined to produce Greek letters.

This should be considered a bug in tkz-fct, but there is a workaround, albeit a bit ugly.

\documentclass[a4paper,11pt]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\makeatletter
% save a copy of the original \@alph command
\let\latex@alph\@alph
% a command to (locally) restore the original \@alph command
\newcommand{\safealph}{\let\@alph\latex@alph}
\makeatother

\usepackage[english,greek]{babel}

\usepackage{pgfplots}
\usepackage{tkz-fct}
\usepackage{amsmath}

\begin{document}
%Γράφημα
\begin{tikzpicture}[scale=1.25]
\safealph
\tkzInit[xmin=-5,xmax=5,ymax=2]
\tkzGrid
\tkzAxeXY
\tkzFct[color=red]{2*x**2/(x**2+1)}
\end{tikzpicture}
\end{document}

enter image description here

  • Great! And it seems that \safealph needs to be loaded within every tikzpicture enviroment that contains a tkz-fct plot. – mac May 9 '16 at 7:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.