On Sun, 10 Aug 2003 20:50:58 +0200
Jens-Uwe Morawski
On Sun, 10 Aug 2003 09:30:48 +0200 Mikael Persson
wrote: I had some problems with backgrounds in a table. I wanted just a horizontal line, but in different heights. The problem is that the > line will always be in the middle of the cell if I don't add more >
graphics. See the example file below.
the graphics are always centered in the cell. therefore you have to > set the bounding box of the graphic to the cell size
% This works, but is not nice.
\startuniqueMPgraphic{splittop} draw (0,0)--(OverlayWidth,OverlayHeight) withcolor white;%should not be necessary draw (0,0.725*OverlayHeight)--(OverlayWidth,0.725*OverlayHeight); \stopuniqueMPgraphic
the following should give what you want (untested)
\startuniqueMPgraphic{splittop} draw (0,0.725*OverlayHeight)--(OverlayWidth,0.725*OverlayHeight); setbounds currentpicture to (unitsquare xyscaled > > (OverlayWidth,OverlayHeight)) ;\stopuniqueMPgraphic
in order to save some typing you could define a macro
\startMPinclusions def FitToOverlay = setbounds currentpicture to (unitsquare xyscaled > > (OverlayWidth,OverlayHeight)) ; enddef; \stopMPinclusions
\startuniqueMPgraphic{splittop} draw (0,0.725*OverlayHeight)--(OverlayWidth,0.725*OverlayHeight); FitToOverlay ; \stopuniqueMPgraphic
Jens
Jens, Thanks a lot! I did not know that the graphics are centered in the cell. Now this mystery (to me) is not a mystery no more :) Regards, Micke P