Hi, I uploaded a new lmtx version ... it has a new mechanism for manipulating boxes: http://www.pragma-ade.com/general/magazines/mag-1105-mkiv.pdf (also in distribution) Of course experimental but I bet that some can think of usage. Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
Hans Hagen schrieb am 06.08.2020 um 19:26:
Hi,
I uploaded a new lmtx version ... it has a new mechanism for manipulating boxes:
http://www.pragma-ade.com/general/magazines/mag-1105-mkiv.pdf
(also in distribution)
Of course experimental but I bet that some can think of usage.
The \copyboxline command doesn't stop at the end of the requested line. BTW: Is it possible to have unbox command to get the width of the content in the lines without the spaces at the begin end. This is useful to get the width of first/last line in a box. %% begin example \starttext \setbox0\vbox {\hsize=4cm one\par two\par three\par four} \setbox2\ruledhbox{\copyboxline 0 2} \setbox4\ruledhbox{\boxline 0 3} %\setbox6 \boxline 0 5 % error [2] [\box2] \par [3] [\box4] \par [5] [\box6] \par \stoptext %% end example Wolfgang
Looks useful for multilingual documents, e.g. interleaved lines or linguistic glosses. The following example worked for me, but I share in case there's a way to do better code from it: \starttext \newbox\spanishbox \newbox\englishbox \newbox\frenchbox \setbox\spanishbox\vbox\bgroup\red\obeylines Conocí a un viajero de una tierra antigua quien dijo: «dos enormes piernas pétreas, sin su tronco se yerguen en el desierto. A su lado, en la arena, semihundido, yace un rostro hecho pedazos, cuyo ceño y mueca en la boca, y desdén de frío dominio, cuentan que su escultor comprendió bien esas pasiones las cuales aún sobreviven, grabadas en estos inertes objetos, a las manos que las tallaron y al corazón que las alimentó. Y en el pedestal se leen estas palabras: "Mi nombre es Ozymandias, rey de reyes: ¡Contemplad mis obras, poderosos, y desesperad!" Nada queda a su lado. Alrededor de la decadencia de estas colosales ruinas, infinitas y desnudas se extienden, a lo lejos, las solitarias y llanas arenas». \egroup \setbox\englishbox\vbox\bgroup\blue\obeylines I met a traveller from an antique land, Who said—“Two vast and trunkless legs of stone Stand in the desert. . . . Near them, on the sand, Half sunk a shattered visage lies, whose frown, And wrinkled lip, and sneer of cold command, Tell that its sculptor well those passions read Which yet survive, stamped on these lifeless things, The hand that mocked them, and the heart that fed; And on the pedestal, these words appear: My name is Ozymandias, King of Kings; Look on my Works, ye Mighty, and despair! Nothing beside remains. Round the decay Of that colossal Wreck, boundless and bare The lone and level sands stretch far away.” \egroup \setbox\frenchbox\vbox\bgroup\darkgray\obeylines J’ai rencontré un voyageur de retour d’une terre antique Qui m'a dit : « Deux immenses jambes de pierre dépourvues de buste Se dressent dans le désert. Près d’elles, sur le sable, À moitié enfoui, gît un visage brisé dont le sourcil froncé, La lèvre plissée et le rictus de froide autorité Disent que son sculpteur sut lire les passions Qui, gravées sur ces objets sans vie, survivent encore À la main qui les imita et au cœur qui les nourrit. Et sur le piédestal il y a ces mots : "Mon nom est Ozymandias, Roi des Rois. Voyez mon œuvre, ô puissants, et désespérez !" À côté, rien ne demeure. Autour des ruines De cette colossale épave, infinis et nus, Les sables monotones et solitaires s’étendent au loin. » \egroup \dorecurse{\boxlines \spanishbox}{% \strut\llap{\hbox to 1.5em{\txx#1\hss}}\boxline \englishbox#1\par \strut\boxline \spanishbox#1\par \strut\boxline \frenchbox#1\par \blank } \stoptext Thank you for the goodies, Hans Regards, Jairo :) El jue., 6 de ago. de 2020 a la(s) 13:13, Wolfgang Schuster ( wolfgang.schuster.lists@gmail.com) escribió:
Hans Hagen schrieb am 06.08.2020 um 19:26:
Hi,
I uploaded a new lmtx version ... it has a new mechanism for manipulating boxes:
http://www.pragma-ade.com/general/magazines/mag-1105-mkiv.pdf
(also in distribution)
Of course experimental but I bet that some can think of usage.
The \copyboxline command doesn't stop at the end of the requested line.
BTW: Is it possible to have unbox command to get the width of the content in the lines without the spaces at the begin end. This is useful to get the width of first/last line in a box.
%% begin example \starttext
\setbox0\vbox {\hsize=4cm one\par two\par three\par four}
\setbox2\ruledhbox{\copyboxline 0 2} \setbox4\ruledhbox{\boxline 0 3} %\setbox6 \boxline 0 5 % error
[2] [\box2] \par [3] [\box4] \par [5] [\box6] \par
\stoptext %% end example
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
___________________________________________________________________________________
On 8/7/2020 6:22 AM, Jairo A. del Rio wrote:
Looks useful for multilingual documents, e.g. interleaved lines or linguistic glosses. The following example worked for me, but I share in case there's a way to do better code from it: Is that text public? Can i add such an example to the test suite?
Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
The original in English, Ozymandias, by Percy Bysshe Shelley, is public domain. I extracted the Spanish and French versions from Wikipedia, which use a CC BY-SA 3.0 License. El vie., 7 de ago. de 2020 a la(s) 02:50, Hans Hagen (j.hagen@xs4all.nl) escribió:
On 8/7/2020 6:22 AM, Jairo A. del Rio wrote:
Looks useful for multilingual documents, e.g. interleaved lines or linguistic glosses. The following example worked for me, but I share in case there's a way to do better code from it: Is that text public? Can i add such an example to the test suite?
Hans
----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
On 8/7/2020 9:59 AM, Jairo A. del Rio wrote:
The original in English, Ozymandias, by Percy Bysshe Shelley, is public domain. I extracted the Spanish and French versions from Wikipedia, which use a CC BY-SA 3.0 License. Ok, here is the more robust variant:
\blank \ifnum\boxlines\EnglishBox=\boxlines\SpanishBox \ifnum\boxlines\EnglishBox=\boxlines\FrenchBox \ifnum\boxlines\EnglishBox>0 \dorecurse{\boxlines\SpanishBox}{% \dontleavehmode\llap{\hbox to 1.5em{\txx#1\hss}}% \boxline \EnglishBox#1\par \dontleavehmode\boxline \SpanishBox#1\par \dontleavehmode\boxline \FrenchBox #1\par \blank } \else No content found!\blank \fi \else English and Spanish boxes mismatch!\blank \fi \else English and French boxes mismatch!\blank \fi Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
Nice, I've just tested it and it works fine. Thank you, Hans. Btw, are you gonna include those passages? I have some other samples in the public domain (Shakespeare's Sonnets translations, etc.) in case you're interested in including them. Regards, Jairo :) El vie., 7 de ago. de 2020 a la(s) 04:02, Hans Hagen (j.hagen@xs4all.nl) escribió:
On 8/7/2020 9:59 AM, Jairo A. del Rio wrote:
The original in English, Ozymandias, by Percy Bysshe Shelley, is public domain. I extracted the Spanish and French versions from Wikipedia, which use a CC BY-SA 3.0 License. Ok, here is the more robust variant:
\blank \ifnum\boxlines\EnglishBox=\boxlines\SpanishBox \ifnum\boxlines\EnglishBox=\boxlines\FrenchBox \ifnum\boxlines\EnglishBox>0 \dorecurse{\boxlines\SpanishBox}{% \dontleavehmode\llap{\hbox to 1.5em{\txx#1\hss}}% \boxline \EnglishBox#1\par \dontleavehmode\boxline \SpanishBox#1\par \dontleavehmode\boxline \FrenchBox #1\par \blank } \else No content found!\blank \fi \else English and Spanish boxes mismatch!\blank \fi \else English and French boxes mismatch!\blank \fi
Hans
----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
On 8/7/2020 11:14 AM, Jairo A. del Rio wrote:
Nice, I've just tested it and it works fine. Thank you, Hans. Btw, are you gonna include those passages? I have some other samples in the public domain (Shakespeare's Sonnets translations, etc.) in case you're interested in including them. we have some samples in the distribution for various purposes, see the
tex context sample third path, so we can add there (filenames must be clear, so in thsi cas esome language at the end of the name) Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
I made a zip file with some English (original)-Spanish (translation) pairs as the latter is my native language. Sorry for the bias. I guess some other users can use those files for testing language-related features. All of them are in the public domain, so it's safe to use them in any context (pun intended). I'll try to tackle other similar problems which were tricky to solve using LaTeX: the format-agnosting expex does fancy things as glosses and the like, but a better approach based purely on ConTeXt capabilities must be possible for linguistics, translation and language learning, considering the fact ConTeXt already outperforms LaTeX wrt language support. Regards, Jairo :) El vie., 7 de ago. de 2020 a la(s) 04:37, Hans Hagen (j.hagen@xs4all.nl) escribió:
On 8/7/2020 11:14 AM, Jairo A. del Rio wrote:
Nice, I've just tested it and it works fine. Thank you, Hans. Btw, are you gonna include those passages? I have some other samples in the public domain (Shakespeare's Sonnets translations, etc.) in case you're interested in including them. we have some samples in the distribution for various purposes, see the
tex context sample third
path, so we can add there (filenames must be clear, so in thsi cas esome language at the end of the name)
Hans
----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
Jairo A. del Rio schrieb am 07.08.2020 um 11:14:
Nice, I've just tested it and it works fine. Thank you, Hans. I would ensure to avoid a page break between the language blocks which is currently missing but when you need this in a document it makes sense to write something around it.
Wolfgang
participants (3)
-
Hans Hagen
-
Jairo A. del Rio
-
Wolfgang Schuster