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.

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 made a command that prints a gray rectangle in my document. I can use this command typing:

\notes{100}, where 100 is the vertical size of the box.

\node [ draw,
    rounded corners,
    text badly centered,
    text width=\linewidth,
    minimum height=#1 mm
] (init) {};

I'm looking for a solution that fills the page to the bottom, getting the size of the \vfill.

EDIT: obviously, I need a solution that doesn't need to use some value as parameter.

share|improve this question
Do you want to fill the remainder of the page after the command with the gray rectangle or print the rectangle and fill all space that is left (with whitespace)? – Mythio Mar 5 '13 at 10:39
Hi user13596. A tip: If you indent lines by 4 spaces, then they're marked as a code sample. You can also highlight the code and click the "code" button ({}) or select your code and hit Ctrl+K. – Claudio Fiandrino Mar 5 '13 at 10:40
I want to make the gray rectangle expands until the end of space. I want no blank spaces after the command. – Fabricio Pio Mar 5 '13 at 10:48

Here is a solution (using the tikzpagenodes package and the overlay and remember picture options). Note: Several compilation are needed!


  \begin{tikzpicture}[remember picture,overlay]
    \fill[gray!20,rounded corners]
    (0,0) rectangle (current page text area.south east);

share|improve this answer
I was about to answer exactly the same, but without [yshift=1mm]. Why is this needed? – JLDiaz Mar 5 '13 at 11:04
@JLDiaz This is an oversight... – Paul Gaborit Mar 5 '13 at 12:30
I’d add a \par to the beginning of the definition, so that \vfillgrayrectangle can be used directly following some text. (\lipsum inserts a \par automatically. Try it with \lipsum* instead.) – Qrrbrbirlbel Mar 5 '13 at 15:19
@Qrrbrbirlbel It's a good advice. Thanks. I edited my answer. – Paul Gaborit Mar 5 '13 at 15:40

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.