# Frame environment with fixed size given by numbers of characters and lines

I would like to make one framed environment with the following behavior.

1. Only the last 8 lines of the content must be displayed. If the content have more than 8 lines, a gentle warning must be produced by LaTeX.
2. The width of the frame is exactly equal to 16 letters.
3. A fixed width font must be used.
4. The content cannot contain formulas. If it is the case, an error must be sent.

This is for imitate the screen of one calculator.

The following solution nearly works except that I would like a better symetric spacing between the content and the box.

What are the changes to do ?

\documentclass{article}
\usepackage{color}

% For tests
\usepackage{comment}

\makeatletter
.2 4 6 8 A C E
\end{calculator}

\end{document}

-
Thanks for this. Is there a way to display only the last, and not the first 8 lines ? –  projetmbc Dec 8 '11 at 11:16
@projetmbc: That's actually easier. I updated my question to do it. –  Martin Scharrer Dec 8 '11 at 11:20
Thanks. That's great ! –  projetmbc Dec 8 '11 at 11:23
Is ther one possibility to use the mdframed instead of standard boxes ? –  projetmbc Dec 8 '11 at 11:37
Using mdframed after saving the content in a box gives you no benefits. You would need to use some mdframed settings or code to make it clip the content for you. I don't now the internals of this package good enough. –  Martin Scharrer Dec 8 '11 at 11:49