9

I am designing a business card using the memoir class and hints given here and am trying out various background effects. Specifically, I would like to change the background for the last third of the card to another colour. Because the colour needs to bleed to the edge, an option involving tables is not suitable. Short of inserting an image and overwriting it, is there a more elegant way to achieve this?

  • Since you have some responses below that seem to answer your question, please consider marking one of them as ‘Accepted’ by clicking on the tickmark below their vote count. This shows which answer helped you most, and it assigns reputation points to the author of the answer (and to you!). – Martin Scharrer May 27 '11 at 15:37
  • Related question: Fill the left 1/3 of the title page with color?. – Martin Scharrer May 27 '11 at 15:39
11

When I understood your requirements correctly you need anyway a 90mm x 52mm PDF as a result. Therefore I would recommend to you to "draw" the card using TikZ. There you can set the background colors as filled rectangles. Use the preview package to minimize the resulting PDF page. The code below uses standalone to do this automatically.

TikZ supports a lot of graphical features like shadings etc., so you shouldn't run into any limitations. See this question if you want to draw on the background of a normal page instead.

\documentclass[border=0mm]{standalone}
\usepackage{tikz}
\begin{document}
\sffamily
\begin{tikzpicture}
    % Define size and default background color of card:
    \useasboundingbox [fill=blue!10] (0,0) rectangle (90mm,52mm);
    % Background of last third
    \fill [red] (60mm,0mm) rectangle (90mm,52mm);
    % Place the text freely. You can also place `tabulars` or `\parbox`es
    \node [right] at (10mm,30mm) {John Doe};
    \node [right] at (10mm,25mm) {Example Cooperation};
    \node [right] at (10mm,20mm) {John.Doe@example.com};
\end{tikzpicture}
\end{document}

Result:

Result

  • 1
    Thank you very much for your solution and also for introducing me to the standalone documentclass. It will be very helpful for a graphic rich manuscript I am working on. Perhaps you should popularize the standalone documentclass and package via a TUGBoat article if you have not already done so. – chandra Mar 1 '11 at 16:11
  • @chandra: Thanks you. It's a nice idea to write a TUGBoat article. However ATM I very busy writing my PhD thesis. Note that I published a new version of standalone yesterday which allows the preview border to be set using and class option, e.g. border=0mm. – Martin Scharrer Mar 1 '11 at 16:30
6

you can use simple colorboxes

\documentclass{article}
\usepackage{xcolor,lipsum}
\begin{document}

\lipsum[1]

\noindent\fboxsep=0pt%
\colorbox{blue!10}{\parbox[c][0.5\textwidth][c]{0.7\textwidth}{%
\centering\large\tabular{l}
John Doe\\Example Cooperation\\John.Doe@example.com
\endtabular}}%
\colorbox{red}{\parbox[c][0.5\textwidth][c]{0.3\textwidth}{\rule{\linewidth}{0pt}}}

\end{document}

enter image description here

  • The \colorbox is very useful, but it's hard to make it bleed off the edge of the sheet without disrupting the margins of the text. – Peter Flynn Oct 16 '16 at 20:47
4

You could use eso-pic, atbegshi, everyshi (older) or textpos (easy to use) for placing a color filled rectangle into the background.

Alternatively, you could use TikZ and the current page node. Here's an example where I used this method for headings and page headers: Fancy chapter headings with TikZ. See Comment #20 for an example with colored headers. It could be modified like desired.

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.