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.

I'm trying to make a simple one-line 1mm thick page frame. Left line of that frame should be 2.5cm from edge and all other lines 0.5cm. Document includes tikz drawing, and text.

The problem is that I'm failing to make any frame that is not sticked to the content or drawn by dimensions mentioned above.

I think that this could be made by using packages like frame, or mdframed, but since I've just recently started using LaTeX, I find them a bit difficult to comprehend.

share|improve this question
    
Hi Wakko, Welcome to TeX.SE! Have a look at How to set colored ruled margins for different pages? and let us know if it helps :) –  cmhughes Dec 26 '12 at 18:40
    
Could you add a Minimum Working Example (MWE) of the code you have so far to your question? –  Peter Jansson Dec 26 '12 at 18:41
    
Do you want to draw this frame for a single page, or for all the pages in the document? –  Torbjørn T. Dec 26 '12 at 18:41
    
Try the package crop with the option frame. –  Sigur Dec 26 '12 at 18:42
1  
The fancybox package should be able to do simple frames; see also this question –  egreg Dec 26 '12 at 20:41
show 4 more comments

1 Answer

Since you're already using tikz here's an example which makes use of overlays from that package. (See page 200 in the manual for more details). You do need to run this through LaTeX twice to get the placement to be correct.

\documentclass{article}
\usepackage{tikz}
\usepackage{lipsum}

\begin{document}
\lipsum[1-20]

\begin{tikzpicture}[remember picture, overlay]
    \node (A) [xshift=2.5cm,yshift=0.5cm] at (current page.south west) {};
    \node (B) [xshift=2.5cm,yshift=-0.5cm] at (current page.north west) {};
    \node (C) [xshift=-0.5cm,yshift=-0.5cm] at (current page.north east) {};
    \node (D) [xshift=-0.5cm,yshift=0.5cm] at (current page.south east) {};

    \coordinate (cA) at (A) ;
    \coordinate (cB) at (B);
    \coordinate (cC) at (C);
    \coordinate (cD) at (D) ;


    \draw[line width=1mm] (cA) -- (cB) -- (cC) -- (cD) -- cycle;
\end{tikzpicture}
\end{document}

You could place the tikzpicture in a command \myborderedpage and then call it on the pages where you want the border:

\documentclass{article}
\usepackage{tikz}
\usepackage{lipsum}

\newcommand{\myborderedpage}{%
    \begin{tikzpicture}[remember picture, overlay]
    \node (A) [xshift=2.5cm,yshift=0.5cm] at (current page.south west) {};
    \node (B) [xshift=2.5cm,yshift=-0.5cm] at (current page.north west) {};
    \node (C) [xshift=-0.5cm,yshift=-0.5cm] at (current page.north east) {};
    \node (D) [xshift=-0.5cm,yshift=0.5cm] at (current page.south east) {};

    \coordinate (cA) at (A) ;
    \coordinate (cB) at (B);
    \coordinate (cC) at (C);
    \coordinate (cD) at (D) ;


    \draw[line width=1mm] (cA) -- (cB) -- (cC) -- (cD) -- cycle;
    \end{tikzpicture}}

\begin{document}
\lipsum[1-20]

\myborderedpage

\lipsum[21-40]

\myborderedpage

\end{document}

If you're willing to load another tikz library, the following code is a bit simpler and less convoluted than the above examples:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{lipsum}

\newcommand{\myborderedpage}{%
    \begin{tikzpicture}[remember picture, overlay]
        \draw [line width=1mm]
            ($ (current page.south west) + (2.5cm,0.5cm) $)
            rectangle
            ($ (current page.north east) + (-0.5cm, -0.5cm)$);
    \end{tikzpicture}}

\begin{document}
\lipsum[1-20]

\myborderedpage

\lipsum[21-40]

\myborderedpage

\end{document}
share|improve this answer
    
Thank you :D That was helpful... I have managed to finish my work. –  Wakko Dec 26 '12 at 22:15
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.