ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: "Peter Münster" <pmlists@free.fr>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Two-language environment and page breaking
Date: Wed, 22 May 2013 21:51:25 +0200	[thread overview]
Message-ID: <8761yaztc2.fsf@micropit.couberia.selfip.net> (raw)
In-Reply-To: <519B0D9D.8030203@mmnetz.de> ("H. =?utf-8?Q?=C3=96zoguz=22's?= message of "Tue, 21 May 2013 08:01:01 +0200")

[-- Attachment #1: Type: text/plain, Size: 431 bytes --]

On Tue, May 21 2013, H. Özoguz wrote:

> But if they are NOT broken over pages, they sould be set as if they
> were only one table, so as in the first "\startarde\stoparde" block.
> But the are not. You see the small distance between them.

Hi,

I don't know a real solution, just 2 workarounds:

1.) A \vskip-3pt between the 2 paragraphs.

2.) My cld-hack, as shown in the 2 attached files.

-- 
           Peter

[-- Attachment #2: german-arab.cld --]
[-- Type: application/octet-stream, Size: 2606 bytes --]

local C = context
local format = string.format

local function create_environment()
  local fp = io.open("env.tex", "w")
  fp:write([[
\startenvironment env

\def\GermanText{\dorecurse{10}
  {Dies ist nur ein vollkommen sinnfreier Text und hat rein gar nichts mit dem
   Arabischen auf der rechten Seiten zutun. Wirklich gar nichts. Glauben Sie es
   mir? Also versuchen Sie nicht den Sinn des Arabischen hierdurch zu
   erfassen.\par}}
\def\ArabText{\dorecurse{10}
  {اللهُمَّ ارْزُقْنِي حَجَّ بَيْتِك الحَرامِ فِي عامِي هذا وَفِي كُلِّ عامٍ ما أَبْقَيْتَنِي فِي
   يُسْرٍ مِنْكَ وَعافِيَةٍ وَسَعَةِ رِزْقِ، وَلا تُخْلِنِي

   مِنْ تِلْكَ المَواقِفِ الكَرِيِمَةِ وَالمَشاهِدِ الشَّرِيفَةِ، وَزِيارَةِ قَبْرِ نَبِيِّكَ صَلَواتُكَ
   عَلَيْهِ وَآلِهِ، وَفِي جَمِيعِ حَوائِجِ الدُّنْيا وَالآخرةِ فَكُنْ
   \par}}
\def\Fig{%
  \placefigure[none]{}{\externalfigure[cow.pdf][width=\textwidth]}\par}
\definefont[amiri][file:UthmanTN1Ver10.otf*arabic at 11 pt]
\setupexternalfigures[location=default]
\def\ColumnDistance{1cm}

\startmode[columns]
  \definepapersize[columns][
    width=\dimexpr (\textwidth - \ColumnDistance) / 2 \relax,
    height=\textheight]
  \setuppapersize[columns]
  \setuplayout[page]
  \setuppagenumbering[location=]
  \setupalign[verytolerant, stretch, line]
  \setupwhitespace[small]
\stopmode

\startbuffer[german]
  \GermanText\Fig\GermanText
\stopbuffer

\startbuffer[arab]
  \setupalign[r2l, tolerant, stretch]
  \amiri\setupinterlinespace[line=5.4ex]
  \ArabText\Fig\ArabText
\stopbuffer

\stopenvironment
]])
  fp:close()
end

local function create_pages(s)
  local fp = io.open("pages.tex", "w")
  fp:write(format([[
\enablemode[columns]
\environment env
\starttext
\getbuffer[%s]
\stoptext
]], s))
  fp:close()
  os.execute(format("context --result=pages-%s pages", s))
end

local function create_columns(l, r)
  local function pdf(x) return "pages-" .. x .. ".pdf" end
  create_pages(l)
  create_pages(r)
  local pdfobj = epdf.open(pdf(l))
  local n = pdfobj:getNumPages()
  for i = 1, n do
    C.dontleavehmode()
    C.externalfigure({pdf(l)}, {page = i})
    C"\\hskip\\ColumnDistance"
    C.externalfigure({pdf(r)}, {page = i})
    C.page()
  end
end

create_environment()
C.environment(false, "env ")
C.starttext()
C"Before"
C.page()
create_columns("german", "arab")
C"After"
C.stoptext()

[-- Attachment #3: german-arab.pdf --]
[-- Type: application/pdf, Size: 76240 bytes --]

[-- Attachment #4: Type: text/plain, Size: 485 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
___________________________________________________________________________________

  reply	other threads:[~2013-05-22 19:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-21  6:01 [***SPAM***] " "H. Özoguz"
2013-05-22 19:51 ` Peter Münster [this message]
2013-05-23 11:02 Eslamica

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=8761yaztc2.fsf@micropit.couberia.selfip.net \
    --to=pmlists@free.fr \
    --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).