I want to create empty boxes with a given height and a width of \textwidth
. I tried the following:
\framebox(\textwidth{}, 80){} % (a)
\framebox[\textwidth]{} % (b)
(b) does not work (because I cannot specify the height… ), and (a) works but gives me the following error:
ERROR: Missing number, treated as zero.
I don't really understand why it works with this error… So if anyone could help me figure this out.
I am using exam.cls, so my real code is something like:
\fullwidth{\color{black!30}\framebox(\textwidth{}, 80){}}
But I can reproduce without the \fullwidth
… I also checked the value of \textwidth
:
\the\textwidth
% 469.755pt
Maybe the problem is the pt
at the end but I don't know how to get rid of it…
Of course, if you have other solutions to create empty boxes with specified criteria, I am open to suggestion!
Best Answer
If you need an empty framed box, you can define your own command:
so a call of
will produce a 4cm high empty box and as wide as the text. With
you get it 4cm high and 8cm wide. The
\setlength
instruction ensures no padding is added (otherwise\emptybox{4cm}
would produce an overfull line).