# Box with fixed position in page

I would like a custom "emptybox" whose height can be chosen, but whose width and position is always the same: I would like the boxes to always extend through the full width of the document (from the left margin to the right margin).

So far I have this command:

\newcommand{\emptybox}[1]{\framebox[\textwidth]{\rule[-1em]{0cm}{#1}}}


But the problem is that the position of the box depends on where I call it. For instance if I use \emptybox inside an enumerate, the box will appear too much to the right.

Feel free to suggest a command not based on the one I gave, which does not do the job anyway. Thanks!

• If I understand your question correctly, you want a box that has the width \linewidth, starts at the left margin but the vertical position may vary still? – user31729 Mar 31 '17 at 14:52
• – Steven B. Segletes Mar 31 '17 at 14:52
• @StevenB.Segletes: No answer with stacking boxes on top of other boxes? ;-) – user31729 Mar 31 '17 at 14:55
• @ChristianHupfer It is the exception that proves the rule. – Steven B. Segletes Mar 31 '17 at 14:58
• @ChristianHupfer Correct. StevenB.Segletes: thank you for the link, but ideally I would like an explicit solution :p. David Carlisle's answer looks good. – Seub Mar 31 '17 at 15:02

\documentclass{article}

\makeatletter
\newcommand{\emptybox}[1]{\par
\noindent
\hspace*{-\@totalleftmargin}\framebox[\textwidth]{\rule[-1em]{0cm}{#1}}%
\par}
\makeatother

\begin{document}

zzz
\emptybox{1cm}

\begin{itemize}
\item aaaa\emptybox{2pt}
\begin{itemize}
\item zzzzz\emptybox{40pt}
\end{itemize}
\end{itemize}

\end{document}