6

I would like to position text absolutely using the textblock* command from the textpos package. Minimal working example:

\documentclass{article}
\usepackage[absolute]{textpos}
% \renewcommand{\textwidth}{17cm} % (*)
\begin{document}
  \begin{textblock*}{3cm}(1cm,0.98\paperheight)
    XXXXXXXXXXXXXXX
  \end{textblock*}
\end{document}

This breaks as soon as I redefine the textwidth as done by the line marked (*) above. Why is this and, more importantly, how can I fix this? ("It breaks" here means I get "! Missing number, treated as zero. ! Illegal unit of measure (pt inserted)." in the line with the text (placeholder "X...X" above).)

Bonus question: How can I specify something like \paperheight - 1cm?

  • 1
    \textwidth is a length not a macro: \setlength\textwidth{17cm} – David Carlisle Jul 2 '14 at 8:40
5

You have to use \setlength instead of \renewcommand and also \dimexpr\paperheight-1cm\relax for the second question :

\documentclass{article}
\usepackage[absolute]{textpos}
\setlength{\textwidth}{17cm} % (*)
\begin{document}
  \begin{textblock*}{3cm}(1cm,\dimexpr\paperheight-1cm\relax)
    XXXXXXXXXXXXXXX
  \end{textblock*}
\end{document}

enter image description here

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.