2

I am trying to remove the space between the elements that I show in the following image. The space I talk about is denoted by the gray line (that line is not produced by LaTeX, it is merely a way to visualize the space in question)

enter image description here

To be more exact the spaces I want to reduce are:

  1. Space between sections and subsections

  2. Space between sections/subsections and text/images/math

  3. Space between text images and math

How can I do that?

I have tried to use the followings but they didn't give me a good result and a good way to handle the spaces with precision.

\usepackage{titlesec}

\titlespacing\section{0pt}{12pt plus 4pt minus 2pt}{0pt plus 2pt minus 2pt}
\titlespacing\subsection{0pt}{12pt plus 4pt minus 2pt}{0pt plus 2pt minus 2pt}
\titlespacing\subsubsection{0pt}{12pt plus 4pt minus 2pt}{0pt plus 2pt minus 2pt}

\setlength{\abovedisplayskip}{0pt}
\setlength{\belowdisplayskip}{0pt}

MWE

\documentclass{article}

\usepackage
[   
    top = 0.2in,
    bottom = 0.2in,
    left = 0.2in,
    right = 0.2in,
]{geometry}

\usepackage[fontsize=8pt]{scrextend}

\usepackage{amsmath}

\usepackage{unicode-math}

\usepackage{parskip}

\setlength{\parindent}{0cm}

\usepackage{multicol}

\begin{document}

\setlength{\abovedisplayskip}{0pt}

\setlength{\belowdisplayskip}{0pt}

\columnseprule=0.8pt

\begin{multicols*}{4}

\section*{Section Title 1}

\subsection*{Subsection Title 1}

Text here

\subsection*{Subsection Title 2}
%
\begin{align*}
&x+y=1\\
&x+z=2
\end{align*}


\subsection*{Subsection Title 3}

\includegraphics[width=\columnwidth]{1.png}
%
\begin{equation*}
x+y=1
\end{equation*}

\includegraphics[width=\columnwidth]{2.png}

\subsection*{Subsection Title 4}

\includegraphics[width=\columnwidth]{1.png}
%
\begin{equation*}
x+y=1
\end{equation*}

\end{multicols*}


\end{document}
Adam
  • 4,684
  • Related? http://tex.stackexchange.com/questions/108684/spacing-before-and-after-section-titles At least insofar as section titles. – Steven B. Segletes Apr 13 '16 at 20:03
  • @StevenB.Segletes I mention in my question that this is one the ways I tried and didn't quite work. Thanks though. :) – Adam Apr 13 '16 at 20:04
  • The cited question has more than one answer. – Steven B. Segletes Apr 13 '16 at 20:05
  • If you want 'precision' why are you using rubber lengths? – jon Apr 13 '16 at 20:22
  • @jon I don't even know what rubber length means! :P – Adam Apr 13 '16 at 20:22
  • Look at TeX primitives \baselineskip, \lineskiplimit, \lineskip. Nothing more is needed. LaTeX (unfortunately) makes things more complicated. – wipet Apr 13 '16 at 20:25
  • 1
    12pt plus 4pt minus 2pt is 'rubber': you are asking for 12pt plus 4pts worth of possible stretch and up to 2pts worth of 'shrink'. 12pt by itself would not stretch or shrink. – jon Apr 13 '16 at 20:28
  • 1
    somewhere after \begin{document} insert the line \showthe\parskipand see what it says (it will report on your screen, and halt the job temporarily). then add\setlength{\parskip}{0pt}` and try again; see if there's any difference. that's only part of the story, but it does play a part. – barbara beeton Apr 13 '16 at 20:28
  • @barbarabeeton It doesn't pause and doesn't say anything (I want to mention that I use ShareLaTeX). – Adam Apr 13 '16 at 20:32
  • @jon Useful point! – Adam Apr 13 '16 at 20:32
  • 1
    @Adam -- okay, i'm not a sharelatex user. if you have a log file (you should, but on-line services often hide them) it will show the result. but you should also see some difference in the outputs from the runs with/without resetting \parskip. – barbara beeton Apr 13 '16 at 20:37
  • 1
    Also, you should note that \titlespacing doesn't define the vertical spacing before and after a section title, but what is added to the normal \baselineskip. – Bernard Apr 13 '16 at 20:45

0 Answers0