Locking boxes vertical position

The fboxes and section titles generated with this code:

\documentclass{article}
\usepackage[left=6cm,right=6cm,top=3cm,bottom=3cm]{geometry}
\usepackage{blindtext}

\begin{document}

\vspace*{1cm}
\begin{flushright}
\fbox{\parbox[c][5.1cm][c]{0.5 \textwidth}{%
\emph{{{Some very smart quote weakly related to next section's content.}}\\\vspace{-0.6cm}
\begin{flushright}
\textbf{\emph{--- {Some Brilliant Author}}}
\end{flushright}
}}}
\end{flushright}
\vspace{0.2cm}
\section{This section is SHORT.}
\blindtext[1]

\clearpage
\vspace*{1cm}
\begin{flushright}
\fbox{\parbox[c][5.1cm][c]{0.5 \textwidth}{%
\emph{{{Some shorter quote.}}\\\vspace{-0.6cm}
\begin{flushright}
\textbf{\emph{--- {Some Brilliant Author}}}
\end{flushright}
}}}
\end{flushright}
\vspace{0.2cm}
\section{This section is LONG.}
\blindtext[3]

\end{document}


are in a slightly different position relative to the page if you zoom enough. My tests tell me it is due to the \vspaces (at least when I use the 0.2cm and the 1cm ones at the same time) so, is there any way to get that positioning while not making it an adaptative element?

My aim is to get every section title page the same appearance, with the title in the same vertical position (as when you have just the naked sections), and the quote box in the same position too.

• i think the only way you can guarantee the same position on the page is to use \raggedbottom or a grid system. even if you redefine all possible elements that contain stretchable glue (section headings, \parskip, and the like), unless you very carefully control every element that occupies vertical space, you are likely to run into underfull vboxes on at least some pages. even one line set in a font of a size different from the basic text font, never mind the inclusion of display math, will throw off the calculation unless you are using a grid system. – barbara beeton Feb 24 '14 at 14:07

By building the item as a stack, and taking the glue out of the above-section-head, you can avoid all those nasty glue issues. The vertical spacings of the stack are controlled by the optional arguments to \stackon and \stackunder, which can be changed to suit.

Note that the renewed \section macro is for the default article document class. Other document classes would have their own definitions.

\documentclass{article}
\usepackage[left=6cm,right=6cm,top=3cm,bottom=3cm]{geometry}
\usepackage{blindtext}
\usepackage{stackengine}
\makeatletter
\renewcommand\section{\@startsection {section}{1}{\z@}%
{-3.5ex}%REMOVE THE GLUE FROM ABOVE THE SECTION HEAD
{2.3ex \@plus.2ex}%
{\normalfont\Large\bfseries}}
\makeatother
\begin{document}
\hfill\stackunder[.2cm]{\stackon[1cm]{%
\fbox{\parbox[c][5.1cm][c]{0.5 \textwidth}{%
\emph{{{Some very smart quote weakly related to next section's content.}}\\\vspace{-0.6cm}
\begin{flushright}
\textbf{\emph{--- {Some Brilliant Author}}}
\end{flushright}
}}}%
}{}%
}{}
\section{This section is SHORT.}
\blindtext[1]
\clearpage
\hfill\stackunder[.2cm]{\stackon[1cm]{%
\fbox{\parbox[c][5.1cm][c]{0.5 \textwidth}{%
\emph{{{Some shorter quote.}}\\\vspace{-0.6cm}
\begin{flushright}
\textbf{\emph{--- {Some Brilliant Author}}}
\end{flushright}
}}}%
}{}%
}{}
\section{This section is LONG.}
\blindtext[3]
\end{document}

• you still have stretchable glue above the section head from \section, so the space between the box and the heading text will vary depending on the text content lower on the page. Really you want to move your stack into the definition of the heading. (or to redefine the \section command to add fixed glue, which might be simpler) – David Carlisle Feb 24 '14 at 12:19
• @DavidCarlisle Did I do it right? – Steven B. Segletes Feb 24 '14 at 12:45
• Well you did what I meant, whether it's right or not the OP can judge:-) – David Carlisle Feb 24 '14 at 15:27