LaTeX/C3/Indic-Language-Typesetting-in-LaTeX/English

From Script | Spoken-Tutorial
Jump to: navigation, search

Title of script: Indic Language Typesetting

Author: Meenal Gaba and Preeti Bamane

Keywords: Video tutorial, XeLaTeX, TeXWorks, Ubuntu, Linux, Unicode, Indic languages, Hindi typesetting


Visual Cue Narration
Slide 1: Title Hello and welcome to the spoken tutorial on “Indic language typesetting
Slide 2: Learning Objectives In this tutorial we will learn to,
  1. Install a new font and
  2. Typeset a document in indic language using XeLaTeX.
Slide 3: System Requirements This tutorial is recorded using
  • Ubuntu Linux 18.04 OS and
  • TeXworks editor v0.6.

The steps demonstrated will work in all operating systems.

Slide 4: Prerequisites
  • To practise this tutorial, you should be familiar with LaTeX commands.
  • If not, then go through the prerequisite LaTeX spoken tutorials on this website.
Slide 5: Code Files
  • The files used for the installation are available in the Code files link on this tutorial page.
  • Please download and use them while practising.
  • Make sure that all the supporting files are kept in the same folder while practising
In the downloaded folder

Point to Nirmala.ttf

In this tutorial we will be installing Nirmala UI font.
Slide 6: Nirmala UI This font supports 12 indic scripts as mentioned here.
Go to Downloads folder >> Indic-Code-Files First go to the folder where all the files are downloaded.
Double-click on Nirmala.ttf Now double-click on the file Nirmala.ttf


It will open the Nirmala UI font in the Font Viewer window.

Click on Install Click on the Install button located at the top right corner of the window.


This will install the font in your system.

Point to Installed Once done, the Install option will be changed to Installed.
Click on the back button on the left of the Font name.


Scroll down to locate Nirmala UI

Let us cross verify this.


Click on the back button located to the left of the Font name.


This will display the list of fonts already installed in the system.

Scroll down Scroll down to find the newly installed Nirmala UI font in the fonts folder.


Here it is.

Slide 7: Font Installation If Nirmala font file is present in that folder, then installation of the font is successful.


If not, repeat the above installation steps once again.

Slide 8: Demonstration Now we will typeset a document in XeLaTeX.


I will be using the file multiLang.tex for this demonstration.


The same is available in the Code files link.


You can download it from there and use it while practising.

[TeXworks] multiLang.tex I have already opened the file multiLang.tex in TeXworks editor.
Now let me give an overview of few commands.
Highlight fontspec package Fontspec package allows us to use opentype fonts without installing them.


This is useful when you are not able to install fonts or require admin access.


It gives us the facility to switch or use different fonts in the same LaTeX document.

Highlight polyglossia package


Polyglossia package allows us to typeset indic languages in a XeLaTeX document.


Without this package the sentences in other language will not be processed in the output.

Highlight \setdefaultlanguage{english} I have set the default language as English using the command setdefaultlanguage.


If you wish to set any other language as a default one, then we have to specify it here.

Highlight

\setotherlanguages{hindi, tamil, bengali, telugu, malayalam}

setotherlanguages command helps us to mention the languages which we are going to use here.


In this example we are using Hindi, Tamil, Bengali, Telugu and Malayalam scripts.

Highlight \newfontfamily


Using the newfontfamily command I have declared the font for each language.
Highlight Nirmala UI font Here I have used Nirmala UI font for all the languages.


You can use any of the 12 scripts supported by Nirmala UI as per your choice.


Make sure you have installed this font before compiling.

Highlight


\textbf{\Large Multiple language typesetting}

\bigskip

\par \textbf{English}

\par Knowledge is the supreme goal

\medskip

\textbf{Tamil}

Next to the begin document, I have written a few lines of code.


The first few lines are written in English.


As I have set English as a default language, I don’t need to specify any language.

Highlight \selectlanguage


Before typing the text in a language other than the default one, we have to use the command selectlanguage.


And select the respective language name as a value.

Highlight


\textbf{Tamil}

\par \selectlanguage{tamil}

அறிவு மிகச் சிறந்த இலக்கு

\medskip

Say, in this piece of code, I wish to display my text in Tamil.


So before writing the text in Tamil, I have used selectlanguage command, and set its value to Tamil.

