Text FormattingHow can we reduce spacing between itemize and heading

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
theo moore
Posts: 72
Joined: Thu Jan 15, 2009 3:16 pm

How can we reduce spacing between itemize and heading

Post by theo moore »

For some reason, there is an extra bit of vertical space between the first itemize bullet point and an above heading when placed in a minibox environment.

Here is a sample code.

Code: Select all

\documentclass[11pt]{article}

\usepackage{titlesec}

\titleformat{\subsubsection}[hang]{\normalfont}{\thesection}{2cm}{\Large \bfseries}{}
\titlespacing{\subsubsection}{0pt}{0em}{0em}

\begin{document}

\noindent
\begin{minipage}[t]{0.75\textwidth}
\subsubsection*{Heading 1}
  \begin{itemize}
  \item Entry 1 % Why is there more vertical space above here??
  \end{itemize} 
  
\subsubsection*{Heading 2}
 \begin{itemize}
 \item Entry 2
 \end{itemize}
\end{minipage}

\vspace{2cm}

\subsubsection*{Heading 3}
  \begin{itemize}
  \item Entry 3
  \end{itemize}
  
\subsubsection*{Heading 4}
  \begin{itemize}
  \item Entry 4
  \end{itemize}
\end{document}
I don't understand why the vertical space between "Heading 1" and "Entry 1" is not the same as the vertical spaces between the other headings and their entries. It's a very small space difference, but trust me, it's noticeable.

If the minipage environment is removed, everything works as normal.

Can anybody tell me why this extra gap is being inserted?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
Stefan Kottwitz
Site Admin
Posts: 10324
Joined: Mon Mar 10, 2008 9:44 pm

How can we reduce spacing between itemize and heading

Post by Stefan Kottwitz »

With \mbox{}\par at the beginning of the minipage envivonment that space would vanish:

Code: Select all

\begin{minipage}[t]{0.75\textwidth}\mbox{}\par
\subsubsection*{Heading 1}
But of course this could cause some unwanted space too, but at the other place it could be handled differently.

Stefan
LaTeX.org admin
theo moore
Posts: 72
Joined: Thu Jan 15, 2009 3:16 pm

How can we reduce spacing between itemize and heading

Post by theo moore »

Stefan_K wrote:With \mbox{}\par at the beginning of the minipage envivonment that space would vanish:
Can you explain what this does?
But of course this could cause some unwanted space too, but at the other place it could be handled differently.
Again, I don't understand this---but perhaps if you answer the former, I'll understand the latter ;)

Also, you never explained what was the source of the extra space. Do you know?
theo moore
Posts: 72
Joined: Thu Jan 15, 2009 3:16 pm

How can we reduce spacing between itemize and heading

Post by theo moore »

In addition to the above question, can someone answer this similar one?

In my document, if I were to do this:

Code: Select all

This is one paragraph 

This is a new paragraph
There is no paragraph break (\parskip). But if I write

Code: Select all

This is one paragraph

\mbox{}\par
This is a new paragraph
Then there is indeed a new paragraph. Can you explain this?
User avatar
Stefan Kottwitz
Site Admin
Posts: 10324
Joined: Mon Mar 10, 2008 9:44 pm

Re: Extra spacing driving me CRAZY

Post by Stefan Kottwitz »

In your document \parskip is just 1pt, I guess you've noticed the additional line skip.

Stefan
LaTeX.org admin
theo moore
Posts: 72
Joined: Thu Jan 15, 2009 3:16 pm

How can we reduce spacing between itemize and heading

Post by theo moore »

Stefan_K wrote:In your document \parskip is just 1pt, I guess you've noticed the additional line skip.

Stefan
How did you know that? And more importantly, how would I know that? Is there a package that will print out all the relevant spacing settings?

Also, can you explain if \parskip is 1pt, why does a command like \mbox{}\par produce a 'new line'?
User avatar
Stefan Kottwitz
Site Admin
Posts: 10324
Joined: Mon Mar 10, 2008 9:44 pm

Re: Extra spacing driving me CRAZY

Post by Stefan Kottwitz »

To be more precise \parskip is 0pt+1pt by default in the article class. It can be printed by the command \the\parskip in a document. By \the you can print out a length.

The empty line is equivalent to \par. \mbox{} creates an empty box on the line, needing no horizontal space, the following \par breaks it again, that's why there's an empty line.

Stefan
LaTeX.org admin
theo moore
Posts: 72
Joined: Thu Jan 15, 2009 3:16 pm

How can we reduce spacing between itemize and heading

Post by theo moore »

Stefan_K wrote:To be more precise \parskip is 0pt+1pt by default in the article class. It can be printed by the command \the\parskip in a document. By \the you can print out a length.

The empty line is equivalent to \par. \mbox{} creates an empty box on the line, needing no horizontal space, the following \par breaks it again, that's why there's an empty line.

Stefan

Ooooh. I see. So the \mbox{}\par command produces a vertical space equivalent to \baselineskip.

That makes a lot of sense. Thank you.

I remember reading about a package which, we loaded, would insert a page into your document listing all the latex space commands and their uses. Does that ring a bell?
User avatar
Stefan Kottwitz
Site Admin
Posts: 10324
Joined: Mon Mar 10, 2008 9:44 pm

Re: Extra spacing driving me CRAZY

Post by Stefan Kottwitz »

The layouts package provides such commands like \pagevalues, \paragraphvalues etc.

Stefan
LaTeX.org admin
theo moore
Posts: 72
Joined: Thu Jan 15, 2009 3:16 pm

How can we reduce spacing between itemize and heading

Post by theo moore »

Stefan_K wrote:The layouts package provides such commands like \pagevalues, \paragraphvalues etc.

Stefan
Yup, that's it!

Is there a similar package for fonts? That is, it would be really useful to have something that could automatically display a font, next to its command so you could see exactly the whole family of fonts defaulted in your document.
Post Reply