Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Using this code to achieve an effect as in the question Page border coloured.

\usepackage{tikz}
\usetikzlibrary{calc}
\newcommand{\pageframe}{%
\begin{tikzpicture}[remember picture,overlay]
\fill[blue!25!] (current page.north east) rectangle (current page.south west);
\fill[white, rounded corners] ([xshift=-10mm,yshift=-17mm]current page.north east) rectangle ([xshift=10mm,yshift=17mm]current page.south west);
\end{tikzpicture}%
}

The code draws a whole-page coloured rectangle and a rounded white rectangle in between the page to create a white area for text.

But any text is not showing through (though it is selectable in PDF reader and appears as white text against white background rectangle)!

enter image description here

share|improve this question
    
Where is the text? Your example is too minimal. –  Matthew Leingang May 15 '11 at 11:22
    
text is in \begin{document} (parts, chapters, sections...) –  umar May 15 '11 at 11:33
    
We need a full example. Most likely you draw the graphic after the text. Move the code from the footer to the header and see if this helps. –  Martin Scharrer May 15 '11 at 11:34
1  
graphic is in preamble - EDIT: in header it works! post this as an answer... –  umar May 15 '11 at 11:37
1  
You should add the name of the user after an @ into the comment to notify him/her. This is not required if the user is the author of the question or answer the comment is for. That's the reason Matthew and I didn't added @umar in every comment. –  Martin Scharrer May 15 '11 at 12:00
add comment

3 Answers

up vote 2 down vote accepted

In the linked question the page frame is drawn in the footer. Moving the page frame into the header instead will change the order and should display the frame before, i.e. below, the text.

To give an explanation: As far I know the page is processed the following way: The main text is typeset and TeX collects a page worth of text. It then places the header on the page, followed by the already processed text and finally adds the footer. So material in the footer is placed above the text while material in the header is placed below it. It surprises me that the code in the linked question works as it is.

share|improve this answer
    
Thanks @Martin for this advice. I changed the example in the linked question. It now uses the header do draw the border. –  Tobi May 16 '11 at 9:09
add comment

Two solutions:

  1. Draw the picture before the main text. You can use eso-pic package to do this, or put it in the header using fancyhdr.

  2. Use clip instead of white filled rectangle.

share|improve this answer
add comment

Here is a solution that draws the region inside two rectangles using the even odd rule. It does not draw anything in the part that is inside both rectangles. With the approach given here, you get the same result using head or foot, because only the frame is drawn, not the inside. The code is

\documentclass[twoside=semi,BCOR=0cm,letterpaper]{scrbook}

\usepackage{scrpage2}

\usepackage{lipsum}

\usepackage{tikz}
\usetikzlibrary{calc}

\newcommand{\pageframe}{%
\begin{tikzpicture}[remember picture,overlay]
\fill[blue!25,even odd rule] 
    (current page.north east) rectangle  (current page.south west)
    [rounded corners] ($(current page.north east)+(-1,-1)$) rectangle ($(current page.south west)+(1,1)$);                      
\end{tikzpicture}%
}

% set page style
\cefoot[\pageframe]{\pageframe}
\cofoot[\pageframe]{\pageframe}
\pagestyle{scrheadings}

\begin{document}    
\lipsum[1-5]
\end{document} 

The output is

frame

share|improve this answer
    
There is no need to mark or justify every edit. It makes the answer more confusing not less. The latest version should show the best solution. People interested in the history can see the edits by clicking the "edited" link below the question. –  Martin Scharrer May 15 '11 at 13:30
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.