Update: A solution has been worked out here: String comparison in \ifthenelse

Another way of reusing text could be done with the extract package as mentioned here.

I am working on the translation of an ancient Indian/Tibetan text (written in stanzas) and a commentary (written in prose) to it. I'd like to put the stanzas of the root text (original language plus my Translation) in a seperate file. Then I want to reuse that in different other texts: a translation of the root text alone, a translation of the commentary with the quoted root stanzas inserted and so on.

I think this would be something for XML, but this seems to complex for me ... so I'd like to do it with latex.

my root.tex would be something like a database:

record 1: stanza-nr, original, germantranslation, anothertranslation

record 2: stanza-nr, original, germantranslation, anothertranslation ....

In my publication.tex I'd then use a macro command such as \insertroot[g]{stanza-nr} that would fetch the data from the root.tex. (the optionial parameter would help me to just insert what I want, the german Translation, the original, both ...)

I started to do it the easy way: I define a \newcommand{stanzaxxx}{} for each stanza in the root.tex (with xxx being the no. of the stanza in letters, since Latex won't accept numbers in commands). I make those macros availabe via \input{root} in the publication.tex and insert the macros \stanzanoxxx at the proper places. This means I will have to create a new command for each stanza (there are about 1.000 in the text).

I think there should be a more intelligent solution - I thought maybe even Bibtex could be tweaked for that purpose?

Any suggestions are most welcome.

This is how I do it now:

Part of root.tex - each stanza has its own command (a means 0, b means 1 etc.):

 \newcommand{\abaab}{1. Mich respektvoll verneigend vor den
  Sugatas, vor dem Körper der Wahrheit, den sie besitzen,
  sowie vor ihren Kindern und ebenso vor allen, die der
  Verehrung wert sind, will ich die Ausübung der Disziplin
  der Sugata-Kinder entsprechend den Schriften in
  zusammengefasster Form darlegen.}

\newcommand{\abaac}{2. Etwas, das es zuvor noch nicht
  gegeben hat, habe auch ich hier nicht zu sagen; und ich
  besitze nicht die Kunstfertigkeit in der Komposition von
  Schriften: Deshalb habe ich auch keine Absicht, anderen zu
  nutzen; vielmehr schreibe ich dieses, um meinen eigenen
  Geist daran zu gewöhnen.}

\newcommand{\abaad}{3. Aufgrund der Gewöhnung an das
  Heilsame mag die Kraft meines Vertrauens durch diese
  [Kontemplationen] zeitweilig anwachsen; und wenn andere,
  die mir in ihren Veranlagungen ähnlich sind, diese sehen,
  so mag es auch für sie von Bedeutung sein.}

Part of the commentary.tex - in this example stanza 001 of chapter 01 is inserted via the correspoding macro command:

Der Autor verneigt sich respektvoll mit den drei Toren [Körper, Rede und Geist] vor den
Objekten der Verehrung. Zunächst verneigt er sich vor den Drei Juwelen: ... etc. etc.

Part of the publication.tex of just the root stanzas:

\chapter*{Eintritt in das Leben zur Erleuchtung}
\section*{1. Die Vorzüge des Erleuchtungsgeistes}   
\abaab{} \par
\abaac{} \par
\abaad{} \par
\abaae{} \par

Advantage is, if I correct a translation in root.tex, it will automatically effect the quotations in all the other publication files.

What I'd like would be something like this:

Each record would be for one stanza (no, original, Translation):

{1}{bde shegs chos kyi sku ...}{Vor den Sugatas, ihrem Dharmakaya ...}
{2}{sngon chad ma byung ba ...}{Etwas, was bisher noch nicht gesagt ...}


When printing the stanza I would like to retrieve the data via a macro such as \stanza{1}, which would tell Latex to retrieve the translation of stanza 1, for example. Something like that. It would save me from having to define a seperate command for each stanza.

  • I am not sure I completely understand your setup or the purpose of root.tex. For example, you seem to have two records with the same first item so what is the key? And how do the second, ... translations of a stanza fit into things? You only mention one translation in the description. It would be helpful to see a Minimal Working Example showing the way you've started to set things up with the first couple of what would be your 1,000 commands as I think that would do a lot to clarify what you actually want to do. – cfr Feb 19 '14 at 23:09
  • Sorry for being confusing ... ;-) I added some more Information in my original post. – Christof Feb 19 '14 at 23:49
  • 1
    Have you looked at any of the packages designed to support the production of critical editions (e.g. ctan.org/pkg/eledmac or ctan.org/pkg/poemscol) or maybe a package designed to support glossary creation (e.g. mirror.ox.ac.uk/sites/ctan.org/macros/latex/contrib/glossaries/…)? I'm wondering if you could set up a glossary with entry keys such as orig1, orig2, trans1, trans2, comm1, comm2 etc., with the text in description and then define \stanza[all]{2}, say, to print the relevant entries. (Or something like that.) – cfr Feb 20 '14 at 0:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.