I am currently translating a book and typesetting the translation.
For reviewing purposes, I would find it very useful to display the original and translated texts side-by-side, without having to duplicate the text I have for the typesetted translation. My translation is stored in a chapters/
directory, one file per chapter, beginning with a \chapter
command, and containing several \section*
commands each.
My idea would be to have a chapters_orig/
directory with the chapters in the original language, and then automatically generate a document that contains the two languages side-by-side, paragraph by paragraph.
I have read about the parallel
package but I don't see how I could use it to automatically generate this document without altering my current document.
Note:
Although I've answered my question with a bash script, I'm still interested in a TeX-based solution, and I would be happy to make it a package.
Best Answer
I think
parallel
is the best way to go, but doing it the way I want to is a bit tricky in pure TeX. After much thinking, I ended up writing a bash script to do it. It's not the most elegant solution (you can call it ugly if that makes you feel better), but it does the trick.Here is my script:
I've moved my translated text to
chapters/fr/
and added original chapters inchapters/en/
. The script creates asplits/fr/
andsplits/en/
directories (for the note,splits/
has got an 's' because I've got a rule called "split" in my Makefile), splits the chapters inchapters/*
by paragraph (usingcsplit
) and reassembles the chapters insplits/
, using theparallel
package.The master document then contains the call to load the
parallel
package, as well as the\input
calls:Running
./split.sh
followed bypdflatex masterdoc.tex
generates the document with split chapters.And here is how it renders: