Home
Absolute positioning with textpos
Contents
1. Well almost all there is to it While the technique in the last section is enough for the default relative 1 The fact that textpos sty has ended up over 250 lines long shows that sugar can be very fattening indeed 344 I am here vbox to Opt vskip icm hbox to Opt hskip 2cm In my beginning hss vss Or there or elsewhere I am here Or there or elsewhere In my beginning Figure 3 Boxes in boxes how textpos works mode of textpos it does not address the problem of pinning the reference point for absolute mode to a fixed position on the page The most elegant way to do this was suggested by Olaf Maibaum using Martin Schr der s everyshi package also at CTAN of course The shipout is the very final stage of TEX s handling of a page When it has found an optimal page break TEX puts the page contents into the special box register box255 and calls the output routine That routine s job is to do the final assem bly of a page handling footnotes marginal notes and the rest and when it is finished it wraps it all up into a final box which it passes to the TEX primitive shipout The everyshi package gives you a last chance to tinker with the output by letting you register a sequence of commands which will be invoked at precisely this point with the contents of shipout s argument available in box255 though this is almost certainly not the same box255 which was originally
2. in figure 1 In this illustration the rules around the boxes are there because I included the showboxes option when I loaded the textpos package at the beginning of this article this is 342 In my beginning begin textblock 2 5 0 5 2 raggedright Work is of two kinds first altering the position of matter at or near the earth s surface relatively to other such matter second telling other people to do so end textblock begin textblock 2 0 5 0 5 4 2 raggedleft The first kind is unpleasant and ill paid the second is pleasant and highly paid emph Russel11 end textblock is my end In my beginning is my end The first kind ig unpleasant and ill paid the second is pleasant and highly paid Russell Work is of two kinds first altering the position of matter at or near the earth s surface relatively to other such matter second telling other people to do so Figure 1 An example of using the textblock environment useful when laying out the boxes but it is off by default In a textblock environment you specify the widths of the textblocks but not their heights which are as large as they have to be to enclose their content Here I have shown the content as simple text but the contents can be anything which can go into a vbox The positioning parameters specify the position of a notional handle which by default is located at the top left corner
3. of the block However you can move this handle to any part of the block by using the arguments ha hy as I did in the second block in figure 1 The coordinates of the handle are given as multiples of the horizontal and final vertical size of the block so that 0 0 is the top left the default 1 0 is the top right and 0 5 0 5 is the centre The fractions don t have to be restricted to the range 0 lt f lt 1 Each of the environments takes up zero space so that the reference point the point relative TUGboat Volume 23 2002 No 3 4 to which the boxes are positioned is the same for each of the environments as long as there is no material between them or more precisely no material with a vertical extent greater than Opt This is why the text is my end appears close to the text in the top left observe however that they are not immediately adjacent and the presence of the textblock environments has inserted a single paragraph break If a textblock appears when TEX is typesetting the text of a paragraph that is it is in horizontal mode then the environment ends the paragraph as if you had typed par at that point or inserted a blank line While I m talking about spacing note that there is nothing inhibiting you from or defending you against overlapping the text of the boxes so that there is necessarily an element of visual layout involved in using the environment 2 1 Lengths The w
4. TUGboat Volume 23 2002 No 3 4 Absolute positioning with textpos Norman Gray Abstract I describe the textpos package which allows you to place blocks of text at arbitrary positions on the page I give an overview of its functionality and discuss a few points of TEXnical interest 1 Introduction TEX has many wonderful features but the one most often and most forcefully advanced to potential converts is that they need no longer fret about layout Concentrate on the text the layout is not your concern we say Produce your deathless text in a golden stream and let IATEX handle the minutiae of fonts and linebreaking and spacing This is true but in those few cases where the 341 layout actually is part of the point this block of text must go here the logo just there authors find themselves embroiled in an unseemly struggle with an application which suddenly seems officious rather than helpful resorting to increasingly shrill demands newline damnit and more or less desperate hackery This is where textpos can help In 1998 I was involved in just such a strug gle with TEX laying out text on an AO sheet to produce a conference poster The package I produced I released as textpos and it has become a common way to achieve this sort of position ing control The package is available from CTAN at macros latex contrib textpos and also from the textpos home page http www astro gla ac uk use
5. hich is elegantly restrained TUGboat Volume 23 2002 No 3 4 If your layout requirements are more specific than this then you may want to use the starred vari ant of the textblock environment This is just like the unstarred version except that the block width and positioning parameters are given as absolute lengths in any TEX units such as pt or em rather than as multiples of the horizontal and vertical mod ules the optional arguments remain relative to the size of the final block 2 2 Absolute positioning As I explained above the position arguments are by default relative to a reference point which is iden tified as the current position on the page which is unchanged by the presence of the textblock For some applications such as laying out a conference poster it is most useful if the reference point can be guaranteed to be in a particular location and guaranteed not to move and it is for this reason that textpos also has an absolute mode You put textpos in this mode with usepackage absolute textpos after which all textblocks are positioned relative to a single origin on the page irrespective of any material that separates them This origin is by default located at the top left corner of the paper that is 25 4mm ahem leftwards and upwards of TEX s usual nominal reference point but you can adjust it with the textblockorigin x y command which takes two arguments giving the horizo
6. idths and positions which are arguments to the textblock environment are given in units of TPHorizModule for the horizontal lengths and TPVertModule for the vertical ones These are TEX dimen s so you can set their values in the usual way with setlength You usually will want to do this since the default values of 1 6 of the paperwidth and paperheight respectively are not likely to be particularly useful For example the figures above were preceded by setlength TPHorizModule columnwidth divide TPHorizModule by 5 setlength TPVertModule baselineskip to adapt the positioning to the typographical en vironment Alternatively you could use the calc package and write this more straightforwardly as setlength TPHorizModule columnwidth 5 textpos is compatible with calc thanks to code from Rolf Niepraschk You can also use these dimen sions directly in nspace 2 TPHorizModule for example if that helps to give your document more consistency Using these modules makes your arrangement of blocks easily rescalable and it helps fit the blocks neatly into a larger structure however they can also help your layout look better Although you can give fractional positions as I illustrated in figure 1 your layout will tend to look more coherent if you pick a suitable module and try to restrict yourself to integer multiples of it This can make the difference between a layout which looks busy and cluttered and one w
7. ntal and vertical position of the origin relative to the top left corner of the paper The dimensions x and y must have units they are not multiples of any module The command TPGrid bh bv 1 nh nv is an alternative way of setting the TPHorizModule and TPVertModule lengths particularly useful in absolute mode This firstly sets the modules so that nh x TPHorizModule 2 bh paperwidth nv X TPVertModule 2 bv paperheight and secondly calls textblockorigin bh bv so that the modules form a nh x nv grid on the paper with a border bh wide and bv deep around it If the optional border argument is absent it defaults to Opt Opt The textblockorigin command is available only in absolute mode but the TPGrid command is available in relative mode also For other hints on formatting posters see 2 There are a few other textpos details to do with colouring in boxes and overlaying them or not for those see the textpos documentation 343 0 5cm lt gt re hskip3cm hello an o O M hss Figure 2 Positioning text in and out of boxes 3 Implementation The textpos package is not a complicated one and is at heart a wrapper round two simple but powerful techniques namely positioning with glue and boxes and hooking into the output routine using everyshi I will describe these here in case they are of wider TEXnical interest 3 1 The basics of positi
8. oning At one level a TEX page is no more than a sequence of boxes glue and a few more exotic things that need not concern us here Each box has a height a depth a width and at this level nothing else The material inside these boxes consisting of characters rules and other boxes is what we ultimately wish to see on the page but there is no requirement for this material to lie strictly within the boundaries of the box it is associated with furthermore glue can be negative in extent as well as positive and these two observations together give us a technique for positioning things Consider the TEX box hbox to 0 5cm hskip 3cm hello hss which is illustrated in figure 2 That creates an hbox which is exactly 0 5cm wide and puts into it a skip and some text which are together substan tially larger than the box This would create an overfull hbox were it not for the infinitely shrink able glue the hss at the end This inserts what ever glue is required to make the whole construction have zero badness The end result is that we have placed the text hello at a point 3cm to the right of the reference point of the hbox which as far as TEX is concerned is only 0 5cm wide We can do exactly the same thing with vboxes and vss glue and putting these together get the result in figure 3 That plus a little bit of syntactic sugar and some spacing magic is textpos 3 2 Absolute positioning and shipout
9. prepared for the output routine It is the content of this box after you ve made any ad justments that is passed to the primitive shipout This is a tremendously powerful mechanism In absolute mode textpos converts each text block into a zero height vbox as usual in fact into the temporary box0 but instead of contributing them to the current page it accumulates them in a holding box global setbox TP holdbox vbox box0 unvbox TPGholdbox However in this mode textpos has also registered some commands with the everyshi hook EveryShipout global setbox255 vbox unvbox TP holdbox unvbox255 Thus whenever the output routine is called either because a page has filled up or because the input file has come to an end it constructs its final box and TUGboat Volume 23 2002 No 3 4 calls shipout At this last moment this fragment of code prepends the textpos hold box to the everyshi box255 and lets this enlarged box be the one shipped out 3 3 So textpos has pulled off the rather un T X like trick of supporting the non automatic layout of text and it has done so without outrageous trickery by sim ply exploiting the core functionality of TEX s page layout algorithm constrained gluing together of boxes of given sizes in an unexpected way As a result understanding textpos requires or prompts an understanding of that algorithm with its pa rameters baselineskip prevdepth and f
10. riends and this together with the use of other common techniques such as TEX arithmetic and token lists means that it manages simultaneously to solve a non trivial problem usefully and to be instructive And that s a good position to be in References 1 Norman Gray textpos User Manual version 1 4 2003 Distributed with the textpos pack age 2 Norman Gray Using TEX to produce confer ence posters 2003 http www astro gla ac uk users norman docs posters Norman Gray Department of Physics and Astronomy University of Glasgow Glasgow UK norman astro gla ac uk http www astro gla ac uk users norman
11. rs norman distrib latex In this article Pll give a quick overview of the functionality of textpos Then I ll make a few observations on the way that textpos is implemented and on its relationship with the everyshi package 2 Using textpos The textpos package is not a complicated one since in outline it consists of only a single environment plus a starred variant and a few configuration pa rameters The manual distributed with the pack age 1 gives the details I need only outline the principles here The package defines an environment textblock which contains the text or other material which is to be placed in a block and takes parameters which specify the width of the block and its position relative to a reference point The syntax is as follows begin textblock width ha hy C x y end textblock The width gives the width the block is to have and the x and y parameters give the position of the block s handle relative to the reference point The handle is by default the top left corner of the block but may be moved using the optional argument in square brackets as usual the reference point I will return to in a moment Notice that the position ing arguments for the textblock environment the coordinates x y are in parentheses rather than curly braces in slight imitation of the picture environment The salient features of this syntax and its effects are illustrated
Download Pdf Manuals
Related Search
Related Contents
HP Multimedia Speakers LC シャッターズ Fantom Vacuum FM430K Vacuum Cleaner User Manual CATáLOGO DE FERRAMENTAS DE CORTE & FITA Manual del usuario Higrómetro sin agujas + Humectación + IR DVB-S/S2, DVB-T/T2 and DVB-C signal Spectrum - Clarke-Tech Tarage et calcul des débits des stations hydrométriques non Samsung SGH-J610 Korisničko uputstvo Toshiba A200 Personal Computer User Manual Copyright © All rights reserved.
Failed to retrieve file