0

This is a follow-up to this question.

I would like the contents of the page to start exactly where they would start if the header wasn't present. This turns out to be a lot more difficult than expected.

The following code works for small font sizes following the title:

\documentclass[twoside=false]{scrbook}

\setlength\parindent{0pt}

\begin{document}
\setlength\parindent{0pt}%
\thispagestyle{plain}
\vspace*{-\dimexpr\topskip+\baselineskip+\parskip}
\parbox[b][0pt]{\textwidth}{
    {\Huge Test}\\[-1ex]
    \rule{\dimexpr\textwidth}{1mm}
}
\par
{\Large\vspace{\dimexpr\topskip-\baselineskip-\parskip}}

\Large test

\clearpage

test

\end{document}

However, using \Huge as font size for the following text, the height of the text outgrows \topskip (I think?), so my solution does not work any more.

Using environments that add vertical space does not seem to work either, since \vspace behaves differently when there is no text at the start of the page.

I have tried

\newcommand\vspacesave[1]{\vspace{#1}}
\renewcommand\vspace[1]{\vspace*{#1}}
\begin{flushleft}
    test
\end{flushleft}
\renewcommand\vspace[1]{\vspacesave{#1}}

but to no avail.

Edit: All of this seems to be in vain anyway, since trying to create space with vspace*{...} just gives me different amounts of space again...

  • if what you're inserting is only one line, you could \smash it and insert a \strut of the "usual" size to establish the baseline. (not tested) – barbara beeton Mar 29 '16 at 12:48
  • @barbarabeeton:Thanks. Although I am not quite sure how this magic trick works, it solved the \vspace* issue. – chaosflaws Mar 31 '16 at 12:57
1

if what you're inserting is only one line, you could \smash it and insert a \strut of the "usual" size to establish the baseline.

\smash gives the "smashed" material a zero height and depth. that would result in it being moved higher on the page, so you really need to reset the height to the "usual" value. that's what a \strut does.

\strut also resets the depth. in this case that doesn't matter, but there are situations where it does.

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.