Fonts & Character Setsbabel | Turn off Translations

Information and discussion about fonts and character sets (e.g. how to use language specific characters)
Post Reply
John Kiouvrekis
Posts: 3
Joined: Wed Dec 05, 2012 8:16 pm

babel | Turn off Translations

Post by John Kiouvrekis »

I would like to know if there is an option which stops the automatically translation of the babel package because it messes with other packages and I get various problems with it. For example the following code

Code: Select all

\documentclass[12pt]{article}
\usepackage[english,greek]{babel}
\usepackage[iso-8859-7]{inputenc}
\usepackage{gfsartemisia-euler}
\usepackage{eqexam}

\begin{document}
  \begin{exam}[dd]{ss}
    \begin{problem*}
      \begin{multicols}{3}
        \begin{parts}
          \item mpla mlpa mlpa mlpa $\displaystyle \sum_{2}X_{e}$
          \item $\displaystyle \sum_{2}X_{e}$
          \item $\displaystyle \sum_{2}X_{e}$
          \item mpla mlpa mlpa mlpa $\displaystyle \sum_{2}X_{e}$
          \item $\displaystyle \sum_{2}X_{e}$
          \item $\displaystyle \sum_{2}X_{e}$
        \end{parts}
      \end{multicols}
      text
    \end{problem*}
  \end{exam}
  \begin{enumerate}
    \item \textlatin{ number} 
    \begin{enumerate}
      \item \textlatin{This is not right} 
    \end{enumerate}
  \end{enumerate}
\end{document}
has this result
babel-issue.png
babel-issue.png (54.4 KiB) Viewed 7864 times
The lists should not be in Greek but in English. This happens also in other packages which have definitions in English even with simple lists like {enumerate} , for example exsheets or svmono (Springer class for books).
Last edited by localghost on Wed Dec 05, 2012 9:40 pm, edited 1 time 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.

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

babel | Turn off Translations

Post by localghost »

Swap the language options for babel.

Code: Select all

\usepackage[greek,english]{babel}
The last option determines the default document language. For details please refer to the package manual.


Best regards and welcome to the board
Thorsten
John Kiouvrekis
Posts: 3
Joined: Wed Dec 05, 2012 8:16 pm

babel | Turn off Translations

Post by John Kiouvrekis »

Obvious you didn't understand my question. I want Greek to be the default language of the document and not English. It's very annoying to put

Code: Select all

\greektext ελληνικο κειμενο = this is greek text
or

Code: Select all

\textgreek{αυτο ειναι ενα ελληνικο κειμενο} 
in every entry of Greek text.
With that way, the definition of new environment becomes intractable.
Ιt would be nice to be able to type directly in Greek.
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

babel | Turn off Translations

Post by cgnieder »

Welcome to the LaTeX community!

If I understand you correctly you want something like

Code: Select all

\renewcommand\theenumii{\foreignlanguage{english}{\alph{enumii}}}
The counter used for enumerations in the second depth is enumii and called by {enumerate} with \thenumii. The redefinition above changes the language just for this call.

Code: Select all

\documentclass[12pt]{article}
\usepackage[english,polutonikogreek]{babel}
\usepackage[iso-8859-7]{inputenc}
\usepackage{gfsartemisia-euler}

\renewcommand{\theenumii}{\foreignlanguage{english}{\alph{enumii}}}
\begin{document}


\begin{enumerate}
 \item \textlatin{ number}
 \begin{enumerate}
  \item \textlatin{This is not right}
 \end{enumerate}
\end{enumerate}

\end{document}
greekenumii.png
greekenumii.png (4.53 KiB) Viewed 7852 times
Regards
site moderator & package author
John Kiouvrekis
Posts: 3
Joined: Wed Dec 05, 2012 8:16 pm

babel | Turn off Translations

Post by John Kiouvrekis »

Ηi, i think that the problem is deeper. For example, babel messes with your package, exsheets.

Code: Select all

