Page LayoutChecking the absolute position of text

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
kaiserkarl13
Posts: 707
Joined: Tue Mar 25, 2008 5:02 pm

Checking the absolute position of text

Post by kaiserkarl13 »

This is probably impossible, given how TeX works, but here's what I want to do:

I'm writing a document class for printing on letterhead in LaTeX, and I want TeX to insert space between the date/address and the greeting, if necessary, so that the greeting starts at or below a certain distance from the top of the page. For example, let's say my date and addresses take me to 2.73 inches from the top of the page; I would then insert 0.27in of space before printing the greeting. If I'm at 2.96 inches, I insert 0.04in. If I'm more than 3in from the top, I insert nothing.

Is this possible?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
Stefan Kottwitz
Site Admin
Posts: 10290
Joined: Mon Mar 10, 2008 9:44 pm

Checking the absolute position of text

Post by Stefan Kottwitz »

For relative positioning in arbitrary text, I would use \tikzmark and set additional text using a TikZ overlay on the page. Example: Highlighting in a matrix.

Stefan
LaTeX.org admin
kaiserkarl13
Posts: 707
Joined: Tue Mar 25, 2008 5:02 pm

Re: Checking the absolute position of text

Post by kaiserkarl13 »

I'm not trying to connect two points of text here---I'm trying to determine how much vertical space (including text/images/etc.) has been inserted since the page started, and then (if necessary) insert more whitespace before the next block of text.

I don't see how to do that from the example in the previous post.

Think of it this way: I want a certain line of text to start at (or below) 3 inches (say) from the top of the page. This would be trivial if there were no other text on the page above the 3-inch mark, but of course, there IS other text on the page above it.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10290
Joined: Mon Mar 10, 2008 9:44 pm

Re: Checking the absolute position of text

Post by Stefan Kottwitz »

Hi,

just quickly at the moment, yes, it's not about connecting something. What I meant, is setting a coordinate (depending on content) and using it. With if-then, or a calculation, and finally printing something as an overlay.

Maybe we (or another reader) could work on a real small code sample.

Stefan
LaTeX.org admin
Post Reply