From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/82154 Path: news.gmane.org!not-for-mail From: Sietse Brouwer Newsgroups: gmane.comp.tex.context Subject: Re: How to center with picture taken into consideration Date: Sat, 27 Apr 2013 14:35:03 +0200 Message-ID: References: Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1367066137 30829 80.91.229.3 (27 Apr 2013 12:35:37 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 27 Apr 2013 12:35:37 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Sat Apr 27 14:35:40 2013 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([195.12.62.10]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UW4Lr-0006OY-Gx for gctc-ntg-context-518@m.gmane.org; Sat, 27 Apr 2013 14:35:39 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id E4A86101E9; Sat, 27 Apr 2013 14:35:38 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id Ic4f609lkhDl; Sat, 27 Apr 2013 14:35:37 +0200 (CEST) Original-Received: from balder.ntg.nl (localhost [IPv6:::1]) by balder.ntg.nl (Postfix) with ESMTP id 4024E101E4; Sat, 27 Apr 2013 14:35:37 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 9381E101E4 for ; Sat, 27 Apr 2013 14:35:35 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id TZuyGhBUf6gM for ; Sat, 27 Apr 2013 14:35:34 +0200 (CEST) Original-Received: from filter4-ams.mf.surf.net (filter4-ams.mf.surf.net [192.87.102.72]) by balder.ntg.nl (Postfix) with ESMTP id D75D2101E0 for ; Sat, 27 Apr 2013 14:35:34 +0200 (CEST) Original-Received: from mail-ee0-f48.google.com (mail-ee0-f48.google.com [74.125.83.48]) by filter4-ams.mf.surf.net (8.14.3/8.14.3/Debian-9.4) with ESMTP id r3RCw0tj025702 for ; Sat, 27 Apr 2013 14:58:01 +0200 Original-Received: by mail-ee0-f48.google.com with SMTP id d49so2040336eek.35 for ; Sat, 27 Apr 2013 05:35:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:in-reply-to:references:from:date:message-id :subject:to:content-type; bh=wBH4eYr7IOOPmLRPp4vkViLX5zYvOOiqweEgmVlgPx4=; b=EUD+NKgfe+nZ83E4EzUmNlRORg2sLykMYlyWYEZAWcWIglEdxQ7JwL7tlov8NhhKyI hye6hx6Ubw4Td+pnP9SeVHtde3vCITij6hJ/nXPdUxRBrKtq1Kw29EdyjC+pv9hRPmtL Vz4opPqfy7hCdTD9VK0BXPt3hDn2bQtxop4pwb4U8mTGM17vDIR4o0UutidpzERaMq4f BBewxBGCRE6/qtuaIi8ZGKRNDRFkXh9Q64uiNJUoAHS7asnScRZIhEWHVkEzTB9a/otI uEFIxiHG6dLT5Fb33SrlRWf+vexdZxV1bARvLXSwaSXNgPyslpH1qwhrQCTqRuvmmc+C XvBg== X-Received: by 10.15.27.195 with SMTP id p43mr98690478eeu.8.1367066134034; Sat, 27 Apr 2013 05:35:34 -0700 (PDT) Original-Received: by 10.15.110.3 with HTTP; Sat, 27 Apr 2013 05:35:03 -0700 (PDT) In-Reply-To: X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=74.125.83.48; country=US; region=CA; city=Mountain View; postalcode=94043; latitude=37.4192; longitude=-122.0574; metrocode=807; areacode=650; http://maps.google.com/maps?q=37.4192,-122.0574&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 01Jt0W0di - 68300de0bad8 - 20130427 (trained as not-spam) X-Scanned-By: CanIt (www . roaringpenguin . com) on 192.87.102.72 X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.14 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: ntg-context-bounces@ntg.nl Xref: news.gmane.org gmane.comp.tex.context:82154 Archived-At: Hello Cecil, I have a LuaTeX-based start for you, but there is one important thing I do not know: how to obtain the an image's width and/or height from Lua. Although that would also depend on whether you want to resize images to a fixed with, etc. Anyway, now that the typesetting code is Lua-based, working out the conditional stuff you need will hopefully be trivial (for 'if you know Lua or have an hour to learn the basics' values of trivial). Cheers, Sietse % 2013-04-27 \useMPlibrary[dum] \showframe \defineparagraphs[persoon] \setupparagraphs[persoon][1] [width=\dimexpr \textwidth - 3.5cm\relax, distance=0.5cm, align=middle, ] \setuplines[align=middle] \setupparagraphs[persoon][2][width=3cm] \starttext \startluacode -- a table containing the material we want to typeset local contents = { { text = [[ Naam: Adres: Burgerservicenummer: ]], image = "pic1" }, { text = [[ Naam: Aapje aapje aapje aapje Adres: Olifantje Burgerservicenummer: En nu jij ]], image = "pic2" } } -- typeset each text-image pair for k,v in ipairs(contents) do -- calculate or specify how wide you want the image and the paragraphs to be imagecolwidth = string.todimen("3cm") coldistance = string.todimen("0.5cm") textcolwidth = tex.dimen.textwidth - imagecolwidth - coldistance -- setup the text column context.setupparagraphs( { "persoon" }, { 1 }, { width = textcolwidth .. "sp" }) -- setup the image column (possibly to width 0?) context.setupparagraphs( { "persoon" }, { 2 }, { width = imagecolwidth .. "sp" }) -- the actual typesetting code context.startpersoon() context.startlines() context(v.text) context.stoplines() context.nextpersoon() context.externalfigure( { v.image}, { width = imagecolwidth .. "sp", height = "4cm", factor = "fit" } ) context.stoppersoon() end \stopluacode \stoptext ___________________________________________________________________________________ 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 ___________________________________________________________________________________