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.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How to obtain the current language set by \setotherlanguage{english} ?

\documentclass{article} 
\usepackage{polyglossia}
\setdefaultlanguage{czech}
\begin{document}
\ifthenelse{\equal{\xpg@other@language}{czech}}{A}{B} %macro doesn't exist
\setotherlanguage{english}
\ifthenelse{\equal{\xpg@other@language}{czech}}{A}{B}
\end{document}

I want output like AB. But macro \xpg@other@language does not exist and documentation is very poor. \xpg@main@language returns czech as I expected.

share|improve this question
    
There can be more than one "other" language, so the equal test doesn't make sense. What are you trying to achieve? Beside this your document doesn't load the ifthen package, and your are not making @ a letter before the tests. – Ulrike Fischer Feb 20 at 13:01
    
Ok, the question might be: How to obtain english just before \end{document}? I'm trying to distinguish between languages in my own-written macros. Of course you are right with \makeatletter and ifthenelse but this mess doesn't change a meaning. – Luuuucky Feb 20 at 13:46
up vote 5 down vote accepted

I guess you are looking for something like this:

\documentclass{article}
\usepackage{polyglossia}
\setdefaultlanguage{czech}
\setotherlanguage{english}
\begin{document}
\iflanguage{czech}{czech}{no}

\selectlanguage{english}

\iflanguage{czech}{czech}{no}

\end{document}

enter image description here

share|improve this answer

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.