Placing boxes anywhere on the page
Is there a way to place a box at some specified x and y position on the page, and then typeset one or more paragraphs of text into the box? I guess I'm thinking of something like LaTeX's minipage, but with the ability to specify absolute coordinates, rather than just position relative to the current baseline. Thank you, -pd
Am 16.11.2010 um 21:06 schrieb Peter Davis:
Is there a way to place a box at some specified x and y position on the page, and then typeset one or more paragraphs of text into the box? I guess I'm thinking of something like LaTeX's minipage, but with the ability to specify absolute coordinates, rather than just position relative to the current baseline.
Use layers (untested): \definelayer[textbox][width=\paperwidth,height=\paperheight] \setupbackgrounds[page][background=textbox] \def\starttextbox {\dosingleargument\dostarttextbox} \def\dostarttextbox[#1]% {\def\stoptextbox{\setlayerframed[textbox][#1]{\getbuffer[textbox]}}% \startbuffer[textbox][starttextbox][stoptextbox]} \starttext \starttextbox[x=2cm,y=4cm,width=8cm,frame=off] some text ... more text ... \stoptextbox \starttextbox[x=6cm,y=12cm,width=8cm,frame=off] another example ... \stoptextbox \stoptext Wolfgang
On Tue, Nov 16, 2010 at 3:22 PM, Wolfgang Schuster < schuster.wolfgang@googlemail.com> wrote:
Am 16.11.2010 um 21:06 schrieb Peter Davis:
Is there a way to place a box at some specified x and y position on the page, and then typeset one or more paragraphs of text into the box? I guess I'm thinking of something like LaTeX's minipage, but with the ability to specify absolute coordinates, rather than just position relative to the current baseline.
Use layers (untested):
\definelayer[textbox][width=\paperwidth,height=\paperheight]
\setupbackgrounds[page][background=textbox]
\def\starttextbox {\dosingleargument\dostarttextbox}
\def\dostarttextbox[#1]% {\def\stoptextbox{\setlayerframed[textbox][#1]{\getbuffer[textbox]}}% \startbuffer[textbox][starttextbox][stoptextbox]}
\starttext
\starttextbox[x=2cm,y=4cm,width=8cm,frame=off] some text ...
more text ... \stoptextbox
\starttextbox[x=6cm,y=12cm,width=8cm,frame=off] another example ... \stoptextbox
\stoptext
Wolfgang
Thanks, Worfgang! I just tried this. I don't see any errors, but I don't see any PDF either. Here's the log file: sorters > setting language 'en' (layertest.tex jobcontrol > resuming randomizer with 0.72399060029908 publications : loading formatting style from bxml-apa (C:/context/tex/texmf-context/tex/context/base/bxml-apa.mkiv) ConTeXt ver: 2010.07.30 11:35 MKIV fmt: 2010.11.9 int: english/english system : cont-new loaded (C:/context/tex/texmf-context/tex/context/base/cont-new.tex systems : beware: some patches loaded from cont-new.tex (C:/context/tex/texmf-context/tex/context/base/cont-new.mkiv)) system : cont-fil loaded (C:/context/tex/texmf-context/tex/context/base/cont-fil.tex loading : ConTeXt File Synonyms ) system : cont-sys.rme loaded (C:/context/tex/texmf-context/tex/context/user/cont-sys.rme (C:/context/tex/texmf-context/tex/context/base/type-def.mkiv) (C:/context/tex/texmf-context/tex/context/base/type-lua.mkiv) (C:/context/tex/texmf-context/tex/context/base/type-siz.mkiv) (C:/context/tex/texmf-context/tex/context/base/type-otf.mkiv)) system : layertest.top loaded % % begin of optionfile % % % runtime options files (command line driven) % \unprotect % % feedback and basic job control % % handy for special styles % \startluacode % document = document or { } % document.arguments={ % } % document.files={ % "layertest.tex", % } % \stopluacode % % process info % \setupsystem[inputfile=layertest.tex] % \setupsystem[\c!n=1,\c!m=1] % % modes % % options (not that important) % \startsetups *runtime:options % \setupoutput[pdftex] % \stopsetups % % styles and modules % \startsetups *runtime:modules % \stopsetups % % done % \protect \endinput % % end of optionfile % (layertest.top) fonts : preloading latin modern fonts {C:/context/tex/texmf/fonts/map/dvips/lm/lm-math.map}{C:/context/tex/texmf/fonts/map/dvips/lm/lm-rm.map}{C:/context/tex/texmf-context/fonts/map/pdftex/context/mkiv-base.map} bodyfont : 12pt rm is loaded language : language en is active systems : begin file layertest.tex at line 12 systems : end file layertest.tex at line 24 system : cont-err loaded (C:/context/tex/texmf-context/tex/context/base/cont-err.tex systems : no file 'cont-sys.tex', using 'cont-sys.rme' instead ) ) mkiv lua stats : used config file - C:/context/tex/texmf/web2c/texmfcnf.lua mkiv lua stats : used cache path - C:/context/tex/texmf-cache/luatex-cache/context/f53042fa2e1c106bc7e3383ec8c3a00c mkiv lua stats : input load time - 0.026 seconds mkiv lua stats : stored bytecode data - 231 modules, 54 tables, 285 chunks mkiv lua stats : node list callback tasks - 6 unique task lists, 4 instances (re)created, 316 calls mkiv lua stats : cleaned up reserved nodes - 33 nodes, 10 lists of 411 mkiv lua stats : node memory usage - 20 glue_spec mkiv lua stats : used backend - pdf (backend for directly generating pdf output) mkiv lua stats : loaded patterns - en::2 mkiv lua stats : callbacks - direct: 425, indirect: 4447, total: 4872 mkiv lua stats : result saved in file - layertest.pdf mkiv lua stats : loaded fonts - 33 files: stmary10.afm lmmono12-regular.otf lmmono8-regular.otf lmmono9-regular.otf lmroman12-bold.otf lmroman12-regular.otf lmroman7-bold.otf lmroman7-regular.otf lmroman9-bold.otf lmroman9-regular.otf lmsans12-regular.otf lmsans8-regular.otf lmsans9-regular.otf eufb10.tfm eufb7.tfm eufm10.tfm eufm7.tfm msam10.tfm msam7.tfm msbm10.tfm msbm7.tfm lmex10.tfm lmmi12.tfm lmmi7.tfm lmmi9.tfm lmmib10.tfm lmmib7.tfm lmsy10.tfm lmsy7.tfm lmsy9.tfm rm-lmr12.tfm rm-lmr7.tfm rm-lmr9.tfm mkiv lua stats : fonts load time - 0.262 seconds mkiv lua stats : luatex banner - this is luatex, version beta-0.63.0-2010090921 (web2c 2010) (rev 3873) mkiv lua stats : control sequences - 30982 of 165536 mkiv lua stats : current memory usage - 33 MB (ctx: 34 MB) mkiv lua stats : runtime - 0.679 seconds
Am 16.11.2010 um 21:32 schrieb Peter Davis:
Thanks, Worfgang! I just tried this. I don't see any errors, but I don't see any PDF either.
Force ConTeXt to produce a page with „\page[empty]“ or „\dontleavehmode\page“ when you have enough material for one page or when you’re at the end of your document. Wolfgang
Thanks again! Now I get output, But text isn't getting composed inside these boxes. It's just all output on one line. I tried a couple of paragraphs, and just saw the the end of one and the beginning of the next one one line. Sorry if there's some obvious remedy for this. I'm still new to ConTeXt. Thank you. -pd On Tue, Nov 16, 2010 at 3:48 PM, Wolfgang Schuster < schuster.wolfgang@googlemail.com> wrote:
Am 16.11.2010 um 21:32 schrieb Peter Davis:
Thanks, Worfgang! I just tried this. I don't see any errors, but I don't see any PDF either.
Force ConTeXt to produce a page with „\page[empty]“ or „\dontleavehmode\page“ when you have enough material for one page or when you’re at the end of your document.
Wolfgang
___________________________________________________________________________________ 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
___________________________________________________________________________________
Am 16.11.2010 um 22:12 schrieb Peter Davis:
Thanks again! Now I get output, But text isn't getting composed inside these boxes. It's just all output on one line. I tried a couple of paragraphs, and just saw the the end of one and the beginning of the next one one line.
Sorry if there's some obvious remedy for this. I'm still new to ConTeXt.
Here is a complete working and tested example: \definelayer[textbox][width=\paperwidth,height=\paperheight] \setupbackgrounds[page][background=textbox] \def\starttextbox {\dosingleargument\dostarttextbox} \def\dostarttextbox[#1]% {\def\stoptextbox{\setlayerframed[textbox][width=6cm,align=normal,frame=off,#1]{\getbuffer[textbox]}}% \startbuffer[textbox][starttextbox][stoptextbox]} \starttext \starttextbox[x=2cm,y=4cm] The Earth, as a habitat for animal life, is in old age and has a fatal illness. Several, in fact. It would be happening whether humans had ever evolved or not. But our presence is like the effect of an old-age patient who smokes many packs of cigarettes per day – and we humans are the cigarettes. \stoptextbox \starttextbox[x=6cm,y=12cm,width=8cm] Thus, I came to the conclusion that the designer of a new system must not only be the implementer and first large-scale user; the designer should also write the first user manual. The separation of any of these four components would have hurt \TeX\ significantly. If I had not participated fully in all these activities, literally hundreds of improvements would never have been made, because I would never have thought of them or perceived why they were important. But a system cannot be successful if it is too strongly influenced by a single person. Once the initial design is complete and fairly robust, the real test begins as people with many different viewpoints undertake their own experiments. \stoptextbox \page[empty] \starttextbox[x=4cm,y=6cm,width=8cm,align={right,nothyphenated},frame=on] The Earth, as a habitat for animal life, is in old age and has a fatal illness. Several, in fact. It would be happening whether humans had ever evolved or not. But our presence is like the effect of an old-age patient who smokes many packs of cigarettes per day – and we humans are the cigarettes. \stoptextbox \page[empty] \stoptext Wolfgang
On Tue, Nov 16, 2010 at 4:26 PM, Wolfgang Schuster < schuster.wolfgang@googlemail.com> wrote:
Am 16.11.2010 um 22:12 schrieb Peter Davis:
Thanks again! Now I get output, But text isn't getting composed inside these boxes. It's just all output on one line. I tried a couple of paragraphs, and just saw the the end of one and the beginning of the next one one line.
Sorry if there's some obvious remedy for this. I'm still new to ConTeXt.
Here is a complete working and tested example:
Ah! Excellent! Very cool! Thank you very much. I really appreciate it. Best, -pd
On Tue, Nov 16 2010, Peter Davis wrote:
Is there a way to place a box at some specified x and y position on the page, and then typeset one or more paragraphs of text into the box? I guess I'm thinking of something like LaTeX's minipage, but with the ability to specify absolute coordinates, rather than just position relative to the current baseline.
Layers or overlays are certainly the right method. But there is also the \position macro: \setupframed[foregroundstyle=\bfc] \setuppositioning[state=overlay, unit=cm, xoffset=0.5\textwidth, yoffset=0.5\textheight] \starttext \startpositioning \position(0,0){\framed{0,0}} \position(-5,-5){\framed{-5,-5}} \position(-5,5){\framed{-5,5}} \position(5,-5){\framed{5,-5}} \position(5,5){\framed{5,5}} \stoppositioning \input tufte \input tufte \input tufte \input tufte \input tufte \stoptext Cheers, Peter -- Contact information: http://pmrb.free.fr/contact/
On Tue, Nov 16, 2010 at 3:41 PM, Peter Münster
On Tue, Nov 16 2010, Peter Davis wrote:
Is there a way to place a box at some specified x and y position on the page, and then typeset one or more paragraphs of text into the box? I guess I'm thinking of something like LaTeX's minipage, but with the ability to specify absolute coordinates, rather than just position relative to the current baseline.
Layers or overlays are certainly the right method. But there is also the \position macro:
Thanks! I didn't find much in the ConTeXt reference manual on this. Is there more info somewhere? Thank you. -pd
On Tue, Nov 16 2010, Peter Davis wrote:
Layers or overlays are certainly the right method. But there is also the \position macro:
Thanks! I didn't find much in the ConTeXt reference manual on this. Is there more info somewhere?
Not much. A bit is in mp-cb-en.pdf Cheers, Peter -- Contact information: http://pmrb.free.fr/contact/
On 16-11-2010 9:41, Peter Münster wrote:
On Tue, Nov 16 2010, Peter Davis wrote:
Is there a way to place a box at some specified x and y position on the page, and then typeset one or more paragraphs of text into the box? I guess I'm thinking of something like LaTeX's minipage, but with the ability to specify absolute coordinates, rather than just position relative to the current baseline.
Layers or overlays are certainly the right method. But there is also the \position macro:
\setupframed[foregroundstyle=\bfc] \setuppositioning[state=overlay, unit=cm, xoffset=0.5\textwidth, yoffset=0.5\textheight] \starttext \startpositioning \position(0,0){\framed{0,0}} \position(-5,-5){\framed{-5,-5}} \position(-5,5){\framed{-5,5}} \position(5,-5){\framed{5,-5}} \position(5,5){\framed{5,5}} \stoppositioning \input tufte \input tufte \input tufte \input tufte \input tufte \stoptext
So that is still used? (If so, I should look into optimizing and cleanup as it's real old code). ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
2010/11/17, Hans Hagen
On 16-11-2010 9:41, Peter Münster wrote:
Layers or overlays are certainly the right method. But there is also the \position macro:
So that is still used? (If so, I should look into optimizing and cleanup as it's real old code).
Seems like a feature that's nice to have; it mirrors the texpos package for LaTeX. Please update it. Best Martin
On 17-11-2010 1:59, Martin Schröder wrote:
2010/11/17, Hans Hagen
: On 16-11-2010 9:41, Peter Münster wrote:
Layers or overlays are certainly the right method. But there is also the \position macro:
So that is still used? (If so, I should look into optimizing and cleanup as it's real old code).
Seems like a feature that's nice to have; it mirrors the texpos package for LaTeX. Please update it.
It does not really mirrors something (so it's not something users expect to be there I guess) ... if I remember right I made it for putting hyperlinks on specific places as I didn't want to use pictex for that. We have layers that provide a better mechanism. Anyway, it's not that much code so it can stick around (I even see a dutch comment so it's real ancient). Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
On Tuesday 16 November 2010 22:16:33 Peter Davis wrote:
Thanks! I didn't find much in the ConTeXt reference manual on this. Is there more info somewhere?
\position is (will be) fully documented in the updated reference manual. :) (I was not aware of positioning, either!) Again, we see that ConTeXt is quite rich, and our documentation lags far behind. As to layers, see: http://wiki.contextgarden.net/Layers We also have collectors: http://wiki.contextgarden.net/Collectors See also: http://www.pragma-ade.com/general/manuals/details.pdf On Wednesday 17 November 2010 09:25:23 Hans Hagen wrote:
On 17-11-2010 1:59, Martin Schröder wrote:
2010/11/17, Hans Hagen
: On 16-11-2010 9:41, Peter Münster wrote:
Layers or overlays are certainly the right method. But there is also the
\position macro: So that is still used? (If so, I should look into optimizing and cleanup as it's real old code).
Seems like a feature that's nice to have; it mirrors the texpos package for LaTeX. Please update it.
It does not really mirrors something (so it's not something users expect to be there I guess) ... if I remember right I made it for putting hyperlinks on specific places as I didn't want to use pictex for that. We have layers that provide a better mechanism.
Anyway, it's not that much code so it can stick around (I even see a dutch comment so it's real ancient).
Hans
Hans, 1. It would be natural to have \startframed\stopframed 2. A collector may be more natural than layers (used as a page background). (As seen through "Force ConTeXt to produce a page with „\page[empty]“ or „\dontleavehmode\page“ when you have enough material for one page or when you’re at the end of your document.") Is there any need for some helper macros, or do we simply need a few good examples? Alan
On 17-11-2010 10:21, Alan BRASLAU wrote:
On Tuesday 16 November 2010 22:16:33 Peter Davis wrote:
Thanks! I didn't find much in the ConTeXt reference manual on this. Is there more info somewhere?
\position is (will be) fully documented in the updated reference manual. :)
I upgraded the code a bit and it's now in pack-pos.mkiv. The \startpositioning macro also accepts an optional settings argument now. Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
participants (6)
-
Alan BRASLAU
-
Hans Hagen
-
Martin Schröder
-
Peter Davis
-
Peter Münster
-
Wolfgang Schuster