Hello, I have now the challenge in a book to set an interlinear translation. That is two languages word-by-word (original above translation), so the sentence structure follows the originals language, like its common in many scientific bible translations. My problem: The TABLES are not suitable, because 1. I have to determine in advance, how many words are in the row, which depens obviously on the page-width and widths of the words. 2. Its not readable and well editable, because in Context (and most other languages) one has to write the table in rows and not in columns, as I need it for interlinear translations. Example: \bTABLE \bTR \bTD word 1, language 1\eTD \bTD word 2, language 1\eTD \bTD word 3, language 1\eTD \eTR \bTR \bTD word 1, language 2\eTD \bTD word 2, language 2\eTD \bTD word 3, language 2\eTD \eTR \eTABLE So I can not make this into and simple macro \interlinear{#1}{#2}, which I could use this way: \interlinear{word 1, language 1}{word 1, language 2} \interlinear{word 2, language 1}{word 2, language 2} \interlinear{word 3, language 1}{word 3, language 2} (all three blocks in the same horizontal line, if no linebreak is needed) On top of this, the language 1 (arabic) is right-to-left (so language 2 (german) must follow), it should be compatible with right-to-left reading someway. I tried with \framed, but failed, because the framed blocks are set one under the other, not side by side. How can I achieve a nice way with this simple readable macros? Thank you. Huseyin -- Huseyin Özoguz E-Mail: h.oezoguz@mmnetz.de
On 12/3/2018 10:29 AM, Huseyin Özoguz wrote:
Hello,
I have now the challenge in a book to set an interlinear translation. That is two languages word-by-word (original above translation), so the sentence structure follows the originals language, like its common in many scientific bible translations.
My problem: The TABLES are not suitable, because
1. I have to determine in advance, how many words are in the row, which depens obviously on the page-width and widths of the words.
2. Its not readable and well editable, because in Context (and most other languages) one has to write the table in rows and not in columns, as I need it for interlinear translations.
Example:
\bTABLE \bTR \bTD word 1, language 1\eTD \bTD word 2, language 1\eTD \bTD word 3, language 1\eTD \eTR \bTR \bTD word 1, language 2\eTD \bTD word 2, language 2\eTD \bTD word 3, language 2\eTD \eTR \eTABLE
So I can not make this into and simple macro \interlinear{#1}{#2}, which I could use this way:
\interlinear{word 1, language 1}{word 1, language 2} \interlinear{word 2, language 1}{word 2, language 2} \interlinear{word 3, language 1}{word 3, language 2}
(all three blocks in the same horizontal line, if no linebreak is needed)
On top of this, the language 1 (arabic) is right-to-left (so language 2 (german) must follow), it should be compatible with right-to-left reading someway. I tried with \framed, but failed, because the framed blocks are set one under the other, not side by side. How can I achieve a nice way with this simple readable macros? Processing this might give you some ideas:
\usemodule[art-01]\setupbodyfont[dejavu,12pt] \defineruby[auto] [align=auto,color=darkred] \defineruby[left] [align=flushleft,color=darkred] \defineruby[right] [align=flushright,color=darkred] \defineruby[spread][stretch=yes] \showframe \showglyphs \showfontkerns \setupinterlinespace[22pt] \starttext \startbuffer \dorecurse{20}{\ruby{XYZ}{a|bc|d} }\par \dorecurse{20}{\ruby{PQR}{p|q|r} }\par \dorecurse{20}{\ruby{XYZ}{1|22|333} }\par \dorecurse{20}{\ruby{XYZ}{111|222|333} }\par \dorecurse{20}{\ruby{XYZ}{foobar} }\par \dorecurse{20}{\ruby{XYZ}{fooledbar} }\par \dorecurse{20}{\ruby[spread]{XYZ}{fooledbar} }\par \dorecurse{20}{\ruby{extremely}{wide} }\par \dorecurse{20}{\ruby{wide}{extremely} }\par stopbuffer \testfeatureonce{1}{\start \setupinterlinespace[16pt] \setupruby[location=none] \getbuffer \stop \page} \testfeatureonce{1}{\start \setupinterlinespace[16pt] \setupruby[location=right] \getbuffer \stop \page} \testfeatureonce{1}{\start \setupinterlinespace[28pt] \setupruby[align=auto,color=darkred] \getbuffer \stop \page} \testfeatureonce{1}{\start \setupinterlinespace[28pt] \setupruby[align=flushleft,color=darkgreen] \getbuffer \stop \page} \testfeatureonce{1}{\start \setupinterlinespace[28pt] \setupruby[align=flushright,color=darkblue] \getbuffer \stop \page} \testfeatureonce{1}{\start \setupinterlinespace[28pt] \setupruby[align=middle,color=darkyellow] \getbuffer \stop \page} \stoptext -- ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
Thank you, I will investigate it, seems to be a pretty powerful mechanism. First it failed to compile (with Context version from 2015, did not know \defineruby), but with the most recent beta it does well. So a small btw-question, I compile out of notepad++ (windows 7, 64 bit) with this code: cd $(CURRENT_DIRECTORY) context $(CURRENT_DIRECTORY)\main.tex --synctex=1 taskkill \im SumatraPDF.exe C:\Users\Huseyin\sumatra.bat "$(CURRENT_DIRECTORY)\main.pdf" This always uses the default context-version, which path' is saved the environment-variables of windows. How can I switch (and control) between different context-versions or pathes for compiling without changing the environment variables in Win (and after that I have to restart)? I tried to write the path directly into the command above, but did not work. Thanks and I may have questions to the actual question about interlinear typesetting later, will try to define some nice macros with arabic-german interlinear texts. Huseyin Huseyin Özoguz E-Mail: h.oezoguz@mmnetz.de Am 03.12.2018 um 11:17 schrieb Hans Hagen:
On 12/3/2018 10:29 AM, Huseyin Özoguz wrote:
Hello,
I have now the challenge in a book to set an interlinear translation. That is two languages word-by-word (original above translation), so the sentence structure follows the originals language, like its common in many scientific bible translations.
My problem: The TABLES are not suitable, because
1. I have to determine in advance, how many words are in the row, which depens obviously on the page-width and widths of the words.
2. Its not readable and well editable, because in Context (and most other languages) one has to write the table in rows and not in columns, as I need it for interlinear translations.
Example:
\bTABLE \bTR \bTD word 1, language 1\eTD \bTD word 2, language 1\eTD \bTD word 3, language 1\eTD \eTR \bTR \bTD word 1, language 2\eTD \bTD word 2, language 2\eTD \bTD word 3, language 2\eTD \eTR \eTABLE
So I can not make this into and simple macro \interlinear{#1}{#2}, which I could use this way:
\interlinear{word 1, language 1}{word 1, language 2} \interlinear{word 2, language 1}{word 2, language 2} \interlinear{word 3, language 1}{word 3, language 2}
(all three blocks in the same horizontal line, if no linebreak is needed)
On top of this, the language 1 (arabic) is right-to-left (so language 2 (german) must follow), it should be compatible with right-to-left reading someway. I tried with \framed, but failed, because the framed blocks are set one under the other, not side by side. How can I achieve a nice way with this simple readable macros? Processing this might give you some ideas:
\usemodule[art-01]\setupbodyfont[dejavu,12pt]
\defineruby[auto] [align=auto,color=darkred] \defineruby[left] [align=flushleft,color=darkred] \defineruby[right] [align=flushright,color=darkred] \defineruby[spread][stretch=yes]
\showframe \showglyphs \showfontkerns \setupinterlinespace[22pt]
\starttext
\startbuffer \dorecurse{20}{\ruby{XYZ}{a|bc|d} }\par \dorecurse{20}{\ruby{PQR}{p|q|r} }\par \dorecurse{20}{\ruby{XYZ}{1|22|333} }\par \dorecurse{20}{\ruby{XYZ}{111|222|333} }\par \dorecurse{20}{\ruby{XYZ}{foobar} }\par \dorecurse{20}{\ruby{XYZ}{fooledbar} }\par \dorecurse{20}{\ruby[spread]{XYZ}{fooledbar} }\par \dorecurse{20}{\ruby{extremely}{wide} }\par \dorecurse{20}{\ruby{wide}{extremely} }\par stopbuffer
\testfeatureonce{1}{\start \setupinterlinespace[16pt] \setupruby[location=none] \getbuffer \stop \page} \testfeatureonce{1}{\start \setupinterlinespace[16pt] \setupruby[location=right] \getbuffer \stop \page} \testfeatureonce{1}{\start \setupinterlinespace[28pt] \setupruby[align=auto,color=darkred] \getbuffer \stop \page} \testfeatureonce{1}{\start \setupinterlinespace[28pt] \setupruby[align=flushleft,color=darkgreen] \getbuffer \stop \page} \testfeatureonce{1}{\start \setupinterlinespace[28pt] \setupruby[align=flushright,color=darkblue] \getbuffer \stop \page} \testfeatureonce{1}{\start \setupinterlinespace[28pt] \setupruby[align=middle,color=darkyellow] \getbuffer \stop \page}
\stoptext
On 12/3/2018 12:51 PM, Huseyin Özoguz wrote:
Thank you, I will investigate it, seems to be a pretty powerful mechanism. First it failed to compile (with Context version from 2015, did not know \defineruby), but with the most recent beta it does well.
So a small btw-question, I compile out of notepad++ (windows 7, 64 bit) with this code:
cd $(CURRENT_DIRECTORY) context $(CURRENT_DIRECTORY)\main.tex --synctex=1 taskkill \im SumatraPDF.exe C:\Users\Huseyin\sumatra.bat "$(CURRENT_DIRECTORY)\main.pdf"
there is no need to kill sumatra, just add --autopdf to the context call also --synctex is replaced by \setupsynctex[state=start]
This always uses the default context-version, which path' is saved the environment-variables of windows. How can I switch (and control) between different context-versions or pathes for compiling without changing the environment variables in Win (and after that I have to restart)? I tried to write the path directly into the command above, but did not work.
maybe this works out ok: mtxrun --tree=c:/data/mytex --script context --autopdf ..
Thanks and I may have questions to the actual question about interlinear typesetting later, will try to define some nice macros with arabic-german interlinear texts.
Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
there is no need to kill sumatra, just add --autopdf to the context call
also --synctex is replaced by
Thank you, perfect
maybe this works out ok:
mtxrun --tree=c:/data/mytex --script context --autopdf ..
I does indeed. Thanks. Huseyin Özoguz E-Mail: h.oezoguz@mmnetz.de Am 03.12.2018 um 13:24 schrieb Hans Hagen:
On 12/3/2018 12:51 PM, Huseyin Özoguz wrote:
Thank you, I will investigate it, seems to be a pretty powerful mechanism. First it failed to compile (with Context version from 2015, did not know \defineruby), but with the most recent beta it does well.
So a small btw-question, I compile out of notepad++ (windows 7, 64 bit) with this code:
cd $(CURRENT_DIRECTORY) context $(CURRENT_DIRECTORY)\main.tex --synctex=1 taskkill \im SumatraPDF.exe C:\Users\Huseyin\sumatra.bat "$(CURRENT_DIRECTORY)\main.pdf"
there is no need to kill sumatra, just add --autopdf to the context call
also --synctex is replaced by
\setupsynctex[state=start]
This always uses the default context-version, which path' is saved the environment-variables of windows. How can I switch (and control) between different context-versions or pathes for compiling without changing the environment variables in Win (and after that I have to restart)? I tried to write the path directly into the command above, but did not work.
maybe this works out ok:
mtxrun --tree=c:/data/mytex --script context --autopdf ..
Thanks and I may have questions to the actual question about interlinear typesetting later, will try to define some nice macros with arabic-german interlinear texts.
Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
Huseyin Özoguz schrieb am 03.12.18 um 12:51:
Thanks and I may have questions to the actual question about interlinear typesetting later, will try to define some nice macros with arabic-german interlinear texts.
Before you write your own commands try to use what is available. If there is something missing existing commands can be extended and Hans is in many cases open to add new function to ConTeXt. \usemodule [database] % Source for the sample text: % https://interlinearbooks.com/blog/german-interlinear-translation-of-franz-ka... \startbuffer[sample] "Als","As" "Gregor","Gregor" "Samsa","Samsa" "eines","one" "Morgens","morning" "aus","from" "unruhigen","uneasy" "Träumen","dreams" "erwachte,","woke up," "fand","found" "er","he" "sich","himself" "in","in" "seinem","his" "Bett","bed" "zu","in" "einem","an" "ungeheuren","enormous" "Ungeziefer","kind of monstrous vermin" "verwandelt.","transformed." \stopbuffer \define[2]\InterlinearText {\ruby{#1}{#2} } \definedatabase [interlineartext] [quotechar={"}, command=\InterlinearText] \setupinterlinespace[line=6ex] \setupruby[voffset=-2.5ex] \starttext \processdatabasebuffer[interlineartext][sample] \stoptext Wolfgang
where can i find the description and features of the \ruby and \defineruby commands? .F
On 3 Dec 2018, at 13:36, Wolfgang Schuster
wrote: Huseyin Özoguz schrieb am 03.12.18 um 12:51:
Thanks and I may have questions to the actual question about interlinear typesetting later, will try to define some nice macros with arabic-german interlinear texts.
Before you write your own commands try to use what is available.
If there is something missing existing commands can be extended and Hans is in many cases open to add new function to ConTeXt.
\usemodule [database]
% Source for the sample text: % https://interlinearbooks.com/blog/german-interlinear-translation-of-franz-ka...
\startbuffer[sample] "Als","As" "Gregor","Gregor" "Samsa","Samsa" "eines","one" "Morgens","morning" "aus","from" "unruhigen","uneasy" "Träumen","dreams" "erwachte,","woke up," "fand","found" "er","he" "sich","himself" "in","in" "seinem","his" "Bett","bed" "zu","in" "einem","an" "ungeheuren","enormous" "Ungeziefer","kind of monstrous vermin" "verwandelt.","transformed." \stopbuffer
\define[2]\InterlinearText {\ruby{#1}{#2} }
\definedatabase [interlineartext] [quotechar={"}, command=\InterlinearText]
\setupinterlinespace[line=6ex]
\setupruby[voffset=-2.5ex]
\starttext \processdatabasebuffer[interlineartext][sample] \stoptext
Wolfgang
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________
Before you write your own commands try to use what is available.
Right, but in many cases I am just not aware of what is available, to be honest, though I quite often use the wikigarden. I tried to change your example into arabic-german, seems to work, except only the first translation-pair is shown (see attachment). Why? \usemodule [database] \startbuffer[sample] "قال","sagte (Es)" "رسول","Gesandte (der)" "الله","Gottes" \stopbuffer \define[2]\InterlinearText {\setupalign[r2l]\definedfont[file:arial*arabic at 16 pt] \ruby{{\setupalign[r2l]#1}}{\setupalign[l2r]\definedfont[name:arial at 10pt]#2}} \definedatabase [interlineartext] [quotechar={"}, command=\InterlinearText] \setupinterlinespace[line=8ex] \setupruby[voffset=-3ex] \starttext \definedfont[file:arial*arabic at 16 pt] \processdatabasebuffer[interlineartext][sample] \stoptext And second: Of course it would be best readable, if one could write instead \startbuffer[sample] "قال","(Es) sagte" \stopbuffer but with same output, s.t. the order of the words in the second database-element is inverted. Is that possible? Huseyin Özoguz E-Mail: h.oezoguz@mmnetz.de Am 03.12.2018 um 13:36 schrieb Wolfgang Schuster:
Huseyin Özoguz schrieb am 03.12.18 um 12:51:
Thanks and I may have questions to the actual question about interlinear typesetting later, will try to define some nice macros with arabic-german interlinear texts.
Before you write your own commands try to use what is available.
If there is something missing existing commands can be extended and Hans is in many cases open to add new function to ConTeXt.
\usemodule [database]
% Source for the sample text: % https://interlinearbooks.com/blog/german-interlinear-translation-of-franz-ka...
\startbuffer[sample] "Als","As" "Gregor","Gregor" "Samsa","Samsa" "eines","one" "Morgens","morning" "aus","from" "unruhigen","uneasy" "Träumen","dreams" "erwachte,","woke up," "fand","found" "er","he" "sich","himself" "in","in" "seinem","his" "Bett","bed" "zu","in" "einem","an" "ungeheuren","enormous" "Ungeziefer","kind of monstrous vermin" "verwandelt.","transformed." \stopbuffer
\define[2]\InterlinearText {\ruby{#1}{#2} }
\definedatabase [interlineartext] [quotechar={"}, command=\InterlinearText]
\setupinterlinespace[line=6ex]
\setupruby[voffset=-2.5ex]
\starttext \processdatabasebuffer[interlineartext][sample] \stoptext
Wolfgang
Huseyin Özoguz schrieb am 03.12.18 um 17:47:
Before you write your own commands try to use what is available.
Right, but in many cases I am just not aware of what is available, to be honest, though I quite often use the wikigarden.
I tried to change your example into arabic-german, seems to work, except only the first translation-pair is shown (see attachment). Why?
\usemodule [database] \startbuffer[sample] "قال","sagte (Es)" "رسول","Gesandte (der)" "الله","Gottes" \stopbuffer
\define[2]\InterlinearText {\setupalign[r2l]\definedfont[file:arial*arabic at 16 pt] \ruby{{\setupalign[r2l]#1}}{\setupalign[l2r]\definedfont[name:arial at 10pt]#2}}
\definedatabase [interlineartext] [quotechar={"}, command=\InterlinearText]
\setupinterlinespace[line=8ex]
\setupruby[voffset=-3ex]
\starttext \definedfont[file:arial*arabic at 16 pt] \processdatabasebuffer[interlineartext][sample] \stoptext
Probably something with your font/alignment switching. \usemodule [database] \startbuffer[sample] "قال","sagte (Es)" "رسول","Gesandte (der)" "الله","Gottes" \stopbuffer \define[2]\InterlinearText {\ruby{#1}{#2} } % \defineruby % [interlineartext] % [style=] % % \define[2]\InterlinearText % {\ruby[interlineartext]{#1}{#2} } \definedatabase [interlineartext] [quotechar={"}, command=\InterlinearText] \setupinterlinespace[line=8ex] \definefontfamily [arial] [ss] [Arial] [features=arabic] \setupbodyfont [arial,16pt] \starttext \processdatabasebuffer[interlineartext][sample] \stoptext
And second: Of course it would be best readable, if one could write instead
\startbuffer[sample] "قال","(Es) sagte" \stopbuffer
but with same output, s.t. the order of the words in the second database-element is inverted. Is that possible?
There is no command which changes the order of words in a sentence but this should be easy with a short Lua function. Wolfgang
Probably something with your font/alignment switching.
Yes, probably, but this switching is necessary, look at your example: It gives wrong aligning of the arabic letters (left to right instead of right to left), so at some point one has to inject a \setupalign[r2l], but all my tries only gave this one as a correct result: \define[2]\InterlinearText {\setupalign[r2l]\definedfont[file:arial*arabic at 16 pt] \ruby{{\setupalign[r2l]#1}}{\setupalign[l2r]\definedfont[name:arial at 10pt]#2}} But that as mentioned looses all other databse entries except the first. Some hints where to make the r2l-switch with getting the same result?
There is no command which changes the order of words in a sentence but this should be easy with a short Lua function. Thank you, if some day one is available, I will use it. Or wil learn Lua, right, should be a very basic function to implement.
Huseyin Özoguz E-Mail: h.oezoguz@mmnetz.de Am 03.12.2018 um 18:34 schrieb Wolfgang Schuster:
Huseyin Özoguz schrieb am 03.12.18 um 17:47:
Before you write your own commands try to use what is available.
Right, but in many cases I am just not aware of what is available, to be honest, though I quite often use the wikigarden.
I tried to change your example into arabic-german, seems to work, except only the first translation-pair is shown (see attachment). Why?
\usemodule [database] \startbuffer[sample] "قال","sagte (Es)" "رسول","Gesandte (der)" "الله","Gottes" \stopbuffer
\define[2]\InterlinearText {\setupalign[r2l]\definedfont[file:arial*arabic at 16 pt] \ruby{{\setupalign[r2l]#1}}{\setupalign[l2r]\definedfont[name:arial at 10pt]#2}}
\definedatabase [interlineartext] [quotechar={"}, command=\InterlinearText]
\setupinterlinespace[line=8ex]
\setupruby[voffset=-3ex]
\starttext \definedfont[file:arial*arabic at 16 pt] \processdatabasebuffer[interlineartext][sample] \stoptext
Probably something with your font/alignment switching.
\usemodule [database]
\startbuffer[sample] "قال","sagte (Es)" "رسول","Gesandte (der)" "الله","Gottes" \stopbuffer
\define[2]\InterlinearText {\ruby{#1}{#2} }
% \defineruby % [interlineartext] % [style=] % % \define[2]\InterlinearText % {\ruby[interlineartext]{#1}{#2} }
\definedatabase [interlineartext] [quotechar={"}, command=\InterlinearText]
\setupinterlinespace[line=8ex]
\definefontfamily [arial] [ss] [Arial] [features=arabic]
\setupbodyfont [arial,16pt]
\starttext \processdatabasebuffer[interlineartext][sample] \stoptext
And second: Of course it would be best readable, if one could write instead
\startbuffer[sample] "قال","(Es) sagte" \stopbuffer
but with same output, s.t. the order of the words in the second database-element is inverted. Is that possible?
There is no command which changes the order of words in a sentence but this should be easy with a short Lua function.
Wolfgang
Huseyin Özoguz schrieb am 03.12.18 um 20:45:
Probably something with your font/alignment switching.
Yes, probably, but this switching is necessary, look at your example: It gives wrong aligning of the arabic letters (left to right instead of right to left), so at some point one has to inject a \setupalign[r2l], but all my tries only gave this one as a correct result:
\define[2]\InterlinearText {\setupalign[r2l]\definedfont[file:arial*arabic at 16 pt] \ruby{{\setupalign[r2l]#1}}{\setupalign[l2r]\definedfont[name:arial at 10pt]#2}}
\defineruby [interlineartext] [style=\lefttoright\txx] \define[2]\InterlinearText {\ruby[interlineartext]{#1}{#2} }
But that as mentioned looses all other databse entries except the first. Some hints where to make the r2l-switch with getting the same result?
\starttext \setupalign[r2l] \processdatabasebuffer[interlineartext][sample] \stoptext or when you want to change the alignment only for a part of your document \starttext \startalignment[r2l] \processdatabasebuffer[interlineartext][sample] \stopalignment \stoptext
There is no command which changes the order of words in a sentence but this should be easy with a short Lua function. Thank you, if some day one is available, I will use it. Or wil learn Lua, right, should be a very basic function to implement.
You can find many Lua examples for this online. Wolfgang
participants (4)
-
Floris van Manen
-
Hans Hagen
-
Huseyin Özoguz
-
Wolfgang Schuster