\documentclass[10pt,a4paper,twocolumn]{article}
\usepackage[english,greek]{babel}
\usepackage[iso-8859-7]{inputenc}
\usepackage{gfsartemisia-euler}
\usepackage[load-headings,headings=runin]{exsheets}
\begin{document}
\section{Πρωτη ενοτητα}
μπλα
\section{Δευτερη Ενοτητα}
\[\sum_{i=1}^{\infty}X_{i}\int f(x)\cdot g(x)\]
\SetupExSheets{counter-format=\thesection~qu[a]}
\begin{question}[name = ασκηση]
\[\sum_{i=1}^{\infty}X_{i}\int f(x)\cdot g(x)\]
\end{question}
\end{document}

The problem is at the counter output.
I can use this command in the text

Code: Select all

\foreignlanguage{english}{\SetupExSheets{counter-format=\thesection~qu[a]}}
But i think that would be tedious (if not impossible) to do that for all the packages which i use.
For example, if i do not define the name of the question

Code: Select all

\documentclass[10pt,a4paper,twocolumn]{article}
\usepackage[english,greek]{babel}
\usepackage[iso-8859-7]{inputenc}
\usepackage{gfsartemisia-euler}
\usepackage[load-headings,headings=runin]{exsheets}
\begin{document}
\SetupExSheets{counter-format=\thesection~qu[a]}
\begin{question}
\[\sum_{i=1}^{\infty}X_{i}\int f(x)\cdot g(x)\]
\end{question}
\end{document}
the output is
babel_2.png
babel_2.png (9.47 KiB) Viewed 7847 times
(babel translate by letter)

Ιn conclusion can i define babel so that not messes with other packages but only with the pure text?
@cgnieder (off topic) Is XeTeX better with exsheets than babel?
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

babel | Turn off Translations

Post by cgnieder »

No, this is exactly the same problem.

This happens every time you want to call a counter with format \alph{counter}. {enumerate} uses it and so does exsheets when you format the counter with argument [a]. The best way, IMHO, would be to define a command \englishalph, its low level equivalent \english@alph, and in case of exsheets a counter pattern for it:

Code: Select all

\documentclass[10pt,a4paper,twocolumn]{article}
\usepackage[english,greek]{babel}
\usepackage[iso-8859-7]{inputenc}
\usepackage{gfsartemisia-euler}
\usepackage[load-headings,headings=runin]{exsheets}

\makeatletter
\newcommand*\english@alph[1]{\foreignlanguage{english}{\@alph{#1}}}
\newcommand*\englishalph[1]{\expandafter\english@alph\csname c@#1\endcsname}
\NewPatternFormat{ea}{\english@alph}
\makeatother

% let `exsheets' use the new pattern:
\SetupExSheets{counter-format=se~qu[ea]}

% renew enumii:
\renewcommand*\theenumii{\englishalph{enumii}}

\begin{document}
\section{Πρωτη ενοτητα}
μπλα
\section{Δευτερη Ενοτητα}
\[\sum_{i=1}^{\infty}X_{i}\int f(x)\cdot g(x)\]

\begin{question}[name = ασκηση]
\[\sum_{i=1}^{\infty}X_{i}\int f(x)\cdot g(x)\]
\end{question}

\begin{enumerate}
 \item foo
 \begin{enumerate}
  \item bar
 \end{enumerate}
\end{enumerate}

\end{document}
Best regards

BTW:

Code: Select all

\foreignlanguage{english}{\SetupExSheets{counter-format=\thesection~qu[a]}}
wouldn't work, anyway, since the language settings is long been changed again the next time \alph is actually called. TeX macros are -- well -- macros, i.e., they simply are replaced by their definition. That also holds when the definition is hidden in some fancy call like \SetupExSheets{counter-format=qu[a]}.
Last edited by cgnieder on Thu Dec 06, 2012 2:37 pm, edited 1 time in total.
site moderator & package author
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

babel | Turn off Translations

Post by cgnieder »

Regarding the name of the questions: if you don not rename them you should get the following warning in your log file:
Package translations Warning: Translation for `exsheets-exercise-name' in greek unknown.
This is because I do not speak Greek and was unable to provide a translation. You can however provide a translation yourself, see section 5.3.6 of the manual.

Regards
site moderator & package author
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

babel | Turn off Translations

Post by cgnieder »

I'm sure you simply missed the section of the board rules which states that one should provide a direct link if one makes a crosspost (here it is: http://tex.stackexchange.com/questions/ ... n-of-babel)

Regards
site moderator & package author
Post Reply