ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* [***SPAM***] Two-language environment and page breaking
@ 2013-05-21  6:01 "H. Özoguz"
  2013-05-22 19:51 ` Peter Münster
  0 siblings, 1 reply; 2+ messages in thread
From: "H. Özoguz" @ 2013-05-21  6:01 UTC (permalink / raw)
  To: ntg-context

Hi,

one more question to my arabic-german table environment. See this code:

\definefont[amiri][file:UthmanTN1Ver10.ttf*arabic at 11 pt] % or 
amiri-regular.ttf
\define[1]\Arab{\setupalign[r2l]\amiri#1}
%\showgrid
\startsetups[arde]
\setupTABLE[c][1][rightframe=on]
\stopsetups
\def\startarde
{\bTABLE[frame=off,width=.5\textwidth,setups=arde,split=yes]}
\def\stoparde
{\eTABLE}
\define[2]\arde
{\bTR
\bTD [align={tolerant, stretch}, 
roffset=1ex,style={\setupinterlinespace[line=3ex]}] #1\eTD
\bTD[align={r2l,tolerant,stretch}, 
loffset=1ex,style={\amiri\setupinterlinespace[line=5.4ex]}] #2 \eTD
\eTR}
\starttext
\startarde
\arde{%
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.
}
{%
اللهُمَّ ارْزُقْنِي حَجَّ بَيْتِك الحَرامِ فِي عامِي هذا وَفِي كُلِّ عامٍ ما أَبْقَيْتَنِي فِي يُسْرٍ مِنْكَ 
وَعافِيَةٍ وَسَعَةِ رِزْقِ، وَلا تُخْلِنِي

مِنْ تِلْكَ المَواقِفِ الكَرِيِمَةِ وَالمَشاهِدِ الشَّرِيفَةِ، وَزِيارَةِ قَبْرِ نَبِيِّكَ صَلَواتُكَ عَلَيْهِ 
وَآلِهِ، وَفِي جَمِيعِ حَوائِجِ الدُّنْيا وَالآخرةِ فَكُنْ
}
\stoparde
\blank
{\bf Should be the same like:}\blank
\startarde
\arde{%
Dies ist nur ein vollkommen sinnfreier Text und hat rein gar nichts mit 
dem Arabischen auf der rechten Seiten zutun.
}
{%
اللهُمَّ ارْزُقْنِي حَجَّ بَيْتِك الحَرامِ فِي عامِي هذا وَفِي كُلِّ عامٍ ما أَبْقَيْتَنِي فِي يُسْرٍ مِنْكَ 
وَعافِيَةٍ وَسَعَةِ رِزْقِ، وَلا تُخْلِنِي
}
\arde{Wirklich gar nichts. Glauben Sie es mir? Also versuchen Sie nicht 
den Sinn des Arabischen hierdurch zu erfassen.}{مِنْ تِلْكَ المَواقِفِ الكَرِيِمَةِ 
وَالمَشاهِدِ الشَّرِيفَةِ، وَزِيارَةِ قَبْرِ نَبِيِّكَ صَلَواتُكَ عَلَيْهِ وَآلِهِ، وَفِي جَمِيعِ حَوائِجِ 
الدُّنْيا وَالآخرةِ فَكُنْ }
\stoparde
\stoptext

In the code you see two \startarde\stoparde blocks. The first block is 
the example, the correct setting. But the first block can not be broken 
over pages. This is fixed by the second block, where I seperated the 
text into two "\arde", so now it can be broken over pages, because they 
are now two different tables. 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.

Is there a way to produce the behavior I descibed? It would be a 
workaround to get natural tables, which can be broken over pages (my 
manually sperating them). (Only natural tables are possible for this 
environment, and not normales tables, because of the needed different 
interlinespace of the two columns).

Thanks.
Huseyin













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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Two-language environment and page breaking
  2013-05-21  6:01 [***SPAM***] Two-language environment and page breaking "H. Özoguz"
@ 2013-05-22 19:51 ` Peter Münster
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Münster @ 2013-05-22 19:51 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-05-22 19:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-21  6:01 [***SPAM***] Two-language environment and page breaking "H. Özoguz"
2013-05-22 19:51 ` Peter Münster

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).