3

This is as close as I've got, but I can't work out how to do the calculation so that textblock accepts it:

\documentclass[11pt]{article}
\usepackage[paperheight=93.884mm,paperwidth=68.992mm,margin=0mm,heightrounded]{geometry}
\usepackage[absolute]{textpos}
\usepackage{zref-user}
\usepackage{zref-abspos}
\usepackage{calc}

\setlength{\TPHorizModule}{1mm}
\setlength{\TPVertModule}{1mm}
\setlength{\parindent}{0pt}

\begin{document}

  This is a document in absolute textpos mode, but I will also need to use relative positioning in it.

  \zsavepos{test}
  \def\dimtomm #1{\the\numexpr \dimexpr #1\relax*635/118407168\relax }
  \begin{textblock}{59}(\dimtomm{\zposx{test}sp},93.884mm-\dimtomm{\zposy{test}sp})
    % ! Illegal unit of measure (pt inserted)
    I WANT THIS TEXTBLOCK TO BE POSITIONED RELATIVELY
  \end{textblock}

\end{document}
3

You can't use dimensions with textblock. It expects to receive simple numbers corresponding to the numbers of horizontal and vertical units. But you are trying to feed it mm, I think, which won't work. (If you need to use dimensions, consider textblock*.)

Here's a working example:

\documentclass[11pt]{article}
\usepackage[paperheight=93.884mm,paperwidth=68.992mm,margin=0mm,heightrounded]{geometry}
\usepackage[absolute]{textpos}
\usepackage{zref-user}
\usepackage{zref-abspos}
\usepackage{calc}
\setlength{\TPHorizModule}{1mm}
\setlength{\TPVertModule}{1mm}
\setlength{\parindent}{0pt}
\begin{document}
This is a document in absolute textpos mode, but I will also need to use relative positioning in it.

\hspace*{5mm}\zsavepos{test}
\edef\thingone{\numexpr\zposx{test}*635/118407168}
\edef\thingtwo{\numexpr\zposy{test}*635/118407168}
\edef\thingthree{\numexpr 93-\thingtwo}
\begin{textblock}{59}(\thingone,\thingthree)
  I WANT THIS TEXTBLOCK TO BE POSITIONED RELATIVELY
\end{textblock}
\end{document}

relatively positioned block

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.