ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Otared Kavian <otared@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: 2 columns: 1 language per column (solved)
Date: Tue, 31 Jul 2012 17:17:56 +0200	[thread overview]
Message-ID: <A1EA8495-5006-4D5F-9C42-3B464BE90DC7@gmail.com> (raw)
In-Reply-To: <87obmw6mpv.fsf_-_@micropit.couberia.bzh>

Hi Peter,

Can you give please an example showing how to use your code?

Thanks: OK

On 31 juil. 2012, at 16:15, Peter Münster <pmlists@free.fr> wrote:

> On Tue, Jul 31 2012, Hans Hagen wrote:
> 
>> \startmixedcolumns
>>    \placeparallel[main][one,two][criterium=all]
>> \stopmixedcolumns
>> 
>> there will be better support for that kind of things at some point
> 
> I don't get the desired result with \placeparallel, but I've found a
> solution, that works quite well. I just can't place figures, that span
> the 2 columns, but that's no problem for my project.
> 
> Here the (not very contextish) solution (cld-file):
> 
> --8<---------------cut here---------------start------------->8---
> local C = context
> local format = string.format
> 
> local function create_environment()
>  local fp = io.open("env.tex", "w")
>  fp:write([[
> \startenvironment env
> 
> \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]
>  \it\dorecurse{15}{\dorecurse{20}{german }\par}
> \stopbuffer
> 
> \startbuffer[french]
>  \bf\dorecurse{15}{\dorecurse{20}{french }\par}
> \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", "french")
> C"After"
> C.stoptext()
> --8<---------------cut here---------------end--------------->8---
> 
> -- 
>           Peter
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________

___________________________________________________________________________________
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:[~2012-07-31 15:17 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-29 15:57 2 columns: 1 language per column Peter Münster
2012-07-31  9:06 ` Hans Hagen
2012-07-31  9:27   ` Peter Münster
2012-07-31  9:44     ` Hans Hagen
2012-07-31 14:15       ` 2 columns: 1 language per column (solved) Peter Münster
2012-07-31 15:17         ` Otared Kavian [this message]
2012-07-31 16:23           ` Peter Münster
2012-07-31 21:46             ` Otared Kavian
2012-07-31 22:29               ` Peter Münster
2012-07-31 22:41               ` Rogers, Michael K
2012-08-01  6:39                 ` Otared Kavian
2012-08-01 12:44                   ` Rogers, Michael K
2012-08-01 13:37                     ` Hans Hagen
2012-08-01 14:17                     ` Otared Kavian
2012-08-01  7:34               ` Hans Hagen

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=A1EA8495-5006-4D5F-9C42-3B464BE90DC7@gmail.com \
    --to=otared@gmail.com \
    --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).