A picture environment at exactly the size of the text area can fit snugly on one page. However when I replace the environment with a wrapper environment with exactly the same definition, it takes two pages instead! This is a problem because I need to define my custom full-page environment but it is critical that an extra page not be inserted after it.
To be precise, the following compiles into one page:
\documentclass{article}
\usepackage[margin=1in]{geometry}
\newenvironment{wrap}{
\begin{picture}(6.5,9)
}{
\end{picture}
}
\begin{document}
\setlength{\unitlength}{1in}
%\begin{wrap}
%\end{wrap}
\begin{picture}(6.5,9)
\end{picture}
\end{document}
However if you comment out \begin{picture}...\end{picture} and un-comment \begin{wrap}...\end{wrap}, it compiles into two pages, even though it has exactly the same definition. Why is this the case?
Narrowing it down: replacing 9 with 8.5 solves the problem, that is, both wrap and picture versions compile to one page. So it seems that the problem is that while the 9-inch picture environment maxes out the space, while the wrap environment adds an extra sliver of space from \newenvironment that causes a page break. Can someone verify this guess?
%at the end of some of your lines in yournewenvironment, see http://tex.stackexchange.com/questions/7453/what-is-the-use-of-percent-signs-at-the-end-of-lines – cmhughes Jan 04 '16 at 20:32%at the ends of yourwrapenvironment. It should look like this. – Werner Jan 04 '16 at 20:34\space\begin{picture}...\end{picture}\spacewhich is two word spaces wider than the picture environment. – David Carlisle Jan 04 '16 at 22:36