Fonts & Character SetsChange Language within a Document

Information and discussion about fonts and character sets (e.g. how to use language specific characters)
Post Reply
fibonacci2
Posts: 9
Joined: Wed Feb 01, 2012 12:41 am

Change Language within a Document

Post by fibonacci2 »

Hi guys!

I'm writing a bilingual document in English and Italian and I have this problem: I can't change language inside the document.

I tried all these commands:

Code: Select all

\documentclass[oneside]{book}
\usepackage[OT1]{fontenc}
\usepackage[latin9]{inputenc}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}
\usepackage{verbatim}
\usepackage[italian,english]{babel}
\usepackage{color}

\begin{document}

\selectlanguage{italian}
città
\selectlanguage{english}

\foreignlanguage{italian}{città}

\begin{otherlanguage}{italian}
città
\end{otherlanguage}

\end{document}




but none of them works properly!
In each case the letter "accented a" is wrongly displayed with a swung dash (instead of the accent).
Does someone have an idea about which problem is?

Thanks!

Recommended reading 2024:

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

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

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

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

Change Language within a Document

Post by localghost »

It's not related to the language, but more an encoding problem. For accented characters from a European language try another font encoding as well as input encoding.

Code: Select all

\usepackage[T1]{fontenc}   % enable Cork Encoding
\usepackage{selinput}      % instead of »inputenc«
\SelectInputMappings{
  agrave={à},
  igrave={ì},
  Euro={€}
}

Thorsten
fibonacci2
Posts: 9
Joined: Wed Feb 01, 2012 12:41 am

Re: Change Language within a Document

Post by fibonacci2 »

Thank you very much Thorsten! :)
Your solution works and you were very fast in replying!
Post Reply