I have a longtable with some columns, all of fixed with (e.g. p{3cm}), so all rows are of the same known width. I want to add a textual watermark (like "New") behind some rows. Of course the rows can have different heights; the watermark should be horizontally and vertically centered. How can I achieve this?
|
|
||||
|
|
|
Using Tikz, you can define the
The height seams to be a little bit off on the lower rows. I just took the code from @egreg, I didn't know how to get the rowheight. The draw is on the node to show the box it creates so you can see the difference with the actual height. The example would look like this:
Edit: Obviously the difference in the single row column is due to the fact that I used caps in the watermark text, which are higher than the row dimensions. As long as you don't use a watermark that doesn't fit in the row, you will be fine. Update: To rotate the text is not completely trivial. I don't know of any way to rotate just the text and not the accompanying box. If you turn off the Alternatively, we could draw two nodes, one with an empty text and one with just the text in it, but not the same size (we have to calculate the placement of course, again not extremely difficult). The only real advantage this has is that it allows you to keep the box! Again, you probably don't care about the box
The placement of the text isn't completely equivalent, I suspect there is an |
|||||||
|
|
You can use the old trusted picture environment to position the text behind the row.
How to position the text exactly in the middle and center of the row can be automated, but I am not sure if it is worth the trouble. I am also not sure, if it looks right though; I tend to agree with @egreg that at the margin it may look better, especially with a right pointing arrow or small graphic.
It will look better if the background text is rotated a bit. For this you can use the
Just include the package and change the code as follows:
|
||||
|
|
TeX doesn't know the width of a table until it has ended processing it. It's possible to put a watermark in the left margin of a tabular row:
By changing Notice that
If the width is known in advance, for instance the tabular is
then you can define
since |
|||||||||||||||||
|



