Showing posts with label Latex. Show all posts
Showing posts with label Latex. Show all posts

Sunday, December 13, 2020

Typesetting in Tamil Brahmi in XeLaTeX

         Recently I found that Tamil Brahmi which is the precursor to the modern Tamil Language was included in the Unicode Standard. It is encoded in the range 11000-1107F. So I thought if its encoded in Unicode I wondered if I could typeset in Latex.This is my experiment. First we need the fonts for Brahmi and fortunately there is a font called Adinatha Tamil Brahmi and also its font manual.  and another font from Google Noto-Fonts called Noto Sans Brahmi.

         I Checked if I could type freely using IBus but unfortunately you can only enter characters one at a time this would be very time consuming, Luckily for us there is a transliteration tool from the authors of the font called Aksharamukha. To transliterate, set the base as Tamil and the output as Tamil Brahmi and you are good to go. Don't set the base as Tamil extended it doesn't work. Remember Aksharamukha is not a Translation tool.  Type your work and transliterate and copy the Tamil Brahmi letters. 

       Download and install the font. Run the following commands 
 
sudo fc-cache -v
sudo mkfontscale
sudo mkdir  
 
 IF you are using LuaLaTex run the following command to load the font 
 
luaotfload-tool --find "Adinatha Tamil Brahmi"
 
This  will load the font. Now you can typeset in either XeLaTex or LuaLaTex. Since both Polyglossia and  Babel don't support the Tamil Brahmi language natively we are turning to the fontspec package.  Here is the minimal working example. 

