I am trying to prepare a small document in Sanskrit language. The text that I am trying to type are very well available with my Windows 8 OS and I could type them fairly well.

However, my requirement is that I am preparing this document as a guide to read and as well as pronounce correctly. The pronunciation symbols followed are as ancient as the language and are similar to the IPA.

To put all my need in English, assume I want to type something like this:

Sample text

The numbers, alphabets, symbols that is seen in the first line with small font size are phonetic guide and the text "Sample" in the second line is the actual text.

I have no problem in typing the second line. But it is time consuming for me to type and place the characters in the first line using text box as this is the only way I figured to achieve the result. As it can been seen this is very tedious and more importantly all those efforts goes waste if the second line is edited.

So, my question: Is there any easy way for me accomplish the above at the same time allow me to edit the text in both lines?


A sample (and actual) text that I am trying to type is: Real Sanskrit sample The second line is a word that has to be hymned with specified octave on first, last but one and last alphabet. The octave is mentioned as numerals in the first line (reading 1, 0 and 3 from left to right). 0th octave is the highest not silence ;)

I am not expecting the word processor to do any automation nor I do not want any macro support as well. After posting this question I stumbled on field code for equation and it would be easy if I can do something like with equation editor by invoking it with field code { EQ \f(1,S) }.

The sample text typed as equation fraction field:

Equation fraction field

results in:

Field output

The disadvantages are:

  1. No kerning.
  2. Line between numerator and denominator - can't be removed.
  3. Equal size of font for both parts of fraction.

I guess there is no easy way. Does other publishing tools like Pagemaker does have any tricks on its sleeve?

  • A small improvement to the equation method: instead of frac, there is a structure with two fields without the fraction line: you can find it in the Parentesis menu. – Pincopallino Mar 2 '13 at 8:44

You're doing it completely wrong. Fractions are exactly for what they're named: showing fractions, with a line in between at the baseline

I guess there is no easy way. Does other publishing tools like Pagemaker does have any tricks on its sleeve?

There are ways to achieve that in any decent editing tools, for example MS Office, Libre Office, Hancom Office... and of course even TeX. In fact you'd find the answer immediately if you've googled something like "MS Word phonetic guide"

Even html supports it with the <ruby> tag and CSS also has the Ruby Styling Module. The tag is meant for Ruby character which are commonly used in East Asian texts for phonetic guides but of course it can be used for any languages. The linked wikipedia article also uses <ruby> tag (just look at the page source) so you can see the examples clearly in your browser

The ruby characters appears above the base word, and can be adjust to lie on top of a single letter or a group of letters easily. Unfortunately superuser's simple html doesn't support ruby tag, but many other language stackexchange communities like Japanese have special ways to write it in markdown as explained here

To add it in MS Word just select the text to add ruby and click "Phonetic guide" in the Home/Font group

MS Word phonetic guide

The feature is generally available for East Asian languages, so if it doesn't appear on your ribbon then just right click on the ribbon > Customize the Ribbon... and add the "Phonetic guide" button to the Home > Font group, or you can add one East Asian language to the preferences list

Phonetic guide customization

The ruby text is also represented as an equation field code. If you press Alt+F9 or go to Preferences > View and check Show > "Field code" (or right click on the annotated text > Toogle Field Codes) you'll see it's encoded as something like

EQ \* jc2 \* "Font:Yu Mincho" \* hps48 \o\ad(\s\up 47(Tōkyō),東京)

Here jc is the ruby style, for example jc5 is a vertical ruby text, hps is the font size of the ruby text (48pt in this case) and 47 after \up is the distance to move above. However most of the parameters are optional except the vertical distance. So the minimum you can have is like this

EQ \o\ad(\s\up 20(ruby text),main text)

Just press Ctrl+F9, paste the code, adjust the distance and then Alt+F9

It's also possible to add ruby text automatically using VBA but probably you're not interested in it anyway

See also

  • 1
    Great answer. Phonetic guide was something which I was not totally aware of! Thanks. I found two gems with this questions. The phonetic guide which makes my edit in MSWord very easy and the Tex. Both have its own advantage and disadvantages - need to explore more. Since the Word is much user friendly way to edit, I thought it is appropriate to switch this as an accepted answer. – Narayanan Nov 21 '19 at 6:31
  • Thanks @phuclv, I have one more issue regarding the Ruby text which I have asked as a separate question: superuser.com/questions/1596969/… Please answer that question if you can. – Narayanan Oct 24 '20 at 10:53

You could potentially use a table with the column width set to autosize. Put one character in each column. Not sure you can make it work, and still tedious, though less so.

