* How to center with picture taken into consideration @ 2013-04-27 9:50 Cecil Westerhof 2013-04-27 12:35 ` Sietse Brouwer 0 siblings, 1 reply; 3+ messages in thread From: Cecil Westerhof @ 2013-04-27 9:50 UTC (permalink / raw) To: mailing list for ConTeXt users I keep bugging the list. ;-) I center some text on a place where I also place a picture on the right site. Is it possible to center on the part that is not taken up by the picture? The picture is placed with: \definelayer[picture][ preset=righttop, width=\textwidth, ] \setlayer[picture]{\externalfigure[graphics/pasfoto]} \setupbackgrounds[text][text][background=picture] \setupbackgrounds[state=repeat] To make things a little more complicated, the placing of the picture is conditional. So it is not always done. -- Cecil Westerhof ___________________________________________________________________________________ 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] 3+ messages in thread
* Re: How to center with picture taken into consideration 2013-04-27 9:50 How to center with picture taken into consideration Cecil Westerhof @ 2013-04-27 12:35 ` Sietse Brouwer 2013-04-27 19:24 ` Peter Münster 0 siblings, 1 reply; 3+ messages in thread From: Sietse Brouwer @ 2013-04-27 12:35 UTC (permalink / raw) To: mailing list for ConTeXt users 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: How to center with picture taken into consideration 2013-04-27 12:35 ` Sietse Brouwer @ 2013-04-27 19:24 ` Peter Münster 0 siblings, 0 replies; 3+ messages in thread From: Peter Münster @ 2013-04-27 19:24 UTC (permalink / raw) To: mailing list for ConTeXt users On Sat, Apr 27 2013, Sietse Brouwer wrote: > how to obtain the an image's width and/or height from Lua. Here an example: http://modules.contextgarden.net/dl/grph-downsample.lua/tex/context/third/grph-downsample/grph-downsample.lua -- 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-04-27 19:24 UTC | newest] Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2013-04-27 9:50 How to center with picture taken into consideration Cecil Westerhof 2013-04-27 12:35 ` Sietse Brouwer 2013-04-27 19:24 ` 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).