1

I have created a custom header that's perfect except for some unwanted vertical spacing between the header and the body. Currently there's about 14mm of spacing, and I'd like to reduce it to about 7mm. Nothing I've tried has reduced the spacing: I've tried vspace{-7mm} in various places, and I've tried to adjust the height of the minipage, but to no avail. My code is below along with a picture of the output.

\documentclass[12pt,letterpaper]{article}
\usepackage{titling}
\usepackage{graphicx,xcolor}
\usepackage[top=2cm, bottom=2cm, left=2cm, right=2cm,headheight=50pt,headsep=0pt]{geometry}
\usepackage{amsmath,amsthm,amsfonts,amssymb,amscd,mathrsfs}
\usepackage{lastpage, enumerate, fancyhdr}
\usepackage{hyperref}
\usepackage{csquotes}
\allowdisplaybreaks
\setlength\parindent{0pt}
\raggedbottom
%\usepackage{showframe}

\renewcommand\maketitlehooka{%

    \vspace{-10cm}
    \begin{minipage}[t][10cm][b]{\textwidth}
        \begin{minipage}{.35\textwidth}
            Calculus II --- Quiz 8 \\ November 24, 2019
        \end{minipage}%
        \begin{minipage}{.65\textwidth}
             \raggedleft
              \vspace{5mm} Full Name: \underline{\hspace{4cm}} 
        \end{minipage}%
        \vspace{2mm}
        \line(1,0){500}
        \textit{ Answer all of the following problems. You must \textbf{show all of your work} to receive full credit. This quiz is worth 10 points. } 
    \end{minipage}
    \begin{minipage}[b][0cm][b]{\textwidth}
        \author{} %leave empty
        \date{} %leave empty
        \title{} %leave empty
        \vspace{-1cm}
    \end{minipage}

}


\begin{document}

\maketitle
\vspace{-3.5cm}
1) I would like the vertical space between this line and \enquote{This quiz is worth 10 points} to be about half the amount it currently is.


\end{document}

Here's a picture

4
  • what is the second minipage for? I would not bother doing this as a titlepage section. Why don't you just put the minipage you like on the page?
    – Thruston
    Nov 24, 2019 at 23:10
  • @ Thruston: I should have ommitted that; it was left over from one of my attempts to reduce the spacing.
    – Leonidas
    Nov 24, 2019 at 23:24
  • @siracusa: I tried changing the value of headheight to 0pt and also tried making it negative, but there was no change in the spacing whatsoever :(
    – Leonidas
    Nov 24, 2019 at 23:24
  • Problem solved? May 8, 2021 at 0:58

2 Answers 2

2

Why not use the fancyhdr package to your advantage? To change the spacing between the last line of the italic header and the first line of the actual text, change the value of headsep to your liking.

enter image description here

\documentclass[12pt,letterpaper]{article}
\usepackage{titling}
\usepackage{graphicx,xcolor}
\usepackage[top=4.25cm, bottom=2cm, left=2cm, right=2cm,headheight=65pt,headsep=15pt]{geometry}
\usepackage{amsmath,amsthm,amsfonts,amssymb,amscd,mathrsfs}
\usepackage{lastpage, enumerate, fancyhdr}
\usepackage{tabularx,calc,booktabs} %<----- added
\usepackage{csquotes}
\usepackage{hyperref}
\allowdisplaybreaks
\setlength\parindent{0pt}
\raggedbottom
%\usepackage{showframe}

\lhead{\begin{tabularx}{\linewidth}{@{}l>{\raggedleft\arraybackslash}X@{}}
       Calculus II --- Quiz 8 \\ 
       November 24, 2019  &  Full Name: \underline{\hspace{4cm}}\\
       \midrule
       \multicolumn{2}{@{}p{\textwidth}@{}}{\textit{Answer all of the following problems. You must \textbf{show all of your work} to receive full credit. This quiz is worth 10 points.}}
       \end{tabularx}}
\renewcommand{\headrulewidth}{0pt}


\pagestyle{fancy}



\begin{document}

1) I would like the vertical space between this line and \enquote{This quiz is worth 10 points} to be about half the amount it currently is.

\end{document}
3
  • I am trying to avoid using fancyhdr because I want to potentially have multiple pages in the document without any header on the following pages. Essentially, I want the header just like you've made it, but only on the first page, with no headers on successive pages. Thanks.
    – Leonidas
    Nov 24, 2019 at 23:21
  • 1
    In that case, just place the tabularx wherever you want to use it in your document.
    – leandriis
    Nov 24, 2019 at 23:29
  • Thank you, I removed the lhead{ part and put the tabularx block after begin{document} and it looks perfect!
    – Leonidas
    Nov 24, 2019 at 23:38
2

Remove the last (empty) minipage and use \maketitlehookd. Unrelated: I took to opportunity to simplify a bit your preamble.

\documentclass[12pt,letterpaper]{article}
\usepackage{titling}
\usepackage{graphicx,xcolor}
\usepackage[margin=2cm, headheight=50pt, headsep=0pt]{geometry}
\usepackage{amsmath, amsthm, amssymb, amscd, mathrsfs}
\usepackage{lastpage, enumerate, fancyhdr}
\usepackage{hyperref}
\usepackage{csquotes}
\allowdisplaybreaks
\setlength\parindent{0pt}
\raggedbottom
%\usepackage{showframe}

   \setlength{\droptitle}{-10cm}%
\renewcommand\maketitlehooka{%
    \begin{minipage}[t][10cm][b]{\textwidth}
        \begin{minipage}{.35\textwidth}
            Calculus II --- Quiz 8 \\ November 24, 2019
        \end{minipage}%
        \begin{minipage}{.65\textwidth}
             \raggedleft
              \vspace{5mm} Full Name: \underline{\hspace{4cm}}
        \end{minipage}%
        \vspace{2mm}
        \line(1,0){500}
        \textit{ Answer all of the following problems. You must \textbf{show all of your work} to receive full credit. This quiz is worth 10 points. }
    \end{minipage}
}
 \author{} %leave empty
 \date{} %leave empty
 \title{} %leave empty
\renewcommand{\maketitlehookd}{\vspace{-7\baselineskip}}

\begin{document}

\maketitle

1) I would like the vertical space between this line and \enquote{This quiz is worth 10 points} to be about half the amount it currently is.

\end{document} 

enter image description here

1
  • Thanks for this alternative solution.
    – Leonidas
    Nov 25, 2019 at 0:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .