[texhax] XeLaTeX: Simulating tab character (was: Extra vertical space in tabbing environment with \kill?)

Peter Davis pfd at pfdstudio.com
Mon Apr 11 12:29:16 CEST 2011


On Mon, Apr 11, 2011 at 5:48 AM, Ulrike Fischer <news3 at nililand.de> wrote:

> Am Sun, 10 Apr 2011 20:17:52 -0400 schrieb Peter Davis:
>
> > In other words, if my XML is
> > something like:
> >
> > <fo:block xyz:tabstop="47">
> > This is some text that's on the left, but if I insert a tab character
> > &#x0A;, it should just jump to the position 47bp in whatever line I'm on.
> > </fo:block>
> >
> > So the tab may occur on the first line, or the second, or the third,
> > depending on how the preceding text wraps.  Also, if the current line up
> to
> > this point is wider than the tab, than the tab should effectively just
> act
> > as a word separator.
>
> tabbing doesn't work this way. At first it doesn't wrap lines, at
> second if the tab is on the left it will go back and overwrite
> existing text.
>
>
Yes, I understand the LaTeX tabbing environment doesn't work that way, but
that's how tabs work in most text editors and word processors.  So what I'm
trying to achieve is more like that than like LaTeX tabbing.



> > So what I'd really love is a way to say, in effect, "from where ever we
> are
> > on the current line, jump to 47bp (if it's to the right) and continue
> > setting text.
>
> > Another way to think of this would be: "get the current position on the
> > line, subtract that from 47bp, and make a box that's as wide as that
> > difference."
> >
> > Is there any way to accomplish either of those?  That's really the effect
> > I'm after.  But I don't know any way to get the current point or current
> > length of the line.
>
> XeTeX knows the pdftex primitive \pdfsavepos. So it is possible to
> write the current position on the page e.g. to the aux-file and
> reuse it in subsequent runs. The marginnote package e.g. places the
> notes in the margin in this way.
>

Yes, I've just discovered pdfsavepos, pdflastxpos and pdflastypos.  I'm
investigating these now to see if these offer a solution.

Another thought I had was that since I'm using textpos anyway, I could start
a new text block whenever I encounter a tab character.  It would have to
align vertically with the current line of text (which would be tricky), and
then the first character would be an empty box the width of the tab.  If I
can manage the vertical alignment, it should work.  I thought perhaps
\pagetotal could be used, but I don't know what effect textpos has on that.


>
> So theoretically it is possible to move the text depending on the
> current (absolute) position. But to decide if it can be done in
> pratice one would need a much better and precise description of your
> requirements and the structure of your data first. It is not helpful
> that you at first give the impression that you only want to align
> some phone numbers and in the next post speak of general, multiline
> text.
>
>
I'm sorry.  My own understanding of the problem is getting refined as I
consider more examples.  At first, I thought the business card example was a
good illustration of the problem, but it's more general than that.  I can
start a separate discussion topic, if people prefer.

-pd


-- 
----
The Tech Curmudgeon
http://www.techcurmudgeon.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/texhax/attachments/20110411/ba1d5b8c/attachment.html>


More information about the texhax mailing list