Interlinear text with partial translation
The command
\translate{lower word}{upper word}
will insert lower word
at the current position, with the upper word
in small print above it. The command is defined as
\newcommand\translate[2]%
{\begin{tabular}[b]{@{}c@{}}
\footnotesize #2\\
#1
\end{tabular}%
}
Modify as needed; you maybe want to abbreviate the macro name if you need it frequently.
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T2A]{fontenc}
\newcommand\translate[2]%
{\begin{tabular}[b]{@{}c@{}}
\footnotesize #2\\
#1
\end{tabular}%
}
\begin{document}
\noindent
\translate{Теперь}{Now}
есть
\translate{возможность}{possibility}
печатать
простые
\translate{документы}{documents}
с
английскими
и
\translate{русскими}{Russian}%
.
\end{document}
If you have lines without any translations and want to have the lines uniformly spaced, increase \baselineskip
.
...
\baselineskip26pt
\begin{document}
...
Perhaps I misunderstand your problem, but selective glossing is simple to do with the existing glossing packages. Here's an example using ExPex, which I think is most suited for your purposes. I've used the centred glossing settings from How to do centered interlinear text in LaTeX. To selectively gloss words you just need to use {...}
around the groups that are grouped together, and make sure that the number of groups in the source line matches the number of groups in the gloss line.
\documentclass{article}
\usepackage{expex}
% Settings from https://tex.stackexchange.com/a/224154/
\lingset{everygla=\footnotesize\sffamily, % formatting the numbers in the gla line
glwordalign=center, % center alignment within glwords
aboveglbskip=-0.4ex, % narrows the vertical gap between the gla and glb lines
glhangstyle=none, % no hanging indent
glspace=!0pt plus .2em, % widens the allowable space between glwords to avoid overfull lines
glrightskip=0pt plus .5\hsize, % widens the allowable space between the right margin and the end of the last glword on a line to avoid overfull lines
everyglb=\textrussian}
\usepackage{polyglossia}
\setmainfont{Linux Libertine O}
\setmainlanguage{english}
\setotherlanguage{russian}
\begin{document}
\exdisplay
\begingl
\gla Now {} {the possibility} {to print} simple documents with English and Russian.//
\glb Теперь есть возможность печатать простые документы с английскими и
русскими//
\endgl
\xe
\exdisplay
\begingl
\gla {} {to print} {} with {}//
\glb {Теперь есть возможность} печатать {простые документы} с {английскими и
русскими}//
\endgl
\xe
\end{document}