# Package textpos defining textblock in width of \textwidth and relative commands

I have some questions, that won't be solved by the documentation.

1.) [This is solved, solution in 1]I would like to do

\documentclass{scrartcl}
\usepackage{textpos}
\begin{document}
\begin{textblock}{\textwidth}(0,0)
Text of full paperwidth, doesn't matter, if i'd chose a4 to a0
\end{textblock}
\end{document}


but \textwidth doesn't work. My intention is: Defining a fixed block at fixed position of relative width, depending on the chosen paper-size. This leads to my 2nd question.

2.) Is there a way, to declare textblocks orientated on an anchor "top, right" instead of "top, left". Am I able to define anchors for textblock like: top=xx, right=xx. Or bottom=xx, left=xx?

3.) How to set a backgroundcolor to textbox?

4.) How to make the outer-text of textbox don't underlay the textbox? If I declare a Textbox as a heading-element, and inserting something outside of this, i'll achive the following image: The blue bar shows the end of the textbox-environment. So if I do

\begin{textbox}
inner text
\end{textbox}
outer text


I would like to have the "outer text" just below the textbox, so that \clearpage and other commands will still work.

Solution

1 Credits to Jürgen

\documentclass{scrartcl}
\usepackage{textpos}
\begin{document}
\begin{textblock*}{\textwidth}(0cm,0cm)
Text of full paperwidth, doesn't matter, if i'd chose a4 to a0
\end{textblock*}
\end{document}


[3] Credits to Documentation Using the command below, defines the backgroundcolor of all Textboxes

\textblockcolour{hcolour i}


Credits to Jürgen for giving the hint to:

fcolourbox This will be another solution for just one box.

• I would like to propose to separate the third aspect into a new question as it is not related to the textpos package. – Jürgen Mar 28 '17 at 9:40
• ok. I'll do so and erase it from here. – Shalec Mar 28 '17 at 9:42
• To question 4) I do not know if I understand you correctly, but this looks like you are searching for a floating object. Or something like wrapfig? I think you should show us what you want to achieve finally. – Jürgen Mar 28 '17 at 13:43
• Ok. I'll Try. I'll add an image. – Shalec Mar 28 '17 at 14:11
• Then, I think, textpos is not the right package for you. It can not manage the flow of the text outside of the textblocks. You may look into the documentation if the tcolorbox package. – Jürgen Mar 28 '17 at 14:21

To question 1)

RTFM: If you like to use absolute values, than you have to use the starred version.

\documentclass{scrartcl}
\usepackage{textpos}
\begin{document}
\begin{textblock*}{\textwidth}(0cm,0cm)
Text of full paperwidth, doesn't matter, if i'd chose a4 to a0
\end{textblock*}
\end{document}


To question 2)

I think with internal means of this package this is not possible. But an idea: One might put the contents of the textblock into a box, measure its height and change the vertical position parameter of the textblock accordingly. Should work, but I am not sure whether this is the most elegant way ...

To question 3)

\textblockcolor is of course the canonical solution. [\fcolorbox is another solution which works independent of this package. It may lead to problems with the correct adjustment inside of textblocks.]

• I would swear, I had tried exact this code and this didn't worked. As I used it right now, it works. Thank you for this solution. – Shalec Mar 28 '17 at 9:27
• your 2nd solution will probably work. I'll add a third question to this. – Shalec Mar 28 '17 at 13:02
• Question 3.) is, therefore, answered. I will add a solution from the documentation. – Shalec Mar 28 '17 at 13:37
• i've added one last question: How to disable the text, that is putted in outside the textbox, underlaying the textbox? – Shalec Mar 28 '17 at 14:00