1

As a followup question to Fullwidth section heading in twosided layout I'd also like to inquire about vertical spacing on new pages. The idea is that the top element of the section title starts somewhere in the middle of the page, and the text block on the next page starts equally as low. The MWE

\documentclass{article}
\usepackage{changepage}
\usepackage[paperwidth=483pt, paperheight=682pt, left=40pt, top=40pt, textwidth=283pt, marginparsep=20pt, marginparwidth=100pt, textheight=51\baselineskip, footskip=40pt]{geometry}
\usepackage[explicit]{titlesec}%
\newdimen\mydimen
\mydimen=0pt
\titleformat{name=\section}%
{}%
{}%
{0pt}%
{%
  \thispagestyle{empty}%
  \vspace*{\mydimen}
  \begin{adjustwidth*}{0pt}{\dimexpr\marginparwidth+\marginparsep\relax}%
  %
  \begin{minipage}[t][.8\textheight]{\linewidth}
  x
  \end{minipage}
  \end{adjustwidth*}%
  }[\clearpage
  \vspace*{\mydimen}
  ]%
\begin{document}
\section{x}
x
\clearpage
\noindent x
\end{document}

should intuitively have the result that all three x's at the top of the page are vertically as well as horizontally aligned. This doesn't seem to be the case (somehow). How can I align all three x's here?

1

You don't need adjustwidth: just define a wide enough minipage and put it in a zero width box.

Next, set the spacings for \section to zero except the last that must be -\baselineskip.

\documentclass[draft]{article}
\usepackage[showframe]{geometry}

\usepackage[explicit]{titlesec}

\newlength\mydimen

\titleformat{name=\section}
  {}
  {}
  {0pt}
  {%
   \thispagestyle{empty}%
   \vspace*{\mydimen}%
   \makebox[0pt][l]{%
     \begin{minipage}[t][.8\textheight]{\dimexpr\textwidth+\marginparwidth+\marginparsep}
     x
     \end{minipage}%
   }
  }
  [\clearpage\vspace*{\mydimen}]
\titlespacing*{\section}{0pt}{0pt}{-\baselineskip}

\begin{document}
\section{x}
x
\clearpage
\noindent x
\end{document}

I can't see what's the role of \mydimen.

  • This is a nice answer. I'm accepting it. Note for passers-by: I've replaced \vspace* with \vskip\mydimen and set the third argument to \titlespacing to be 0pt as well. I'm not sure why it works, but it does. And that's fine by me. :-) – 1010011010 Aug 9 '15 at 20:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.