0

My requirement is to compose text in Sanskrit with (roman or devanagri) numbers and symbols placed over the Sanskrit text.

Before knowing anything about Latex, I asked this question in SU.SE - how-to-type-one-character-over-another-in-microsoft-word where my problem is explained in detail.

After knowing about Latex a bit I was able to compose the text in the desired way (sort of) using https://www.overleaf.com as it seems to help me start quick. I have volumes of pages to be typed in this way and I am sure there will be good number of errors after proof reading and hence editing after composing is key.

I get small issues like unable to align to left etc; but I guess I can solve them by going through sites like these.

Basically I am asking this question to know whether the approach (choice of Latex itself included) is the way to go and suggestions on how I can be productive in case if I have to use Latex. I am okay to switch to any online editor or any offline Windows based Latex editors.

Thanks for your time.


Update:

Thanks to IRadha, I used these lines to generate this Sama veda text shown in this image: Actual text that is to be composed This is just a small part that I am about to compose and I see the approach given below seems to make this operation bit easier.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{polyglossia}
\usepackage{xargs}

\setdefaultlanguage{hindi}
\newfontfamily{\hindifont}[Script=Devanagari]{Lohit Devanagari}
\setotherlanguage{English}

\newcommand{\hi}[1]{\begin{hindifont}#1\end{hindifont}}
\newcommandx*{\up}[3]{$\overset{\text{\hi{#2#3}}}{\text{\begin{hindifont}#1\end{hindifont}}}$}

\begin{document}
\up{ऒ}{4}{}ग्नाइ || \up{आ}{2}{0}\up{या}{0}{}हिs3\up{वॊ}{1}{}इतॊयाs2इ 
\end{document}

This is how it is in Latex using enter link description here enter image description here Posting it here so that it could be useful for others.

1 Answer 1

1

I would suggest you should use Unicode typing for Sanskrit typing, there are plenty of fonts available.

Here is a minimal example,

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{polyglossia}

\setdefaultlanguage{english}
\newfontfamily{\hindifont}[Script=Devanagari]{Kokila}
\setotherlanguage{hindi}

\begin{document}

$\overset{1\ 2}{\text{\begin{hindifont}कभी\end{hindifont}}}$

\end{document}

Output:

enter image description here

I've used the font Kokila, it should be installed in your windows system.

Also, you can do the same by creating some new commands:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{polyglossia}

\setdefaultlanguage{english}
\newfontfamily{\hindifont}[Script=Devanagari]{Kokila}
\setotherlanguage{hindi}

\newcommand{\hi}[1]{\begin{hindifont}#1\end{hindifont}}
\newcommand{\zero}[1]{$\overset{\text{\hi{०}}}{\text{\begin{hindifont}#1\end{hindifont}}}$}
\newcommand{\onea}[1]{$\overset{\text{\hi{१}}}{\text{\begin{hindifont}#1\end{hindifont}}}$}
\newcommand{\twoa}[1]{$\overset{\text{\hi{२}}}{\text{\begin{hindifont}#1\end{hindifont}}}$}
\newcommand{\thra}[1]{$\overset{\text{\hi{३}}}{\text{\begin{hindifont}#1\end{hindifont}}}$}

\begin{document}

\hi{सुवर्ज्योती}

\onea{सु}\hi{व}\zero{र्ज्यो}\thra{ती}

\end{document}

Output:

enter image description here

Changing the typeface to Kalam will give different output:

\newfontfamily{\hindifont}[Script=Devanagari]{Kalam}

enter image description here

3
  • Wow, great answer. Thanks and I will try to implement them.
    – Narayanan
    Commented Oct 25, 2019 at 9:39
  • @IRadha, I am unable to modify the command in your answer to accept two arguments. I would like to raise 2 and 0 over सु. While I tried this with my own attempt the combination of such commands becomes high. I could not make the command so that it would take the first argument alone as mandatory and the rest (2nd and 3rd parameter) as optional so that I can use the same command to raise '2' over सु in one place and '20' over सु in another place. My attempt \newcommand{\two}[2][ ]{$\overset{\text{\hi{२#2}}}{\text{\begin{hindifont}#1\end{hindifont}}}$} failed miserably. Can you help? Thanks.
    – Narayanan
    Commented Oct 28, 2019 at 11:50
  • 1
    @Narayanam, In that case, you have to use xargs package, which provides optional arguments. Normal \newcommand command takes only first argument as optional.
    – lRadha
    Commented Oct 29, 2019 at 3:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .