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

cerebrou
  • 801
  • 1
    Check out the related to the right, and also http://tex.stackexchange.com/questions/276358/text-on-background-image-footer-and-header/276453#276453. – John Kormylo Dec 04 '15 at 01:41

1 Answers1

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

cfr
  • 198,882
  • 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 Jan 03 '16 at 05: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 Jan 03 '16 at 14:59
  • @Thérèse I'm clueless. Hence http://tex.stackexchange.com/questions/285813/how-can-i-avoid-a-persistent-warning-concerning-possibly-changed-labels-when-usi. 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 Jan 03 '16 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 Jan 03 '16 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 Jan 13 '22 at 04:42