5

I am creating a poster using Latex and would like to split the background into two parts. Then I was wondering how we can create a background that is two-colored. For example, upper part is red and lower part is yellow (as on the exemplary image)?

enter image description here

1

1 Answer 1

4

You could use background. You don't give a minimal example, so your kilometres may well vary:

\documentclass[a4paper]{article}
\usepackage{geometry,tikz}
\usetikzlibrary{calc}
\usepackage[placement=bottom,scale=1,opacity=1]{background}
\backgroundsetup{contents={%
    \begin{tikzpicture}
      \fill [red] (current page.north west) rectangle ($(current page.north east)!.2!(current page.south east)$) coordinate (a);
      \fill [yellow] (current page.south west) rectangle (a);
    \end{tikzpicture}}}
\usepackage{kantlipsum}
\begin{document}
\kant[1-5]
\end{document}

red-yellow background

5
  • This example gives me LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right. no matter how many times I compile it, whether with luatex, pdftex, or xetex. The PDF looks OK though.
    – Thérèse
    Commented Jan 3, 2016 at 5:38
  • @Thérèse That's odd. It does me, too. But I have no idea why. (And I am not sure whether it did when I first wrote this answer or not. Probably I failed to notice.)
    – cfr
    Commented Jan 3, 2016 at 14:59
  • @Thérèse I'm clueless. Hence tex.stackexchange.com/questions/285813/…. Hopefully I can correct this answer when I learn how. If you think I should delete it for now, let me know. I'm reluctant to do that since it does seem to produce the desired output, there are no other answers and it is a warning rather than an error. (I don't mean warnings don't matter - just that if it gave an error, I would definitely delete it, whereas a warning is somewhat less serious and I'm less clear if I should delete it.)
    – cfr
    Commented Jan 3, 2016 at 20:21
  • I see no reason to delete it; I learned something from the example, and maybe we’ll learn more with your new question, which I’m glad you opened.
    – Thérèse
    Commented Jan 3, 2016 at 20:33
  • The method described by Werner works for me (slightly adapted to have only one savepos): see lines 191, 200–214 and 231f.
    – mirabilos
    Commented Jan 13, 2022 at 4:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .