Poster text positioning: Get width of \hfill

The TeX compiler pdfTeX (inventor), LuaTeX and XeTeX support the feature \pdfsavepos that allows to record the absolute positions in the .aux file. Module zref-savepos of package zref provides an easier interface. The positions are numbers, unit is 1sp.

It helps, if there are fixed positions that can be used for the correction of the position of the string "0123456789". For the horizontal correction the positions ABC and 012 are used whose horizontal component does not change.

In case of the vertical correction it is more difficult, because the alignment is on the baseline and the vertical position depends on the height of the first line, for example. The following example measures the differnce before the first paragraph and the base line inside the text block and fixes the vertical position of "0123456789" by assuming the text blocks start at the same vertical position (10cm).

\documentclass{article}
\usepackage[absolute,overlay]{textpos}

\usepackage{zref-savepos}

\begin{document}
\begin{textblock*}{10cm}(5cm,5cm)
\noindent\vline
\hfill\begin{tabular}{l@{}}
  \zsavepos{ABC}%
  ABCDEFGHIJ\\
  ABCDEFGHIJKL\\
  ABCDEFGH
\end{tabular}
\vline
\end{textblock*}

\begin{textblock*}{10cm}(5cm,10cm)
  \kern\dimexpr
    \zposy{abc-pre}sp-\zposy{abc}sp
    -\zposy{012-pre}sp+\zposy{012}sp
  \relax
  \zsavepos{012-pre}%
  \noindent
  \zsavepos{012}%
  \kern\dimexpr\zposx{ABC}sp-\zposx{012}sp\relax
  0123456789 \vline
\end{textblock*}

% 10mm fixed to 10cm to avoid overfull \hboxes
\begin{textblock*}{10cm}(5cm,10cm)
  \zsavepos{abc-pre}%
  \noindent\vline
  \zsavepos{abc}abcdefghij\\
  abcdefghijkl\\
  abcdefgh
\end{textblock*}

\end{document}

Result


Perhaps using a couple of instances of tabular*

screenshot

Note that the tabular* takes an extra argument <width> compared to the regular tabular environment.

I used \extracolsep{\fill} to fill space between the columns. As long as you ensure the second columns p{<width>} have the same width, then this will give you what you want.

\documentclass{article}
\usepackage[absolute,overlay]{textpos}

\begin{document}
\begin{textblock*}{10cm}(5cm,5cm)
\noindent
\begin{tabular*}{\textwidth}{|l@{\extracolsep{\fill}}p{3cm}|}
  &ABCDEFGHIJ\\
  &ABCDEFGHIJKL\\
  &ABCDEFGH
\end{tabular*}
\vline
\end{textblock*}

\begin{textblock*}{10cm}(5cm,10cm)
\noindent
\begin{tabular*}{\textwidth}{|l@{\extracolsep{\fill}}p{3cm}|}
  abcdefghij    & 0123456789\\
  abcdefghijkl  &\\
  abcdefgh      &
\end{tabular*}
\end{textblock*}


\end{document}

There are already two good approaches, but I'd like to add one to illustrate some ideas the LaTeX3 team have developed in using 'coffins': boxes with multiple handles for laying out designs. At the moment, this is not perfect: there are some concepts we perhaps need to add to the code, in particular vertical boxes which adopt a 'maximum' width and absolute page positioning (everything is relative at present).

The idea of the coffins approach is we can create design layout with some form of description that is understandable. Here, we have three blocks (I'll call them A, B and C). From the example, the description seems to be as follows. Block A (ABC...) is typeset left-aligned. Block B (012...) is a single line and is typeset exactly 5 cm below block A (measuring top to top) with no horizontal offset. Block C (abc...) is typeset exactly 5 cm to the left of block B (left-edge to left-edge), with the baseline of the first line of block C aligned with the baseline of block B. The entire construct is positioned such that the top-left corner of the enclosing box is positioned at (5 cm, 5 cm) on the page. This translates into

\documentclass{article}
\usepackage[absolute,overlay]{textpos}
\usepackage{xcoffins}
\NewCoffin{\CoffinA}
\NewCoffin{\CoffinB}
\NewCoffin{\CoffinC}
\begin{document}
\SetHorizontalCoffin{\CoffinA}{%
  \begin{tabular}{@{}l@{}}
    ABCDEFGHIJ\\
    ABCDEFGHIJKL\\
    ABCDEFGH
  \end{tabular}
}
\SetHorizontalCoffin{\CoffinB}{0123456789}
\JoinCoffins{\CoffinA}[t,l]{\CoffinB}[t,l](0 cm, -5 cm)
\SetVerticalCoffin{\CoffinC}{10 cm}{%
  \noindent
  abcdefghij\\
  abcdefghijkl\\
  abcdefgh
}
\JoinCoffins{\CoffinA}[\CoffinB-B,l]{\CoffinC}[T,l](-5 cm, 0 cm)
\begin{textblock*}{10cm}(5 cm, 5 cm)
  \noindent
  \TypesetCoffin{\CoffinA}%
\end{textblock*}
\end{document}

(There are other orders I could do the same thing.)

enter image description here