I am interested in writing Devanagari text in LaTeX file, to transliterate into, and make it appear in, IAST scheme.e.g.I want to write
\iast{रामोराजमणिसदाविजयतेरामंरमेशंभजे}
and it should appear like
rāmo rājamaṇi sadā vijayate rāmaṃ rameśaṃ bhaje
.
A valid solution is presented in this answer, but the provided DevRom map does not produce standard IAST transliteration.
e.g. रामोराजमणिसदाविजयतेरामंरमेशंभजे
should go torāmo rājamaṇi sadā vijayate rāmaṃ rameśaṃ bhaje
.
But instead it goes to RāMo RāJMṆi SDā ViJYte RāMṃ RMeŚṃ BhJe/
(which transliterates back to रामोराज्म्णिस्दाविज्य्तेराम्ंर्मेश्ंभ्जे/
, clearly incorrect).
As I understand, IAST to Devanagari is one-to-one mapping. I also found this iast.map, which can transliterate from IAST to Devanagari. What I am trying to do is obtain the reverse of this mapping, for Devanagari to IAST. While the original answer mentions it to be as simple as swapping the input and output alphabet, there are certain lines in the iast.map
that I don't understand (and don't think are reversible).
Thus, could someone either tell me how to reverse the mapping properly, or provide a reversed mapping, or provide a mapping for Devanagari-to-IAST that is reversible?
Thank you.
Solution
I've put together the file provided in the answer and stripped off unnecessary components. Sample LaTeX file and map file can be found at the gist: https://gist.github.com/hrishikeshrt/c35e1a5332a4fbcdcdf7102446d2e796