Re: [NTG-context] placing a paragraph with non-standard interlinear spacing onto the grid
Dear all, By way of further definition and clarification of the issue: back in the world of LaTeX, I was kindly given the following code on CTT by Donald Arseneau to produce the desired effect. Mind you, it was only meant to work with a paragraph if the entire paragraph was on one page; it wouldn't work if split across pages: %%% Donald Arseneau’s Gridblock Environment %%% % For placing paragraphs into a box, and that box then % being placed on a “grid” of the baselineskip. This ensures % that following paragraphs are also on the grid. \makeatletter \@ifundefined{@tempdimc}{\newdimen\@tempdimc}{} \newenvironment{gridblock}{\par \setbox\@tempboxa\vtop\bgroup }{\par\egroup % measurements of top \@tempdima=\ht\@tempboxa \@tempdimc=\dp\@tempboxa \ifdim\@tempdima>\ht\strutbox \advance\@tempdimc\@tempdima \@tempdima=\ht\strutbox \advance\@tempdimc-\@tempdima \fi % measurements of bottom \setbox\@tempboxa\vbox{\unvbox\@tempboxa}% \ifdim\dp\@tempboxa>\dp\strutbox \@tempdimb=\dp\strutbox \else \@tempdimb=\dp\@tempboxa \fi \advance\@tempdimc-\@tempdimb \@tempcnta=\@tempdimc \divide\@tempcnta\baselineskip \advance\@tempdimc -\@tempcnta\baselineskip \ifdim\@tempdimc >2\vfuzz \advance\@tempdimc-\baselineskip \fi \divide\@tempdimc\tw@ \vbox to\@tempdima{}% \nobreak \nointerlineskip \kern-\@tempdima \kern-\@tempdimc \nobreak \box\@tempboxa \nobreak \nointerlineskip \kern-\@tempdimb \kern-\@tempdimc \nobreak \hbox{\vrule height \z@ width \z@ depth \@tempdimb}% } \makeatother Seeing how systematised ConTeXt is, I'm assuming something much simpler could probably be used to achieve the same effect? Kind regards, Talal On 3 Oct 2010, at 20:10, Talal Al-Azem wrote:
By way of further definition and clarification of the issue: back in the world of LaTeX, I was kindly given the following code on CTT by Donald Arseneau to produce the desired effect. Mind you, it was only meant to work with a paragraph if the entire paragraph was on one page; it wouldn't work if split across pages:
%%% Donald Arseneau’s Gridblock Environment %%% % For placing paragraphs into a box, and that box then % being placed on a “grid” of the baselineskip. This ensures % that following paragraphs are also on the grid. \makeatletter \@ifundefined{@tempdimc}{\newdimen\@tempdimc}{} \newenvironment{gridblock}{\par \setbox\@tempboxa\vtop\bgroup }{\par\egroup % measurements of top \@tempdima=\ht\@tempboxa \@tempdimc=\dp\@tempboxa \ifdim\@tempdima>\ht\strutbox \advance\@tempdimc\@tempdima \@tempdima=\ht\strutbox \advance\@tempdimc-\@tempdima \fi % measurements of bottom \setbox\@tempboxa\vbox{\unvbox\@tempboxa}% \ifdim\dp\@tempboxa>\dp\strutbox \@tempdimb=\dp\strutbox \else \@tempdimb=\dp\@tempboxa \fi \advance\@tempdimc-\@tempdimb \@tempcnta=\@tempdimc \divide\@tempcnta\baselineskip \advance\@tempdimc -\@tempcnta\baselineskip \ifdim\@tempdimc >2\vfuzz \advance\@tempdimc-\baselineskip \fi \divide\@tempdimc\tw@ \vbox to\@tempdima{}% \nobreak \nointerlineskip \kern-\@tempdima \kern-\@tempdimc \nobreak \box\@tempboxa \nobreak \nointerlineskip \kern-\@tempdimb \kern-\@tempdimc \nobreak \hbox{\vrule height \z@ width \z@ depth \@tempdimb}% } \makeatother
Seeing how systematised ConTeXt is, I'm assuming something much simpler could probably be used to achieve the same effect?
Kind regards, Talal
On 2 Oct 2010, at 23:23, Talal Al-Azem wrote:
Dear all,
This is important for anyone working with mixed language (font) texts. In my example, the overall document is Latin-based (e.g. English), with a paragraph of Arabic text; I want this Arabic paragraph as a whole to fit onto the grid (though obviously the individual Arabic lines of the paragraph would not).
Currently, when I typeset an English paragraph, followed by an Arabic paragraph, followed by an English paragraph, the second English paragraph is no longer on the grid, having been throw off by the Arabic one. I'm looking for some way to automatically calculate and fill in the vspace needed for this.
This is not the same as the issue of an Arabic word or phrase (or mathematic formula) being typeset in the midst of Latin text, as discussed http://www.mail-archive.com/ntg-context@ntg.nl/msg46163.html. Having read a few other matters on the mailing list (largely involving Idris and Hans), I'm sure it's possible, but I can't figure it out.
Any help would be most appreciated.
Kind regards, Talal
On 3-10-2010 9:14, Talal Al-Azem wrote:
Dear all,
By way of further definition and clarification of the issue: back in the world of LaTeX, I was kindly given the following code on CTT by Donald Arseneau to produce the desired effect. Mind you, it was only meant to work with a paragraph if the entire paragraph was on one page; it wouldn't work if split across pages:
does \setulayout[grid=yes] give acceptable results? ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
Hello Hans and Wolfgang, Hans: Thanks for your reply. No, simply setting up the grid does not work. Because of the size of Arabic fonts relative to latin fonts, the Arabic paragraph naturally needs a bit more interlinear spacing; as such, I do not expect the paragraph to lineup on the grid (effectively, I am happy to treat it like one would a graphic or math equation). But in the English paragraph which follows, I would like the English paragraph to be realigned on the grid. BUT: it seems that Wolfgang's suggestion works well! (At least with my minimal example, which I've attached below). Thank you both so much. Amazing. I cannot express how impressed I am with ConTeXt at the moment, and how what used to require so much hacking in LaTeX (which I never could have come up with), and so many myriad packages, is all largely done from within ConTeXt itself! My last hurdle for shifting my work into ConTeXt remains the issue of the features needed for critical editions--most importantly the ability to key lemmas to line numbers; but that will be left to a dedicated email. Many thanks to you both again, and to all those who've played a role in the development of ConTeXt. :-) Kind regards, Talal On 3 Oct 2010, at 20:50, Hans Hagen wrote:
On 3-10-2010 9:14, Talal Al-Azem wrote:
Dear all,
By way of further definition and clarification of the issue: back in the world of LaTeX, I was kindly given the following code on CTT by Donald Arseneau to produce the desired effect. Mind you, it was only meant to work with a paragraph if the entire paragraph was on one page; it wouldn't work if split across pages:
does \setulayout[grid=yes] give acceptable results?
----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
Dear Hans and Wolfgang (et al), Unfortunately, I think I may have spoken too soon, as I've run into a small problem. :-) Using Wolfgang's suggestion of baselinecorrection: \startbaselinecorrection\setupinterlinespace[line=5ex] ... \stopbaselinecorrection I can no longer get footnotes which are in the Arabic paragraph to work. The footnote marker in the text shows up; but that particular footnote does not show at the bottom of the page, though a footnote from text outside of that paragraph do show, with their correct numbering. See attachments for an example. Kind regards, Talal On 3 Oct 2010, at 22:47, Talal Al-Azem wrote:
Hello Hans and Wolfgang,
Hans: Thanks for your reply. No, simply setting up the grid does not work. Because of the size of Arabic fonts relative to latin fonts, the Arabic paragraph naturally needs a bit more interlinear spacing; as such, I do not expect the paragraph to lineup on the grid (effectively, I am happy to treat it like one would a graphic or math equation). But in the English paragraph which follows, I would like the English paragraph to be realigned on the grid.
BUT: it seems that Wolfgang's suggestion works well! (At least with my minimal example, which I've attached below). Thank you both so much.
Amazing. I cannot express how impressed I am with ConTeXt at the moment, and how what used to require so much hacking in LaTeX (which I never could have come up with), and so many myriad packages, is all largely done from within ConTeXt itself! My last hurdle for shifting my work into ConTeXt remains the issue of the features needed for critical editions--most importantly the ability to key lemmas to line numbers; but that will be left to a dedicated email.
Many thanks to you both again, and to all those who've played a role in the development of ConTeXt. :-)
Kind regards, Talal
On 3 Oct 2010, at 20:50, Hans Hagen wrote:
On 3-10-2010 9:14, Talal Al-Azem wrote:
Dear all,
By way of further definition and clarification of the issue: back in the world of LaTeX, I was kindly given the following code on CTT by Donald Arseneau to produce the desired effect. Mind you, it was only meant to work with a paragraph if the entire paragraph was on one page; it wouldn't work if split across pages:
does \setulayout[grid=yes] give acceptable results?
----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
___________________________________________________________________________________ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________
On 4-10-2010 12:40, Talal Al-Azem wrote:
Dear Hans and Wolfgang (et al),
Unfortunately, I think I may have spoken too soon, as I've run into a small problem. :-) Using Wolfgang's suggestion of baselinecorrection:
\startbaselinecorrection\setupinterlinespace[line=5ex] .... \stopbaselinecorrection
I can no longer get footnotes which are in the Arabic paragraph to work. The footnote marker in the text shows up; but that particular footnote does not show at the bottom of the page, though a footnote from text outside of that paragraph do show, with their correct numbering. See attachments for an example.
does \automigrateinserts help? (concerning the grid ... at some point we can associate lineht/dp with a font ... it's rather trivial to influence) ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
Unfortunately, I think I may have spoken too soon, as I've run into a small problem. :-) Using Wolfgang's suggestion of baselinecorrection:
\startbaselinecorrection\setupinterlinespace[line=5ex] .... \stopbaselinecorrection
I can no longer get footnotes which are in the Arabic paragraph to work. The footnote marker in the text shows up; but that particular footnote does not show at the bottom of the page, though a footnote from text outside of that paragraph do show, with their correct numbering. See attachments for an example.
does
\automigrateinserts
help?
It does indeed. Many thanks, Hans, for your quick responses and help! Kind regards, Talal
(concerning the grid ... at some point we can associate lineht/dp with a font ... it's rather trivial to influence)
participants (2)
-
Hans Hagen
-
Talal Al-Azem