This one has long been, and still was, in my “to do” list…
I said that this question caught my imagination, and indeed I am here again with another proposal for a solution, based on a different approach; and exactly because the approach is different, I deem this is one of those rare cases in which it is more correct to post a new answer that to edit the one I have already given (all the more so, in that it would be the fifth major addition!). I am also going to keep my promise to supply, this time, a complete and independent package that provides the required functionality.
Analysis of the other solutions
Before presenting the new solution, however, I’d like to discuss briefly why I think that the ones that have already been given (including mine) are not completely satisfactory.
Drawbacks of my solution
The solution presented in the other answer I gave is based on a simple principle: in order to jump to a tab position, we do the following:
we interrupt the current paragraph, breaking into lines the
part of it that comes before the tabbing command;
we measure the width of the last line, to see if it reached
as far from the left margin as to have already gone past the
tab position;
if it has not, we backspace by one line of text, in order to
print the continuation line at the same vertical position as
the line that came before the tab;
we typeset the continuation line starting with an
indentation equal to the tab position.
The critical points in this algorithm are step 2 and 3: in step 2, in order to measure the width of the last line, that is, of the last box in the paragraph, you need to retrieve that box from the current vertical list; in step 3, in order to find out the exact amount of vertical backspace required to align perfectly the continuation line with the line that came before the tab, you need to inspect, and hence retrieve as well from the current vertical list, the so-called “interline glue” that TeX has inserted before the latter. But both of this operations are forbidden (leaving TeXnical details alone) in the normal mode of operation TeX is in when it is stacking paragraphs on the page: you need to enter “internal vertical mode”, and this accounts for the restrictions that had to be imposed on the contents of a JumpingParagraphs environment. These restrictions could be somewhat lifted by taking a slightly different approach (which, however, would increase the burden put on TeX’s memory), but even in this case two things would remain impossible:
These limitations could be acceptable, if they were effective; unfortunately, even with this method it cannot be guaranteed that the right alignment would be achieved in all cases, as the last example presented in my other answer shows.
Drawbacks of @benjamin’s answer
The answer based on the use of zref-savepos measures, at \shipout-time, the horizontal position at which the “start” of the tabulation occurs, and uses this information to insert, during a subsequent LaTeX run, a horizontal space that is supposed to shift the ensuing text at the position one wants to tabulate to. However, the insertion of this space might alter TeX’s line-breaking decision, in such a way that, in the second run, the position of the “start” of the tabulation might change, thus invalidating the previous computation of the amount of horizontal space that should be inserted. Another LaTeX run is therefore required to compute a new value for this horizontal space, but the new value might again change TeX’s line-breaking decisions, and so on. Thus we see that the process is inherently iterative, and this has essentially one downside: there is no guarantee that this iterative process will come to an end, eventually finding a value for the horizontal space that remains the same on subsequent runs. Indeed, it is possible to build examples in which this process does not “converge”; even worse, since the exact horizontal position measured by zref-savepos depends on the computations for glue setting, that can be rounded differently on different machines, it is even possible that, for the same given input file, the process “converges” on some machines and not on others.
The approach used in this answer
This answer uses a hack based on a low-level feature of TeX which permits (provided that some conditions are met) to measure the length of the last line of a partial paragraph even in “outer” vertical mode, that is, in the mode TeX operates in while it is stacking paragraphs in the usual way: see The TeXbook, p. 188, second paragraph, description of \predisplaysize for details. Before measuring that line, the current partial paragraph is divided into lines (well, it wouldn’t make any sense to speak of its “last line”, otherwise!), and the line breaks that have been chosen are “frozen” so that they can no longer change. This approach has the following pros and cons:
It can be used in the normal mode LaTeX operates in,
allowing all usual constructs (lists, floating objects,
footnotes…) to intervene without disturbing the alignment
mechanism.
It works in a single LaTeX run: therefore, it simply
cannot suffer from any “convergence” problem.
On the other hand, since the low-level TeX feature
on which it is based is not available under some
circumstances, also this solution will not work under
those same circumstances. Anyway, the code is capable
of detecting when this happens, and will consequently
issue an appropriate error message.
The package code
As already said above, this time I have written a complete package that implements the proposed solution, called ghoritab. Here is the code:
%%
%% This is file `ghoritab.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% ghoritab.doc
%%
%% IMPORTANT NOTICE:
%%
%% For the copyright see the source file.
%%
%% Any modified versions of this file must be renamed
%% with new filenames distinct from ghoritab.sty.
%%
%% For distribution of the original source see the terms
%% for copying and modification in the file ghoritab.doc.
%%
%% This generated file may be distributed as long as the
%% original source files, as listed above, are part of the
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
%% \CharacterTable
%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%% Digits \0\1\2\3\4\5\6\7\8\9
%% Exclamation \! Double quote \" Hash (number) \#
%% Dollar \$ Percent \% Ampersand \&
%% Acute accent \' Left paren \( Right paren \)
%% Asterisk \* Plus \+ Comma \,
%% Minus \- Point \. Solidus \/
%% Colon \: Semicolon \; Less than \<
%% Equals \= Greater than \> Question mark \?
%% Commercial at \@ Left bracket \[ Backslash \\
%% Right bracket \] Circumflex \^ Underscore \_
%% Grave accent \` Left brace \{ Vertical bar \|
%% Right brace \} Tilde \~}
%%
%% \CheckSum{311}
\NeedsTeXFormat{LaTeX2e}\relax % LaTeX2e is required!
\ProvidesPackage{ghoritab}
[2016/04/21 v0.03 (development)]
\@ifdefinable\@gHT@ghoritab{\def\@gHT@ghoritab{ghoritab}}
\RequirePackage{ifetex}\relax
\ifetex \else
\PackageError\@gHT@ghoritab{%
Not running under e-TeX%
}{% Write a better help message.
The \@gHT@ghoritab\space package requires
e-TeX extensions.\MessageBreak
This is a fatal error: the recommended action
is to type\MessageBreak
X <return> \space to quit. \space
If, instead, you choose to continue\MessageBreak
the \@gHT@ghoritab\space package will _not_ be loaded.%
}
\expandafter\endinput
\fi
\providecommand*\newrigidlength[1]{\@ifdefinable #1{\newdimen #1}}
\newrigidlength\@gHT@common@height
\newrigidlength\@gHT@common@depth
\newsavebox{\@gHT@preceding@text}
\newsavebox{\@gHT@following@text}
\@ifdefinable\@gHT@strut{\def\@gHT@strut{%
\vrule \@width\z@
\@height\@gHT@common@height \@depth\@gHT@common@depth
}}
\@ifdefinable\@gHT@measure@box{\def\@gHT@measure@box#1#2{%
\setbox#1\hbox{#2}%
\@gHT@common@height
\ifdim\ht#1>\ht\strutbox \ht#1\else \ht\strutbox \fi
\@gHT@common@depth
\ifdim\dp#1>\dp\strutbox \dp#1\else \dp\strutbox \fi
}}
\@ifdefinable\@gHT@action{}
\newcommand*\@gHT@parse@left[1][]{%
\leavevmode
\@gHT@measure@box\@gHT@preceding@text{%
\color@begingroup #1\unskip \color@endgroup
}%
\@gHT@parse@right
}
\newcommand*\@gHT@parse@right[2][]{%
\@gHT@measure@box\@gHT@following@text{%
\color@begingroup \@gHT@strut\nobreak #1\color@endgroup
}%
\@gHT@measure@box\@gHT@preceding@text{%
\unhbox\@gHT@preceding@text \@gHT@strut
}%
\unhbox\@gHT@preceding@text
\begingroup
$$%
\abovedisplayskip \z@skip
\abovedisplayshortskip \z@skip
\belowdisplayskip \z@skip
\belowdisplayshortskip \z@skip
\predisplaypenalty \@M
\postdisplaypenalty \@M
\global \dimen@i \predisplaysize
\offinterlineskip
$$%
\count@ \prevgraf
\advance \count@ -\thr@@
\dimen@
\ifdim \dimen@i=-\maxdimen \z@ \else \dimen@i \fi
{\@@par}%
\parskip \z@skip
\ifdim \dimen@=\maxdimen
\@gHT@doNOT@vbackspace
\noindent
\@gHT@PDS@error{}%
%% \else \ifnum \gluestretchorder\leftskip>\z@
%% \@gHT@RLS@err % should include call to \@gHT@left@line
%% \else \ifnum \glueshrinkorder\leftskip>\z@
%% \@gHT@RLS@err
\else
\advance \dimen@ -\tw@ em
\@gHT@action{#2}%
\fi % \fi\fi
\prevgraf \count@
\endgroup
\unhbox\@gHT@following@text
\let \@gHT@action \@undefined
}
\@ifdefinable\@gHT@ll@horitab{\def\@gHT@ll@horitab#1{%
\dimen@ii #1\relax
\ifdim \dimen@<\dimen@ii
\@gHT@DO@vbackspace
\else
\@gHT@doNOT@vbackspace
\fi
\@gHT@indent@to@tab
}}
\@ifdefinable\@gHT@ll@settab{\def\@gHT@ll@settab#1{%
\global #1=\dimen@
\dimen@ii \dimen@
\@gHT@DO@vbackspace
\@gHT@indent@to@tab
}}
\@ifdefinable\@gHT@DO@vbackspace{\def\@gHT@DO@vbackspace{%
\skip@ \@gHT@common@height
\advance \skip@ \@gHT@common@depth
\vskip -\skip@
\nointerlineskip
\advance \count@ \m@ne
}}
\@ifdefinable\@gHT@doNOT@vbackspace{\def\@gHT@doNOT@vbackspace{%
\prevdepth \@gHT@common@depth
}}
\@ifdefinable\@gHT@indent@to@tab{\def\@gHT@indent@to@tab{%
\advance \dimen@ii -\leftskip
\advance \dimen@ii -\parshapeindent\numexpr\count@+\@ne\relax
\parindent \dimen@ii
\indent
}}
\@ifdefinable\@gHT@PDS@error{\def\@gHT@PDS@error#1{%
\PackageError{\@gHT@ghoritab}{%
Cannot measure horizontal position%
}{%
To measure the horizontal position of a tab,
this package relies\MessageBreak
on a primitive feature of TeX that is not available
in some situations.\MessageBreak
This entails that it is impossible either to set,
or to jump to,\MessageBreak
a tab position in any of the following contexts:\MessageBreak
\MessageBreak
\space\space - when either \protect\centering\space or
\protect\raggedleft\space (or similar declarations)\MessageBreak
\space\space\space\space is in force;\MessageBreak
\MessageBreak
\space\space - when the current position on the line has already
abutted the\MessageBreak
\space\space\space\space current right margin;\MessageBreak
\MessageBreak
\space\space - when you have applied some special settings to the
last line\MessageBreak
\space\space\space\space of paragraphs (e.g., non-infinitely
stretchable \protect\parfillskip\MessageBreak
\space\space\space\space glue or non-zero
\protect\lastlinefit;\MessageBreak
\MessageBreak
\space\space - in every other situation in which
\protect\predisplaysize\space is made\MessageBreak
\space\space\space\space equal to \protect\maxdiman.\MessageBreak
\MessageBreak
Type \space <return> to proceed, but expect unexpected results.%
}%
}}
\newcommand*\gotoghtab{%
\let \@gHT@action \@gHT@ll@horitab
\@gHT@parse@left
}
\newcommand*\setghtab{%
\let \@gHT@action \@gHT@ll@settab
\@gHT@parse@left
}
\endinput
%%
%% End of file `ghoritab.sty'.
Unfortunately, the 30000 character limit did not permit me to include any comments, but a version of the above code that is extensively commented and is formatted according to the usual DocStrip conventions also exists. The code shown above (which was extracted from the documented source) should be saved in a file called ghoritab.sty, inside a directory where TeX can find it when compiling your source code; as usual, this means either:
a) in the same directory as the .tex source you want to compile;
b) in your personal texmf tree, say in
$TEXMFHOME/tex/latex/ghoritab.sty
or more deeply nested position;
c) in your local (machine-wide) texmf tree, e.g.,
$TEXMFLOCAL/tex/latex/ghoritab.sty
or a more deeply nested position
(of course, in this case appropriate access privileges are needed).
Using the package
The main command provided by the package is named \gotohtab. In its simplest form, its usage is as follows:
\gotohtab{<dimen>}
where <dimen> is a (rigid) length specified either explicitly, e.g., 5cm, or through a “length command”, e.g., \myLength. The effect of this command is to jump to a horizontal position that is <dimen> away from the prevailing left margin, irrespective of changes in the current left margin due to lists, unusual \parshapes, etc.; if the text in the current line has already surpassed this horizontal position, the command jumps to the same position on the next line.
There is a corresponding command named \setghtab that globally sets the value of a length command passed in its (mandatory) argument to the distance from the prevailing (see comments above) left margin of the position on the line at which the command is given. Usage (without optional arguments, see below):
\setghtab{<length-command>}
The <length-command> passed as the argument of \setghtab need not be (although it can be) a “rubber length”: a “rigid” length (TeX’s <dimen>) suffices. For this reason, the package defines the declaration \newrigidlength, which is analogous to \newlength, but allocates a rigid length command (that is, a <dimen> register) instead of a rubber one (that is, instead of a <skip> register). Thus, you can say
\newrigidlength{\mytabposition}
to allocate a length command named \mytabposition to be subsequently used with \setghtab/\gotoghtab. Note that
\newlength{\mytabposition}
will work too, but the former declaration should appeal to people concerned about sparing <skip> registers… :-)
One more point remains to be covered: the optional arguments of the \gotoghtab and \setghtab commands, and how they are used to overcome an inherent limitation of the method we have employed: it’s not able to cope automatically with the case of “unusual” line spacing.
When used without optional arguments, the \gotoghtab and \setghtab commands assume that the line they occur on contains text with “normal” height and depth. If this is not the case, for example because of a tall in-line formula, you may end up with the two halves of that line that are misaligned. The optional arguments provide a workaround for this: it suffices to place the portion of text that is causing trouble, because of its anomalous vertical dimensions, inside those arguments, more precisely inside the first one if it is text that precedes the tab position, and inside the second one if it is text that follows it. For example
\gotoghtab[unusual text before][unusual text after]{\mytabposition}
If only one optional argument is present, it is assumed to refer to the “text before”. Note that including more text than actually necessary does no harm: in practice, you should start with no optional arguments and, when you see a misalignment in the output, move some amount of text inside one of them until the problem vanishes, without worrying of moving too much of it.
An example
The following sample code illustrates the use of the ghoritab package:
\documentclass[a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage{ghoritab}
\usepackage{color}
\definecolor{subdued}{gray}{.75}
\newrigidlength{\tabposA}
\newrigidlength{\tabposB}
\newrigidlength{\tabposC}
\newcommand{\meta}[1]{(\langle\textit{#1/}\rangle)}
\newcommand{\vissettab}[1]{\rule[-.5ex]{.2pt}{2ex}\setghtab{#1}}
\hfuzz = 0pt
\vfuzz = 0pt
\begin{document}
\section{Basic usage}
\label{S:Basic}
First try:\gotoghtab{5cm}and then continue the paragraph with more text, that
reaches at least as far as to the second line. Some more text, and now another
jump\gotoghtab{5cm}to the same position.
Next, let's show how to set a tab position in the middle of an ordinary
paragraph: you simply have to write
\verb|\setghtab{|\meta{length-command}\verb|}| at the exact spot where you want
the tab to be set. For instance, we put one immediately after this little
vertical rule:~\vissettab{\tabposA} The paragraph may continue afterwards as
usual; note, however, that all the line breaks that precede the tab stop have
been ``frozen'' (lest the tab position change place!). In this case, the tab
position has been set at \the\tabposA\ from the left margin. Note that the
\meta{length-command} is always set equal to the tab position \textbf{globally}.
You may then tab to\gotoghtab{\tabposA}that same horizontal position and, if the
position you want to tab to has already been passed, a jump to the same
position, but on the next line, will occur. A single paragraph can contain as
many \verb|\gotoghtab| commands as you want; for instance, this one contains
two: the one above, and another one\gotoghtab{\tabposA}here.
Get closer\gotoghtab{\tabposA}and closer and closer and closer and closer and
closer and closer\gotoghtab{\tabposA}and closer and closer and closer and closer
and closer and closer and\gotoghtab{\tabposA}closer and closer and closer and
closer and closer and closer and closer and\gotoghtab{\tabposA}closer and closer
and closer and closer and closer and closer and closer and
closer\gotoghtab{\tabposA}and this time we jump to the next line because the tab
position has already been passed. Now we'll repeat this same paragraph, but
using the optional arguments of the \verb|\gotoghtab| command.
Get \gotoghtab[closer][and closer and closer and closer and closer]{\tabposA}
and closer \gotoghtab[and closer][and closer]{\tabposA} and closer and closer
and closer and closer \gotoghtab[and closer and][closer]{\tabposA} and closer
and closer and closer and closer and closer and closer \gotoghtab[and][closer
and closer and closer]{\tabposA} and closer and closer and closer and closer and
\gotoghtab[closer][and this time]{\tabposA} we jump to the next line because the
tab position has already been passed. Now we'll repeat this same paragraph, but
using the optional arguments of the \verb|\gotoghtab| command.
No, this time we actually don't. Rather, let's set another tab stop a little
closer to the right margin, let's say just here.~\vissettab{\tabposB}
Now we want to show that:
%
\begin{enumerate}
\item
the tab is honored\gotoghtab{\tabposB}even inside lists;
\item
this is true at all levels\gotoghtab{\tabposB}of nesting,
\begin{itemize}
\item as you can see\gotoghtab{\tabposB}here,
\item and again\gotoghtab{\tabposB}here,
\item and also in a case in which the tab
position\gotoghtab{\tabposB}has already been passed, as here;
\end{itemize}
\item
this remains true, of course, also with longer list items that take up
more than one line, as it happens with the present item, in which the
jump to the tab position doesn't occur until\gotoghtab{\tabposB}here.
\end{enumerate}
%
Back to the outer\gotoghtab{\tabposB}level.
\section{Usage with an explicit \texttt{\char`\ parshape}}
\label{S:parshape}
Here we use the \emph{second} tab position that we set in the previous section
(the one closer to the right margin) with a custom \verb|\parshape| that we
explictly set. We recall that the tab positions falls\gotoghtab{\tabposB}here.
\begingroup
\setlength\parindent{0pt}
\parshape 15
10mm 130mm 15mm 124mm 20mm 118mm 25mm 112mm 30mm 106mm
35mm 100mm 40mm 94mm 45mm 88mm 50mm 82mm 55mm 77mm
60mm 71mm 65mm 65mm 70mm 59mm 75mm 53mm 80mm 47mm
%
In this paragraph the left margin moves towards the center at a pace of
$5,\mbox{mm}$ per line, and the right margin does the same at a pace of
$1,\mbox{mm}$ per line. Does this interfere with our tabulation mechanism?
Well, it depends: for what concern the tab position
itself,\gotoghtab{\tabposB}it doesn't, as you can see here, and, continuing on
the next line,\gotoghtab{\tabposB}also here. On the other hand, sooner or later
\verb|Overfull \hbox| warnings are guaranteed to appear, for the simple
reason\gotoghtab{\tabposB}that the line becomes too narrow for the tab
position\gotoghtab{\tabposB}that has been set. But in this example we give
up\gotoghtab{\tabposB}before this happens, because we don't like such warnings!
In exchange, we \emph{set} a new tab stop right here:~\vissettab{\tabposC} we'll
use this new tab position after resuming the normal margins.
\endgroup
As you expect, the tab position\gotoghtab{\tabposC}set up inside the paragraph
having custom \verb|\parshape| is honored in ``normal'' paragraphs too, as you
can see again\gotoghtab{\tabposC}here, and also\gotoghtab{\tabposC}here.
\section{Setting the tab inside a list}
\label{S:Lists}
Generalizing what we saw in section~\ref{S:Basic}, we want to show that\ldots
%
\begin{itemize}
\item
\ldots you can also \emph{set} a tab stop inside a list\ldots
\item
\ldots also, let's say\ldots
\begin{itemize}
\item \ldots at the second level, as we do here~\vissettab{\tabposC}
\item (another item).
\end{itemize}
\item
then you can:
\begin{enumerate}
\item use that stop\gotoghtab{\tabposC}at the same level
\item (but with a different kind of list,\gotoghtab{\tabposC}as
here); \emph{or}
\item use that tab at an inner level,
\begin{itemize}
\item as it is done\gotoghtab{\tabposC}here
\item (and here is another\gotoghtab{\tabposC}example);
\emph{or}
\end{itemize}
\end{enumerate}
\item
use always the same tab stop at\gotoghtab{\tabposC}an outer level;
\emph{or}, finally\ldots
\end{itemize}
%
\ldots use it at the level of normal text, that is,\gotoghtab{\tabposC}at the
outermost level.
Well, until now, everything seems fine, and our tab mechanism seems to perform
pretty well: you say Jump!'',\gotoghtab{\tabposC}and it jumps where you want; you orderAgain!'',\gotoghtab{\tabposC}and it does it again, perhaps on the
next line; you can also set several tab positions within the same paragraph,
say, one here~\vissettab{\tabposA} and another one here~\vissettab{\tabposB}
(plus the one set inside the list, that, don't forget,
lies\gotoghtab{\tabposC}here); the tame ``printing head'' will
jump\gotoghtab{\tabposA}here,\gotoghtab{\tabposB}and
here,\gotoghtab{\tabposC}and here. But the next section will reveal a drawback
of the algorithm\ldots
\section{Making up for incorrect line spacing}
\label{S:Interline}
When used without optional arguments, the \verb|\gotoghtab| and \verb|\setghtab|
commands assume that the line they occur on contains text with ``normal'' height
and depth. If this is not the case, for example because of a tall in-line
formula like ( \displaystyle \frac{x}{y}-\frac{y}{x} = \frac{(x+y)(x-y)}{xy}
), say,\gotoghtab{\tabposB}as you can see here the two halves of that line will
not be aligned. Let us make another test using rules (a few more words, in
order to get to the next
line):~\rule[-5mm]{.4pt}{5mm}\gotoghtab{\tabposB}\rule{.4pt}{5mm}~The optional
arguments have been introduced exactly to provide a workaround for this.
When used without optional arguments, the \verb|\gotoghtab| and \verb|\setghtab|
commands assume that the line they occur on contains text with ``normal'' height
and depth. If this is not the case, for example because of a tall in-line
formula \gotoghtab[like ( \displaystyle \frac{x}{y}-\frac{y}{x} =
\frac{(x+y)(x-y)}{xy} ), say,\rlap{\textcolor{subdued}{..\kern 1.6pt
aas}}]{\tabposB}as you can see here the two halves of that line will not be
aligned. Let us make another test using rules (a few more words, in order to
get \gotoghtab[{to the next
line):~\rule[-5mm]{.4pt}{5mm}}\rlap{\textcolor{subdued}{.....\rule{.4pt}{5mm}}}]
[\rule{.4pt}{5mm}~The optional]{\tabposB} arguments have been introduced exactly
to provide a workaround for this.
\end{document}
The following pictures show the three pages you should obtain by typesetting it:

tabtopackage to my attention. It seems to do (part of) the job I need pretty well. See also Werner's answer there. – benjamin Dec 01 '16 at 09:03