Tell me more ×
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.

Does anyone know how to stretch a (framed) box down to the end of the page? In effect something like

\documentclass{scrartcl}

\begin{document}
sometext

\framebox[\textwidth]{somemoretext\vspace*{\fill}}
\end{document}

Only that this doesn't work, of course, because \fill doesn't work inside a box...

I've also tried the framed package, that doesn't solve the problem either.

(In case anyone is wondering why I'm trying to do this, think of a handout with a box for handwritten comments at the end...)

share|improve this question

2 Answers

up vote 2 down vote accepted

run it with xelatex

\documentclass{article}
\usepackage{pst-node}
\begin{document}
sometext

\rnode[lt]{A}{somemoretext}

\vfill
~\hfill\rnode[rb]{B}{~}
\psframe(A)(B)

\clearpage
foo
\end{document}

enter image description here

share|improve this answer

Update 2011/09/16

Herbert is right with his approach to use two nodes and v/hfill. Here my TikZ solution based on this idea:

\documentclass{scrartcl}
\usepackage{capt-of}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{lipsum}


\begin{document}
\lipsum[1]% dummy text

\par\noindent
\tikz[overlay,remember picture]\coordinate (image-start);
\par
\vfill
\null\hfill
\tikz [overlay,remember picture] \draw (0,0) rectangle ([yshift=\ht\strutbox-\fboxsep]image-start);
\newpage
\end{document}

You can use TikZ for this. There is the special node current page which gives you the corners of the current page as points of the compass. You can get the lower right corner of the textarea by subtracting the margins. This needs the remember picture and overlay option on the picture and also needs two compiler runs to produce the correct result.

Unfortunately TikZ doesn't provide a special node for the text area itself, but I found some code posted by Sven Köhler which defines such a node.

\documentclass{scrartcl}
\usepackage{tikz}
\usepackage{lipsum}

\newcommand{\currentsidemargin}{%
  \ifodd\value{page}%
    \oddsidemargin%
  \else%
    \evensidemargin%
  \fi%
}

\begin{document}
\lipsum[1]% dummy text
\par\bigskip \noindent
Notes:\\
\begin{tikzpicture}[overlay,remember picture]
    % Helper nodes
    \path (current page.north west) ++(\hoffset, -\voffset)
        node[anchor=north west, shape=rectangle, inner sep=0, minimum width=\paperwidth, minimum height=\paperheight]
        (pagearea) {};

    \path (pagearea.north west) ++(1in+\currentsidemargin,-1in-\topmargin-\headheight-\headsep)
        node[anchor=north west, shape=rectangle, inner sep=0, minimum width=\textwidth, minimum height=\textheight]
        (textarea) {};

    % Framebox
    \draw (0,0) rectangle (textarea.south east);

\end{tikzpicture}
\newpage
\end{document}

Result

share|improve this answer

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.