The question
I would like to control the height of the pages of the PDF documents I produce with LaTeX.
Starting with a LaTeX document and two parameters:
- a given page size (
heightPageandwidthPage) - a given length called
initialVerticalInset,
I would like to produce a PDF whose page lengths follow the pattern
- the normal height of the pages is
heightPage - BUT, the height of the first page is
(heightPage - initialVerticalInset) - AND, the height of the last page equals the "height of its content", i.e. "the last page is cut" after the end of its content
If possible, I would like also :
- if any of these pages are put next to another one, the baselines should be aligned
- the margins could be set a minimal value (such as
0pt)
Example 1


Example 2

Minimal documents to be tested
In a previous similar question, I noticed that one difficulty could be the compatibility with :
itemizeenvironmentsmdframedenvironments- the case of short documents has to be dealt with too.
So, I prepared three MWE to be tested.
Short document
\documentclass{article}
\usepackage[paperwidth=8cm, paperheight=10cm, hmargin=0mm,
top=0mm, bottom=0mm] {geometry}
\setlength{\initialVerticalInset}{4.5cm}
\begin{document}
This is a test. This is a longer sentence with some more words, isn't it?
\end{document}
Documents with itemize environments
\documentclass{article}
\usepackage[paperwidth=8cm, paperheight=10cm, hmargin=0mm,
top=0mm, bottom=0mm] {geometry}
\pagestyle{empty}
\setlength{\initialVerticalInset}{4.5cm}
\begin{document}
This is a test. This is a longer sentence with some more words, isn't it? This is a test. This is a longer sentence with some more words, isn't it? This is a test. This is a longer sentence with some more words, isn't it?
This is a test:
\begin{itemize}
\item Hello
\item This is a test. This is a longer sentence with some more words, isn't it? This is a test. This is a longer sentence with some more words, isn't it? This is a test.
\item Good Bye
\item Hello
\item This is a test. This is a longer sentence with some more words, isn't it? This is a test. This is a longer sentence with some more words, isn't it? This is a test.
\end{itemize}
This is a test. This is a longer sentence with some more words, isn't it? This is a test. This is a longer sentence with some more words, isn't it? This is a test. This is a longer sentence with some more words, isn't it? This is a test. This is a longer sentence with some more words, isn't it? This is a test. This is a longer sentence with some more words, isn't it? This is a test. This is a longer sentence with some more words, isn't it? This is a test. This is a longer sentence with some more words, isn't it? This is a test. This is a longer sentence with some more words, isn't it? This is a test. This is a longer sentence with some more words, isn't it? This is a test. This is a longer sentence with some more words, isn't it? This is a test. This is a longer sentence with some more words, isn't it? This is a test. This is a longer sentence with some more words, isn't it?
This is a test. This is a longer sentence with some more words, isn't it? This is a test. This is a longer sentence with some more words, isn't it? This is a test. This is a longer sentence with some more words, isn't it? This is a test. This is a longer sentence with some more words, isn't it?
This is a test. This is a longer sentence with some more words, isn't it? This is a test. This is a longer sentence with some more words, isn't it?
\end{document}
Documents with mdframed environments
\documentclass{article}
\usepackage[
paperwidth=15cm,
paperheight=15cm,
hmargin=1cm,
vmargin=0cm,
]{geometry}
\usepackage[framemethod=tikz, needspace=1.5cm]{mdframed}
\newmdenv[%
innerleftmargin = 2mm,
innerrightmargin = 2mm,
innertopmargin = 2mm,
innerbottommargin = 2mm,
leftmargin = 0mm,
rightmargin = 0mm,
splitbottomskip = 2mm,
splittopskip = 4mm,
middlelinewidth = 0mm,
linecolor = red,
backgroundcolor = red,
roundcorner = 0pt,
skipbelow = 0mm,
skipabove = 0mm,
]{mybox}
\pagestyle{empty}
\setlength{\initialVerticalInset}{5cm}
\begin{document}
\begin{mybox}
\lipsum[1]
\end{mybox}
\lipsum[1-7]
\end{document}








\pdfpageheight=...– wipet Dec 09 '14 at 19:19\firstpage{...}), which is not what I am looking for :( – Colas Dec 11 '14 at 08:35