ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Talal Al-Azem <talazem@fastmail.fm>
To: ntg-context@ntg.nl
Subject: Re: placing a paragraph with non-standard interlinear spacing onto the grid
Date: Sun, 3 Oct 2010 20:14:04 +0100	[thread overview]
Message-ID: <2EC34801-80B5-4F78-8998-F04B6C6BE415@fastmail.fm> (raw)
In-Reply-To: <901A8F2F-3461-405C-9A24-568A5C458235@alazem.org>


[-- Attachment #1.1: Type: text/plain, Size: 4811 bytes --]

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
> 


[-- Attachment #1.2: Type: text/html, Size: 7120 bytes --]

[-- Attachment #2: Type: text/plain, Size: 486 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

  parent reply	other threads:[~2010-10-03 19:14 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-02 22:23 Talal Al-Azem
     [not found] ` <901A8F2F-3461-405C-9A24-568A5C458235@alazem.org>
2010-10-03 19:14   ` Talal Al-Azem [this message]
2010-10-03 19:50     ` Hans Hagen
2010-10-03 21:47       ` Talal Al-Azem
2010-10-03 22:40         ` Talal Al-Azem
2010-10-04  0:17           ` Hans Hagen
2010-10-04  0:28             ` Talal Al-Azem
2010-10-03 20:19 ` Wolfgang Schuster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2EC34801-80B5-4F78-8998-F04B6C6BE415@fastmail.fm \
    --to=talazem@fastmail.fm \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).