GeneralRetrieve the current Language

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
Laurentius
Posts: 132
Joined: Wed Feb 11, 2009 11:38 pm

Retrieve the current Language

Post by Laurentius »

Is there a command that returns the current language?

Recommended reading 2024:

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

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

cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Retrieve the current Language

Post by cgnieder »

Both in babel and in polyglossia (for XeLaTeX) the current language name is stored in \languagename.

Code: Select all

\documentclass{article}
\usepackage[german,english]{babel}
\begin{document}

\languagename\selectlanguage{german} \languagename

\end{document}
or

Code: Select all

\documentclass{article}
\usepackage{polyglossia}
\setmainlanguage{english}
\setotherlanguage{german}
\begin{document}

\languagename\selectlanguage{german} \languagename

\end{document}
Regards
site moderator & package author
Post Reply