6

I've got my file set up to create an interlinear two-language text (for this example using Russian). I created it using various code-snippets from this very same site.

The problem is that the interlinear texts already discussed here all deal with situations where entire sentences or paragraphs are interlinear, like my current code.

But what I want to do is have the primary language and then simply designate a word/s for interlinear glossing (i.e a gloss for a single word in a sentence rather than the whole sentence itself).

In this image I gloss every word except one.

Almost full gloss

\newenvironment{interlinear}%
{\begin{russian} \begingl}%
{\endgl \end{russian}}%

\begin{document}
\begin{interlinear}

\gla Now {\hspace{0em}} {the possibility} {to print} simple documents 
with English and Russian. //
\glb Теперь есть возможность печатать простые документы с английскими и 
русскими.//

\end{interlinear}
\end{document}

As you can see I can use h-space to leave a word blank. But I want to leave most blank, like this:

Small gloss

\gla {\hspace{0em}} {\hspace{0em}} {\hspace{0em}} {to print} 
{\hspace{0em}} {\hspace{0em}} with {\hspace{0em}} {\hspace{0em}} 
{\hspace{0em}}. //
\glb Теперь есть возможность печатать простые документы с английскими и русскими.//

The thing is that even if I'm not using h-space effectively, obviously this doesn't seem to be an efficient or appropriate method.

So is there a way to do something like "Это простой{^simple} Русский язык" and then get the English gloss for that single word?

Edit: the packages I'm using:

\documentclass[draft, a4paper]{article}
\usepackage{polyglossia}
\setdefaultlanguage{russian}
\setotherlanguage{english}
\newfontfamily\russianfont[Script=Cyrillic]{Lava Pro Reg}
\newfontfamily\englishfont{Equity Text B}
\usepackage{expex}
5

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.

enter image description here

\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}
...

enter image description here

  • Thanks. I had a fight with the encoding for Cyrillic but I got it working now. – greglo Apr 9 '17 at 9:48
  • Tables are very versatile apparently :). – Dr. Manuel Kuehner Apr 9 '17 at 10:21
  • 1
    @greglo That's the punishment for not showing us a complete document. You spared this part of the preamble so I had to guess it. – gernot Apr 9 '17 at 11:47
  • 1
    @Dr.ManuelKuehner Yes, even the plain ones. Maybe the next useful thing after being able to typeset sentences. – gernot Apr 9 '17 at 11:50
  • 1
    Linguistics packages are better suited for this, since they will break lines automatically but still maintain the glosses. – Alan Munn Apr 9 '17 at 16:42
4

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}

output of code

  • Oh thanks, I see I didn't need h-space. – greglo Apr 10 '17 at 3:57

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.