Highlight the complete code. Likewise, I have written the code for the rest of the languages.


Now let us compile this.

Point to the drop down in the top left corner.


Select XeLaTeX from drop down

Select XeLaTeX as the compiler from the dropdown on the top toolbar.


XeLaTeX provides user with extensive set of fonts.

Click on the green Typeset button


Run the code by clicking on the green Typeset button at the top left corner.
Point to the output Observe the output pdf.


We can see the output of the sentence in various languages in Nirmala UI font.

[TeXworks] multiLang.tex


\newfontfamily\devanagarifont[Script=Devanagari]{Nirmala UI}

\newfontfamily\tamilfont[Script=Tamil]{Nirmala UI}

\newfontfamily\bengalifont[Script=Bengali]{Nirmala UI}

\newfontfamily\telugufont[Script=Telugu]{Nirmala UI}

\newfontfamily\malayalamfont[Script=Malayalam]{Nirmala UI}

In this example, I have used the font bundle Nirmala UI for all the languages.


Instead we can also use specific fonts for each language.

Slide 9: Indic Fonts


For this part of the demonstration, I will be using these fonts for the respective languages.


The same is available in the Code files link.


Download and install them as explained earlier in this tutorial, before proceeding further.


I have already installed these fonts on my machine.

[TeXworks] multiLang.tex


\newfontfamily\devanagarifont[Script=Devanagari]{Mangal}

\newfontfamily\tamilfont[Script=Tamil]{Latha}

\newfontfamily\bengalifont[Script=Bengali]{Shonar Bangla}

\newfontfamily\telugufont[Script=Telugu]{Gautami}

\newfontfamily\malayalamfont[Script=Malayalam]{Kartika}

In the multiLang.tex file, update the font declaration as shown here.


In this example, I am declaring different fonts for different languages.


Compile the file. Let us compile this file to see the output.


Make sure the compiler is set to XeLaTeX at the top.

Point to the output Observe that there is no change in the output, other than the font style.
Only Narration So using any one of these methods, one can typeset indic languages in a LaTeX document.
[TeXworks] multiLang.tex


Higlight \selectlanguage{tamil}

Important note.


While typesetting an indic language in LaTeX, make sure you have declared the command selectlanguage.


Else, the particular language text will not be displayed in the output.


Let us try this.

[TeXworks] multiLang.tex


\par Knowledge is the supreme goal

அறிவு மிகச் சிறந்த இலக்கு

Copy the text written in any language and paste it next to the line, Knowledge is the supreme goal.


Compile the file. Let us compile this file to see the output.
[TeXworks] multiLang.tex


\par \textbf{English}

\par Knowledge is the supreme goal

அறிவு மிகச் சிறந்த இலக்கு

\medskip


\textbf{Tamil}

\par \selectlanguage{tamil}

அறிவு மிகச் சிறந்த இலக்கு

\medskip

In this code we have written a line of text in Telugu twice.


One is before the selectlanguage command for Telugu and one is after that.


Point to the output But in the output pdf, we can only see the text which is written after the selectlanguage command.


So be careful while typesetting in indic language.

With this we have come to the end of this tutorial.

Let us summarise.

Slide 10: Summary In this tutorial we learnt
  1. How to install Nirmala UI font
  2. To typeset a document in multiple languages using Nirmala UI and other language specific fonts
Slide 11: Assignment As an assignment:
  • Identify and download other fonts which are compatible with the above languages.
  • Or that supports some other languages.
  • Install and use them to typeset a document and
  • Compare the output.
Slide 12: About Spoken Tutorial project The video at the following link summarises the Spoken Tutorial project.


Please watch it.

Slide 13: Spoken Tutorial workshops The Spoken Tutorial Project Team conducts workshops and

gives certificates.


For more details, please write to us.

Slide 14: Forum for specific questions Please post your timed queries in this forum
Slide 15: Acknowledgement Spoken Tutorial Project is funded by MHRD, Government of India.

More information on this Mission is available at this link.

Slide 16: Thanks Slide The script was contributed by Meenal and Preeti, FOSSEE Summer Fellows 2019.


And this is Praveen from IIT Bombay signing off.

Thanks for joining.

Contributors and Content Editors

Nancyvarkey, Pravin1389