\RequirePackage[orthodox]{nag}
\documentclass[a4paper,12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{fontenc}
\usepackage{fontspec}
\usepackage{ClearSans}
\newfontfamily{\TACtam}{Lohit Tamil}
\newfontfamily{\bram}{Adinatha Tamil Brahmi}
\begin{document}
Hello.{\TACtam{வணக்கம்}}.{\bram{𑀯𑀡𑀓𑁆𑀓𑀫𑁆}}.
\end{document} 
 
Here is the screenshot.  

Image showing containg the word hello in three languages

Well my document compiled perfectly. Once again kudos to
Vindodh Rajan, Shriramana Sharma and Udhaya Sankar for the Font and Vindoh Rajan For maintaining the Aksharamuka transliteration tool. 




 

Saturday, December 12, 2020

Positioning a image at the top of the page in LaTeX

 
To position an image at the top of the page first begin the page with that image and use the following packages 
  • seqsplit
  • textpos
  • graphicx   
 
To position the image as a text block, it follows the syntax

\textblockorigin{x}{y} % co-ordinates for  origin
 \begin{textblock*}{x}{x,y}% co-ordinates
\end{textblock*}
 
Now type the following code  in  your document

\begin{center}
        \textblockorigin{-18pt}{-2pt}
        \begin{textblock*}{10cm}(3cm,1cm)
            \centering
            \includegraphics[width=16.2cm]{front.jpg}
            %\noindent\hfill{\rule{\textwidth}{0.8pt}}
                \line(1,0){450}
        \end{textblock*} ~\\[3em]
    \end{center}


Friday, December 11, 2020

Tamil Numerals and Tamil Fractions

 Tamil Numerals

To type the Tamil numerals in any word documents or even typesetting in Latex set the Tamil99 keyboard layout in IBus Else if you know the Unicode character for the numerals you can encode it directly. In Tex editors such as TeXstudio lets you encode the Unicode Characters by pressing CTRL+ALT+u or you can goto Edit ---> Insert Unicode character, a dialog box will open ,now you can insert your Unicode character.  I will tell you how to type in Tamil as well as its Unicode character

^#0        0BE6                          0

^#1        0BE7                          1

^#2        0BE8                 ௨         2

^#3        0BE9                          3

^#4        0BEA                          4

^#5        0BEB                          5

^#6        0BEC                         6

^#7        0BED                          7

^#8        0BEE                          8

^#9        0BEF                          9

-          0BF0                 ௰          10  

-          0BF1                           100     

-          0BF2                            1000

The Tamil numbers 10,100 and 1000 comes under the Extended Tamil99 Standard, Linux in IBus supports only the standard Tamil99 Layout; select these from Special characters in Libreoffice in Linux. In case of LaTeX you can insert the  Unicode Character in your TeX editor. 

Tamil Fractions: 

 

Most Tamil fonts don't encode the Tamil Fractions glyphs. These fractions are mentioned in the supplementary block [11FC0-11FFF]. There are only two fonts support these fractions 1. Lohit Tamil chart   and  2. Noto Sans Tamil Supplement  . As I've mentioned earlier IBus doesn't  support the extended characters so you have to insert the Unicode characters.Comparing to the fonts from the Lohit Tamil chart, Noto Sans Tamil supplement is better.I will mention the Unicode character,its Tamil fraction, indo-arabic numeral representation and its Tamil word.


11FC0         𑿀         1/320        முந்திரி 

11FC1         𑿁           1/160       அரைக்காணி

11FC2         𑿂           1/80         காணி

11FC3         𑿃          1/64         கால் வீசம் 

11FC4        𑿄            1/40        அரை மா

11FC5        𑿅           1/32        அரை வீசம்

11FC6        𑿆           3/80        முக்காணி

11FC7        𑿇           3/64        முக்கால் வீசம்

11FC8        𑿈            1/20        மா

11FC9        𑿉           1/16        வீசம்   -1

11FCA*       𑿊           1/16        மாகாணி  -2

11FCB        𑿋            1/10        இருமா

11FCC       𑿌           1/8         அரைக்கால்

11FCD       𑿍            3/20        மும்மா

11FCE       𑿎           3/16        மூவீசம்

11FCF       𑿏            1/5         நான்கு மா

11FD0       𑿐            1/4         கால்

11FD1       𑿑             1/2         அரை -1

11FD2*      𑿒             1/2         அரை -2

11FD3       𑿓            3/4         முக்கால்

11FD4       𑿔             -           கீழ்

𑿔 ---- Downsizing factor when prefixed to a fraction it reduces it by a factor of 1/320

*  ---- Alternate way of writing


Reference:

https://pravins.fedorapeople.org/tamil-fraction-symbol-proposal-fonts/n4430.pdf

https://www.unicode.org/charts/fonts.html

https://unicode.org/charts/PDF/U0B80.pdf

https://www.unicode.org/charts/PDF/Unicode-12.0/U120-11FC0.pdf

 

 

Setting up Font For Bold and Italic in LaTeX

 To Set up font for bold and italic in LaTeX, one has to load the Fontspec package. But first make sure the font you are using has both the bold and italic glyphs or make sure the fonts you are going to use matches else it would be very awkward and look very unprofessional. Most of the time  the fontspec package can load a font with its given name such as Times New Roman or Noto Sans. If you mentioned a font by its file name then make sure you mention the Bold and Italic fonts.In This you can also set the default typewriter font, For example if you want to load the courier as the default typewriter font all you had to is load the package Here is the Minimal Working example.

\Requirepackage[orthodox]{nag}                    \documentclass{article}                       \usepackage{fontspec}               \setmainfont{texgyrepagella-regular.otf}[BoldFont= texgyrepagella-bold.otf ,ItalicFont= texgyrepagella-italic.otf , BoldItalicFont = texgyrepagella-bolditalic.otf]          \usepackage{courier}                                \begin{ document}                                  \end{document}

 

Reference:

https://tug.org/FontCatalogue/courier/

https://www.ctan.org/search?phrase=fontspec

https://tex.stackexchange.com/a/31743/229186 


Thursday, December 10, 2020

Typesetting in Tamil using Babel in XeLaTeX

 

 I have written in an previous post on how to typeset in Tamil  using the Polyglossia Package. In this post we will typeset in Tamil using the Babel Package. To typeset as usual we have to load a few packages and these are the most important to load 

\usepackage{babel}
\usepackage{fontspec}    
                        \usepackage{microtype}
\usepackage{geometry}
\usepackage{blindtext}
\usepackage{seqsplit}
\usepackage[absolute]{textpos}
\usepackage[utf8]{inputenc} \usepackage[T1,TS1,OT1,OT4,TU,EU1,QX,T5,LY1]{fontenc}
  

Set the Following options in your preamble 

\babelprovide[main, import]{tamil}
\babelprovide[import]{english}
\defaultfontfeatures{Scale=MatchLowercase}
\setmainfont{TAU-Barathi}[Renderer=Harfbuzz,Script=Tamil]
\newfontfamily\englishfont{Times New Roman}[Scale=0.98,Renderer=Harfbuzz,Ligatures=TeX]

Now we can begin our document 

 \begin{document}
  வணக்கம்                                            \end{document} 
 

 Now you can typeset in Tamil.

Reference: 

https://tex.stackexchange.com/a/498941/229186

https://tex.stackexchange.com/a/171448/229186

Tuesday, December 8, 2020

How to Set font of Our choice in LaTeX

 To Set a Font our choice say Georgia or Charis SIL in latex we have to use the  fontspec  package. To load the fontspec package run:

\documentclass[a4paper,12pt]{article}
\usepackage{fontspec}
\setmainfont{Georgia}
\begin{document}
\end{document}

and compile the document in either XeLaTeX  or LuaLaTex.

Saturday, November 21, 2020

Writing a Letter using Latex

Latex is a typesetting system which follows the WISWYM paradigm.It can be used to   typeset any kind of document such as books,reports and even letters.  

To write a letter in you have load the letter class. By default it uses the modified block layout.

Important Packages to Load:

These are the important packages to  load in my perspective, they are

  • Nag 
  • Inputenc
  • fontenc
  • microtype
  • setspace
  • datetime
  • block [if you need the full block layout]

 The package Nag is to prevent from running obsolete or depreciated commands.  

Inputenc  is for loading unicode encodings and fontenc is for the extended character set.

 The microtype package is for character protrusion and font expansion, furthermore the adjustment of interword spacing and additional kerning, as well as hyphenatable letter spacing (tracking) and the possibility to disable all or selected ligatures.

The set space package as the name indicates sets the line spacing. The datetime packages helps modifies the date to our liking. 

Some website may say use the newlfm and isodoc packages but compare to them this package doesn't have any other options and works within the letter class makes it an ideal package for the letter layout

 code for loading the packages:

\RequirePackage[orthodox]{nag}                         \documentclass[a4paper,12pt,oneside]{letter}        \usepackage[utf8]{inputenc}                             \usepackage[T1]{fontenc}              \usepackage{microtype}                  \usepackage{setspace}                           \usepackage[nodayofweek]{datetime}

Page styles:

The letter class supports the following styles

        1. Headings
        2. Empty
        3. First Page
        4. Plain      

We  will be using the page style empty. The code to load the style is 

\pagestyle{empty}  

  Writing the letter:

We are using the empty page style,by default the letter class leaves an 1 inch space for the header and another 1.5 in for the top margin. We will be removing the header in our document. This will make sure there will be 1.5 inch margin from top,left and right.

The commands supported inside the document are 

          1. \address
          2. \signature
          3. \name
          4. \location
          5. \telephone  
          6. \opening
          7. \closing
          8. \encl
          9. \cc 

We begin the document by \begin{document}  in the letter the address of the sender is first written.  The From address is typed within the \address command. using \\ for starting a new line. The \signature command  as the name implies will put your name in closing leaving a space for you to manually sign your letter.

     \begin{document}   

     \address{type your address}             

     \signature{your name}

We begin the letter with the \begin{letter} followed by the receipient address. Next we add the opening greeting of the letter with \opening  followed by the subject of the letter. There is no command for the  subject. The subject must be below 1pt from the  opening and should be left justified  so we use the \begin{spacing} environment were we write our  subject.

   \begin{letter}{receipient's address} 

Before the \opening run the following  commands so that there won't be  a huge space from the top. Use the following commands with caution.If you have an header file then you shouldn't use this command. 

     \makeatletter
  \def\@texttop{}
  \setlength\headheight{0\p@}
  \setlength\headsep{0\p@}
  \setlength\footskip{0\p@}
  \setlength\topmargin{20pt}
  \setlength\footnotesep{0\p@}
  \setlength{\skip\footins}{0\p@}
  \makeatother

               \opening{Dear sir/Madam}
               \begin{spacing}{1}
                 \begin{flushleft}
                    Re: Your subject
                 \end{flushleft}
               \end{spacing}

After this write your content of the letter. A business or formal letters should be a one  page document. Finish the letter with the \closing{Regards,} command. If you have  enclosures with the letter then run the \encl{\\1. xy \\2. xx} and if you have multiple receipients then you should add courtesy copy command          \cc{\\1. aa \\2.bb

End the document with \end{letter} and \end{document}. The signature and closing might not be adequately right justified so use the \hfill command within that command. Finally save the file and compile in pdflatex and if compiled successfully it will produce a pdf containing your letter which you can now print. 

Popular Posts