Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am writing a document on a foreigh language, say French, and want to put some paragraphs in French with their translation in English. But I would like to print one line in French, the corresponding line in English, one line in French, the corresponding line in English, and so on.

For example, if I have these two paragraphs:

On ne connaît que les choses que l'on apprivoise, dit le renard. Les hommes n'ont plus le temps de rien connaître. Ils achètent des choses toutes faites chez les marchands. Mais comme il n'existe point de marchands d'amis, les hommes n'ont plus d'amis. Si tu veux un ami, apprivoise-moi!

We only know the things that we tame, said the fox. People no longer have the time to know anything. They buy things already made for peddlers. But since there are no peddlers of friends, they no longer have friends. If you want a friend, tame me!

I would like them to be automatically printed like this, providing interlinear translation:

On ne connaît que les choses que l'on apprivoise, dit le renard. Les hommes n'ont plus 
We only know the things that we tame, said the fox. People no longer have 

le temps de rien connaître. Ils achètent des choses toutes faites chez les marchands.
the time to know anything. They buy things already made for peddlers. 

Mais comme il n'existe point de marchands d'amis, les hommes n'ont plus d'amis. 
But since there are no peddlers of friends, they no longer have friends. 

Si tu veux un ami, apprivoise-moi!
If you want a friend, tame me! 

So, I am looking for a way to mix both paragraphs, eventually with a way to provide sync information to tell latex which parts have to be kept together. Ideally I would like this to be processed automatically in such a way that a modification of the layout of the page or the size of the font should not oblige me to reformat the text by myself.

share|improve this question
1  
To clarify: you want to input the two paragraphs one after the other and you want the paragraphs themselves to sync, but not necessarily individual sentences. Am I right? –  Loop Space Aug 13 '10 at 8:56
    
I bet this would be close to impossible without human intervention. –  Leo Liu Aug 13 '10 at 9:42
    
@Andrew: yes, you perfectly get the problem. –  Caroline Fontaine Aug 13 '10 at 12:24
    
For the sake of people searching, one name for this arrangement is "interlinear translation". My comment doesn't seem to appear in search results, so perhaps you could add the phrase to your question. –  Novelocrat Aug 13 '10 at 13:12
    
@Novelocrat: done. –  Caroline Fontaine Aug 13 '10 at 13:43

2 Answers 2

up vote 12 down vote accepted

Partitions similar to these, but with even higher degrees of syncing, are common in linguistics. At http://www.essex.ac.uk/linguistics/external/clmt/latex4ling/ most LaTeX resources for linguistics have been gathered. Specifically your synched texts are similar to what's called glosses in linguistics; and these can be handled by cgloss4e.sty. See http://www.essex.ac.uk/linguistics/external/clmt/latex4ling/examples/ for more details.

share|improve this answer
1  
If you haven't already, you should add that to the list of resources in the relevant question. I can think of several uses for that sort of thing and I'm not a linguist! –  Loop Space Aug 13 '10 at 11:11
    
I agree with Andrew, very nice link! –  Caroline Fontaine Aug 13 '10 at 14:13

Intriguing idea. Here's a proof of concept:

\documentclass{article}
\usepackage{setspace}

\newlength{\syncheight}
\newcommand{\sync}[2]{%
\setlength{\syncheight}{\baselineskip}
\begin{spacing}{3}
\setlength{\parindent}{0pt}

\begin{minipage}[t][0pt][t]{\textwidth}
#1
\end{minipage}

\vspace{-2\syncheight}
#2
\end{spacing}
}

\begin{document}

The following paragraph is in both English and French.
That is to say, there are two paragraphs, one is in French and one in English,
and each is a translation of the other.

\sync{%
On ne connaît que les choses que l'on apprivoise, dit le renard. Les hommes
n'ont plus le temps de rien connaître. Ils achètent des choses toutes faites
chez les marchands.  Mais comme il n'existe point de marchands d'amis, les
hommes n'ont plus d'amis. Si tu veux un ami, apprivoise-moi!
}{%
We only know the things that we tame, said the fox. People no longer have
the time to know anything. They buy things already made for peddlers. But
since there are no peddlers of friends, they no longer have friends. If you
want a friend, tame me!
}

The preceeding paragraph is in both English and French.
That is to say, there are two paragraphs, one is in French and one in English,
and each is a translation of the other.

\end{document}

Problems with this implementation:

  1. Excessive whitespace before and after the translated paragraph (maybe that's actually a good thing!). Probably not too hard to overcome.

  2. If the French paragraph is longer than the English one then the extra line(s) will cause problems with spacing the following text. Not sure on this one; easy enough if it's possible to measure the height of a paragraph and to compare two lengths.

  3. It won't flow correctly across a page boundary: the French one will simply continue down the old page whilst the English one will correctly go over. This could be tricky.

(I used a similar trick long ago doing booklets that needed marginal comments a bit beyond what \marginpar seemed capable of. I took my inspiration from a remark in the Not So Short Guide when talking about the width of parboxes and the like: "In a demented case you can even set the width to 0pt so that the text inside the box will be typeset without influencing the surrounding boxes." to which I added: "Of course, if you're really certifiable you can do the same with the height.")

share|improve this answer
    
I think the difficult part is having the French and English break lines at the same meaningful place. –  Leo Liu Aug 13 '10 at 10:37
    
What version of setspace are you using? I'm on 6.7 (TexLive) and it fails miserably with "! LaTeX Error: Environment spacing undefined." BTW, this is something I've been looking for for donkeys years... –  Brent.Longborough Aug 13 '10 at 10:58
    
@Leo: that's the kind of clarification that I hoped to get in answer to my comment to the question. (I should say that I was fairly sure there'd be a package, but it intrigued me so I had a go). @Brent.Longborough: 6.7, same as you. The 'spacing' environment is defined on line 496. –  Loop Space Aug 13 '10 at 11:06
    
thanks for you efforts ^^ I would like to accept both answers! –  Caroline Fontaine Aug 13 '10 at 14:15
    
@Caroline Fontaine: as there's a package (and more) for this, you should definitely go for that rather than a hack like mine! I put in these hacks just in case there isn't a package. So you accepted the right answer. –  Loop Space Aug 13 '10 at 14:43

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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