0

I have looked at several answers on how to write Devanagari text in LaTeX. What I understand is that I need to preprocess the file using either skt or dn (dn seems to create some problems for me, where it generates some weird characters elsewhere in the document, so I would like to stick with skt). How do I do this using the Windows terminal? I am using TexMaker + MikTeX (pdflatex). Any help is greatly appreciated.

In fact, I just need one sentence in my document - वसुधैव कुटुम्बकम् If someone can generate the tex parsable format for use with skt, that would be super useful. Thanks in advance!

8
  • Can't you use lualatex or xelatex? May 14, 2020 at 10:19
  • I tried using both for a few examples mentioned in tex.stackexchange.com/questions/408326/…, but the program cannot locate the fonts. Moreover, I will need to use pdflatex, because I want to embed this in my thesis.
    – ki-ang
    May 14, 2020 at 10:30
  • If you need only a word you can make a small image with lualatex and then include this. Find a suitable font on the internet (e.g. a moto font). May 14, 2020 at 10:33
  • That's the last resort. Thanks for the suggestion! Else, I will just try to reverse engineer the code from a few examples.
    – ki-ang
    May 14, 2020 at 10:39
  • 2
    Your university shouldn’t be forbidding you to use LuaLaTeX and XeLaTeX in 2020. That PDFTeX doesn’t support most of the world’s languages is one reasonable argument to get them to change that policy.
    – Davislor
    Jun 14, 2020 at 0:55

2 Answers 2

1

I managed to find a solution.

  1. Following this answer, I downloaded the skt.c file from here.
  2. Since I am using Windows, I downloaded MinGW from here to get the gcc compiler.
  3. On the windows command line, update the path following this answer.
  4. Create a sample.skt file as shown below with a simple transliteration of the devanagari sentence. I had to consult the transliteration scheme on page 19 (१९) of the skt documentation to write some special letters such as "टु". I had to write ".t" instead of "t" or "T" or "th".

    \documentclass[12pt]{article}
    \pagestyle{plain}
    \usepackage[margin=1.8cm]{geometry}
    \geometry{a4paper}
    \usepackage[parfill]{parskip}
    \usepackage{amsmath}
    \usepackage{skt}
    
    \begin{document}
    
    {\skt vasudhaiva ku.tumbakam}
    
    \end{document}
    
  5. Place the .skt file in the same path as skt.c file, run command prompt, write gcc -v to confirm the installation of MinGW, then simply type:

     skt sample.skt sample.tex
    
  6. A file named sample.tex should be generated in the same path. Below is the generated .tex file.

    \documentclass[12pt]{article}
    \pagestyle{plain}
    \usepackage[margin=1.8cm]{geometry}
    \geometry{a4paper}
    \usepackage[parfill]{parskip}
    \usepackage{amsmath}
    \usepackage{skt}
    
    \begin{document}
    
    {\skt va;sua;DEa;va k\ZH{-12}{u}+:f\ZH{-12}{u};m1ba;k+:m,a}
    
    \end{document}
    
  7. And finally the output should look like this: enter image description here

The font quality is not great as mentioned by Ulrike Fischer in one of the comments to my original question. So you might be well off adding a high-resolution image instead. But if someone wants to add more text, this could be a possible way.

2
  • 3
    I'm a women, not a man. May 14, 2020 at 12:54
  • 3
    I deeply apologize for this! It's updated now.
    – ki-ang
    May 14, 2020 at 14:02
1

If you can use either XeLaTeX or LuaLaTeX instead of PDFLaTeX, you could enter Devanagari in Unicode, with either babel or polyglossia.

Otherwise, if you just need to insert a single short passage, you could compile it to a stand-alone PDF and include that.

If you first compile this file in XeLaTeX or a version of LuaLaTeX that supports HarfBuzz:

%% This document requires LuaLaTeX 1.12.0 or higher, or XeLaTeX.
\tracinglostchars=2 % Warn if the current font lacks a character.
\documentclass{standalone}
\usepackage{polyglossia}

\ifLuaTeX
  \defaultfontfeatures{ Scale=MatchUppercase, Renderer=HarfBuzz }
\else
  \defaultfontfeatures{Scale=MatchUppercase}
\fi

\setdefaultlanguage{sanskrit}
\newfontfamily\sanskritfont{Shobhika}[
  Script = Devanagari,
  Language = Sanskrit]

\begin{document}
वसुधैव कुटुम्बकम्
\end{document}

You get the following PDF as output:

Vasudhaiva

Save this as vasudhaiva.pdf, and you can now make a new PDF that complies with PDFLaTeX:

\documentclass{article}
\usepackage[paperwidth=10cm,
            paperheight=3cm]{geometry} % Solely to format the MWE for TeX.SX.
\usepackage{cmap} % For copying from PDF.
\usepackage{graphicx} % For \includegraphics
\usepackage{lmodern} % Or your font of choice.

\newlength{\Hheight}

\newcommand\vasudhaiva{%
\settoheight{\Hheight}{H}% Not quite enough, because of ascenders.
\includegraphics[height=1.25\Hheight]{vasudhaiva.pdf}}

\begin{document}
\textit{Vasudhaiva Kutumbakam}
(\vasudhaiva)
is Sanskrit for, “The World is one family.”\footnote{Footnote size: \vasudhaiva.}

\end{document}

Vasudhaiva

You can use any OpenType font that supports Devanagari, it will be scalable, and you can even copy and paste the text from the PDF.

Since this is a single image, you do not get any line breaking. If you’re willing to put up with more of a headache to be able to word-wrap, you could create PDF files for each individual word and include each of them, separated by \ . If you do this, you might want to throw in a \vphantom{सुधै} to ensure that the PDF files have the same height and depth.

You must log in to answer this question.

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