Typesetting furigana above and below original text

It seems that you can set the \rubysep parameter to a negative value to get the effect you want.

%!TEX TS-program = xelatex
\documentclass[12pt]{article}

\usepackage{xeCJK}
\usepackage{ruby}
\setCJKmainfont{Hiragino Mincho Pro}
\renewcommand{\rubysep}{-4ex}
\pagestyle{empty}
\begin{document}

On this line \ruby{学}{がく}\ruby{生}{せい}

\end{document}

enter image description here

Here's a solution which seems to allow simultaneous top and bottom furigana

%!TEX TS-program = xelatex
\documentclass[24pt]{letter}
\usepackage{xeCJK}
\usepackage{ruby}
\setCJKmainfont{Hiragino Kaku Gothic ProN}
\usepackage{setspace}
\usepackage[margin=0.2in]{geometry}
%%
\makeatletter
\newcommand{\defaultrubysep}{0.25ex}
\renewcommand{\rubysep}{\defaultrubysep}
\newcommand{\english}{}
\renewcommand{\english}{-3.2ex}
\newlength{\kanji@kana@no@nagasa}
\newcommand{\eruby}[3]{%
    %% save the current baselinestretch
    %% and reset value to "1"
    \let\oldbaselinestretch=\baselinestretch%
    \renewcommand{\baselinestretch}{1}%
    \large\normalsize%
    \ruby{#1}{#2}%
    %% reassign \rubysep to allow furigana below
    \renewcommand{\rubysep}{\english}%
    %% measure the width of the first argument
    %% move to the left by that distance
    \settowidth{\kanji@kana@no@nagasa}{#1}%
    \hspace*{\dimexpr-\kanji@kana@no@nagasa\relax}%
    \ruby{\phantom{#1}}{#3}%
    %% restore the original \rubysep and \ baselinestretch
    \renewcommand{\rubysep}{\defaultrubysep}%
    \renewcommand{\baselinestretch}{\oldbaselinestretch}
    \large\normalsize%
}
\makeatother
%%
\pagestyle{empty}
\begin{document}
%% implement double spacing
\renewcommand{\baselinestretch}{2}\large\normalsize

たんぼの \eruby{畦道}{あぜみち}{footpath}に、\eruby{タンポポ}{tanpopo}{dandelion}が 
さいて いました。あまい においの する まっき
いろな 花です。そこへ ひらひらと 白い \eruby{チョウチョ}{chocho}{butterfly}が 
あそびに きて、「タンポポさん、あなたは はろの
 ブローチね。」 と いいました。白い チョウに そう いわれると、 「ほん
とうに そう 見えて。」 と、 タンポポも うれしく なりました。今度は、ヒ
バリが あそびに きて、「タンポポさん、 あなたは のはらの おほしさまみた
い。」 といいました。ヒバリに こう いわれると、 「まあ、 おほしさまだな
んで。」 と うれしく なりました。

\begin{tabular}{rl}
    \eruby{畦道}{あぜみち}{footpath}に                    & along side a path  \\
    \eruby{タンポポ}{tanpopo}{dandelion}が さいて いました & a dandelion bloomed. 
\end{tabular}
\end{document}

This produces:

enter image description here

The idea is two first save the current \baselinestretch and then reset to 1. Then I call \ruby{...} twice, the second time using a \phantom argument and adding a negative width between the two calls to \ruby to give the appearance of two furiganas for one block of kanji or other kana.

Since ruby is scaling things vertically based upon baseline values, I think all your vertical scaling should do the same thing.


Here's a quick example which only requires mathtools and CJK fonts:

\documentclass[a4paper,10pt]{letter}
\usepackage[utf8]{inputenc}

\usepackage{CJKutf8}
\usepackage{mathtools}

\begin{document}
\begin{letter}

Show readings for each Kanji:

\begin{CJK}{UTF8}{goth} $\stackrel{\text{タ}}{\text{田}}$     
$\stackrel{\text{ナカ}}{\text{中}}$\ \ $\stackrel{\text{ハ}}{\text{一}}$         
$\stackrel{\text{ナ}}{\text{愛}}$ \end{CJK}  \\

Show readings for each word:

\begin{CJK}{UTF8}{goth} $\stackrel{\text{タナカ}}{\text{田中}}$\ \                 
$\stackrel{\text{ハナ}}{\text{一愛}}$ \end{CJK}  \\

Show readings under each word:

\begin{CJK}{UTF8}{goth} $\underset{\text{タナカ}}{\text{田中}}$\ \             
$\underset{\text{ハナ}}{\text{一愛}}$ \end{CJK}  \\

Show kuny\={o}mi above and ony\={o}mi below:

\Big

\begin{CJK}{UTF8}{goth} $\stackrel{\text{なか}}{\underset{\text{チュウ}}{\text{中}}}$ \end{CJK}  \\


Show furigana above and translation below:

\begin{CJK}{UTF8}{goth} $\stackrel{\text{ちゅうごく}}{\underset{\text{China}}{\text{中国}}}$ \end{CJK}  \\

Show romanji above and translation below:

\begin{CJK}{UTF8}{goth} $\stackrel{\text{Konbini}}{\underset{\text{Convenience Store}}{\text{コンビニ}}}$ \end{CJK}  \\

\end{letter}
\end{document}

I use TikZ to set Furigana. This command can easily be extended to set them above and below:

% !TeX program = xelatex
\documentclass{article}

\usepackage[AutoFallBack=true]{xeCJK}
% Hanazono is a free font downloaded from https://osdn.jp/projects/hanazono-font/ [02.02.2016]
\setCJKmainfont{HanaMinA}
\setCJKfallbackfamilyfont{rm}{HanaMinB}

\usepackage{tikz}

% characters with big height and depth
% to give different boxes the same vertical size
\newcommand{\vsizecorrectorhira}{\vphantom{もりぼゃ}}% epkyouka, HanaMinA
\newcommand{\vsizecorrectorkanji}{\vphantom{$\vert$}}

% commands for setting furigana below kanji
\newcommand{\furigana}[2]{% #1: kanji, #2: furigana
    %\unskip
    \begin{tikzpicture}[baseline=(kanji.base)]
        \node(kanji)[
            inner sep=0,
        ] {
            \vsizecorrectorkanji%
            #1%
        };
        \node(furigana)[
            below of=kanji,
            node distance=1em-2pt,
            inner sep=0,
        ] {%
            \tiny%
            \vsizecorrectorhira%
            #2%
        };
    \end{tikzpicture}%
    %\ignorespaces
}

\newcommand{\furiganaAboveBelow}[3]{% #1: kanji, #2: furigana above, #3: furigana below
    %\unskip
    \begin{tikzpicture}[baseline=(kanji.base)]
        \node(kanji)[
            inner sep=0,
        ] {
            \vsizecorrectorkanji%
            #1%
        };
        \node(furigana-above)[
            above of=kanji,
            node distance=1em,
            inner sep=0,
        ] {%
            \tiny%
            \vsizecorrectorhira%
            #2%
        };
        \node(furigana-below)[
            below of=kanji,
            node distance=1em-2pt,
            inner sep=0,
        ] {%
            \tiny%
            \vsizecorrectorhira%
            #3%
        };
    \end{tikzpicture}%
    %\ignorespaces
}

\begin{document}
Japanese uses different alphabets, one of those is \furigana{漢字}{かんじ} (Kanji).

Kanji can have different readings: \furiganaAboveBelow{日}{にち}{ひ}.
\end{document}

enter image description here