Otherwise you'd need some sort of tool that could read the font metrics of the second line and space the first line accordingly. I have no idea how you'd go about this, though. Likely some external process would be more likely to succeed than doing it inside Word.

  • +1 Had if I had not found the equation field code, I would have certainly adopted your idea. – Narayanan Mar 1 '13 at 15:07
  • Word already has built-in features to do that. No need for any external processes – phuclv Nov 20 '19 at 3:36

Seems like you have a solution but in case you find it easier you could try creating a number of tabs in Word (probably centre tabs) at intervals suitable to your larger font (and if you wish adjust the spacing per letter):

enter image description here

(which looks like this on screen with tabs etc. visible)

enter image description here

To make life easier you can select the area of the document you are working in and Use Paragraph/Tabs to remove the existing tabs and set default tabs to a centre tabs at a suitable interval for your font size - 0.7cm maybe - and then just type away but with a tab betweeb each letter.


So far as I know this works for any inline content in MS Word based on the measure of width used by the software including words or whole sentences including punctuation and symbols, ligatures, arbitrary condensation and overlaps, equations and images. Obviously there has to be enough space between tabs to fit the content.

I don't have direct knowledge of whether there are specific issues with Sanskrit fonts to overcome.

For example (apologies if I have butchered the Sanksrit that I googled!):

Sanskrit on tabs

The biggest challenge is getting it into other programmes that don't have Word's sophisticated type setting. You can save it as PDF and copy out as a bitmap (which is how I got it into this post) but vector-based files such as WMF and EMF formats lack the type-setting capability to render it properly. It should print OK though

Indeed you can take this a long way:

'Assorted content examples

For example, sentences, images, equations, and spacing-shifted characters (the actual text is [g˜] but the space between the g and the tilde has been kerned away.

As I said, perhaps it is messing up Sanskrit in some way I don't understand but basically anything Word can produce inline it can centre over a tab.

  • 1
    Thanks, this approach will work only for English or similar languages where each keystroke maps to one ligature and kerning is ignored. In the case of Sanskrit which is what I am aiming to compose in, both are important. – Narayanan Oct 28 '19 at 9:40
  • OK - though so far as I understand it this will work for any inline content based on Word's calculation of length whatever that might be. Perhaps there is something more I don't appreciate (see modified answer) – Duke Bouvier Oct 28 '19 at 13:26

Try this method if it works for you.

  1. Type the second line text in the word.
  2. Find and Replace by using Wild card and insert a "tab" between each character
  3. Copy the text.
  4. Open the Excel
  5. In sheet 1, paste it into alternate rows from row 2
  6. In sheet 2 - create a list of mapping of each characters (hope each text character has only one mapping)
  7. In sheet 1, row 1 - use the VLOOKUP function to display the actual text above. Copy the same formula for other alternate rows
  8. Format the sheet 1 as closely as possible.

Let me know if it not meets your requirement.

  • Hi, as discussed it is possible to do it in InDesign easily. Type your text as superscript and the position of superscript can easily be changed by adjusting the kerning settings in InDesign. – AK Sivakumar Aug 8 '17 at 8:51
  • even in InDesign you're doing it wrong by adjusting kerning settings. You need to use add ruby to text – phuclv Nov 20 '19 at 3:19

I find the answer of @phuclv very useful. But the result would be center-aligned. A few tweak in the field codes can change that :

{ EQ \a \al \co1 (ruby text,field text) }

\a to create an array, \al for left-centering, \co1 to make one-column array

This field code could also allow you to add multiples lines


Please describe your purpose better. Do you want that, when you write the second line, the first line is written automatically? I mean, over every "S" charactare place a "1", over every "a" place a "#" and so on? Or what you want is a way to have the phonetic symbols placed over the other characters with the correct spacing?

The first case requires programming an ad hoc macro using Visual Basic for Office, and could be very time consuming and requires programming skills.

The second can be achieved without the textbox by defining two styles, one style A for the phonetics and one style B for the text. The key is to play with the letter spacing of the two styles to achieve a 1:1 correspondence (the setting is found in the Character dialog, in the advanced tab) You can then create a table with invisible borders and apply the two styles alternately to the rows.

You can also consider using a more professional typesetting system such as LaTeX (free and opensource). I don't know if it supports Sanskrit and how you can achieve your purpose, but you can ask for help in the TeX Stackexchange group

  • LaTeX and Sanskrit is going to be difficult but should be easier with XeTeX. – slhck Mar 1 '13 at 13:46
  • I will give a go for LaTex. So far I know this is an equation of math editor and never thought about documents :) – Narayanan Mar 1 '13 at 15:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.