5

Beside the syntax, are there any other differences and use cases when one should use \text<lang>{...} vs \begin{<lang>} ... \end{<lang>} to select another language, i.e., insert snippets of text written in another language?

The documentation only stipulates longer pieces of text in favor for the environment syntax.

PS. It was my original understanding that the environment syntax started a new line before inserting the text, but a quick test proved me wrong.

Mico
  • 506,678

1 Answers1

2

They're not the same. With \text<language>{text} you're doing \foreignlanguage{<language>}{text}, whereas \begin{<language>} is the same as \begin{otherlanguage}{<language>}

The environment form also changes the tags, which is not the case with the command form, as seen in the following example; dates are changed by both forms.

\documentclass{article}
\usepackage{polyglossia}
\setmainlanguage{english}
\setotherlanguage{italian}

\begin{document}

Nothing: \chaptername\ \today

\texttt{\string\textitalian}: \textitalian{\chaptername\ \today}

Environment:

\begin{italian}
\chaptername\ \today
\end{italian}

\end{document}

enter image description here

In the .aux file you'll find

\select@language {english}
\select@language {italian}
\select@language {english}

(among other things); the first is written at the start, the second is caused by \begin{italian} and the third by \end{italian}. Usage of \textitalian won't make such an annotation.

egreg
  • 1,121,712
  • 1
    It would be nice if an explanation such as this one made it into the next version of the polyglossia user guide. – Mico Mar 25 '15 at 04:28