TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to avoid TikZ or another package. I would like the frame surrounds the page with a rule on all sides and I would like to have a page number below the frame in the middle. I have some difficulties to understand how to use \output and shipout

share|improve this question
You mean rules around the text area of the page, do you? – Martin Scharrer Apr 10 '11 at 21:50
yes I would like one or two rules around the text area for every pages – Alain Matthes Apr 10 '11 at 21:56
Any particular reason why you want to avoid using a package? – Aditya Apr 11 '11 at 16:05
No I have to make some texts in plain TeX for friends – Alain Matthes Apr 11 '11 at 16:12
up vote 6 down vote accepted

Plain TeX solution:

    \vrule \kern#2pt
      \vbox{\kern#2pt #1

      \centerline{Test Framed Page}}


For any chance to understand output routines start from plain TeX and the TeXBook. See also this post, where I posted some links to TUGBoat articles about the OTR.

share|improve this answer
thanks I was looking for a solution like this. Thanks for the post my problem is how to use shipout. – Alain Matthes Apr 10 '11 at 22:17
@Altermundus If you want to hook anything into LaTeX's output routine rather hook at AtBeginDvi, have a look at source2e. – Yiannis Lazarides Apr 10 '11 at 22:21
TeX by Topic has a concise explanation of the use of \output, section 28.2. – Charles Stewart Apr 11 '11 at 5:46

You could draw the rules by yourself inside the header and footer. See e.g. the layout package to learn about the exact offsets you have to use.

Here my try which is pretty accurate:




    \raisebox{\dimexpr-\headsep-\dp\strutbox\relax}[0pt][0pt]{\rlap{\hbox to \textwidth{\hrulefill}}}%
    \raisebox{\dimexpr-\headsep-\textheight-\dp\strutbox\relax}[0pt][0pt]{\vrule height \textheight}%
    \raisebox{\dimexpr-\headsep-\textheight-\dp\strutbox\relax}[0pt][0pt]{\vrule height \textheight}%
    \raisebox{\footskip}[0pt][0pt]{\rlap{\hbox to \textwidth{\hrulefill}}}%




share|improve this answer
Interesting and more clear to understand for me but I prefer to avoid the use of a package. This solution can be useful ! thanks now I need to understand the code from Yiannis – Alain Matthes Apr 10 '11 at 22:22

Your Answer


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.