0

I'd like to reduce the blank space between a figure that I generate via tikz and enumaration environment.

\documentclass{article}
\usepackage{tikz}
\usepackage{enumitem}[nosep]
\newcommand{\zerodisplayskips}{%
  \setlength{\abovedisplayskip}{0pt}%
  \setlength{\belowdisplayskip}{0pt}%
  \setlength{\abovedisplayshortskip}{0pt}%
  \setlength{\belowdisplayshortskip}{0pt}}
  \setlength\parindent{0pt}
\begin{document}

\begin{figure}[!h]
     \begin{tikzpicture}[
       thick,acteur/.style={ circle,fill=black,thick,inner sep=1pt,minimum size=0.3cm
       },font = \scriptsize
     ]
        \node (0) at (0,0) [acteur]{};
        \node (1) at (1,-2) [acteur]{};
        \node (2) at (2,0) [acteur]{};
         \foreach \from/\to in {0/1, 0/2, 1/2} \draw[thick](\from) -- (\to); 
    \end{tikzpicture}
\end{figure}
\begin{enumerate}
    \item A
    \item B
\end{enumerate}
\end{document}

I have updated all displayskips, however, there seems like a redundant space. In the original document, it looks quite bizarre.

enter image description here

6
  • Most likely unrelated but a \labelwithout a \caption does not really make sense. Did you remove the \caption for the MWE or is there no caption in your actual document?
    – leandriis
    Jun 14, 2020 at 15:37
  • I did remove everything to create a MWE. Otherwise, I do have all the information in the original text file. I have edited my post and removed \label.
    – ball_jan
    Jun 14, 2020 at 15:44
  • 1
    the displayskips are for display math so have would no effect here even if you ran the \zerodisplayskips command (which this example does not do). the enumerate is in the main document flow but you have specified that the tikz is in a float so is taken out of the flow and is an insert that may be inserted to help with page breaking, so there isn't really a define space between these things, but perhaps you are looking for \intextsep which is the space added if the float is positioned using h Jun 14, 2020 at 15:51
  • 2
    If you always want the tikzpicture to be above the enumerate simply omit the figure environment. Jun 14, 2020 at 15:51
  • @DavidCarlisle Great! \setlength{\intextsep}{0mm} actually has solved my problem. If you share this as an answer, I can go ahead and accept it.
    – ball_jan
    Jun 14, 2020 at 15:54

1 Answer 1

2

The displayskips are for display math so have would no effect here even if you ran the \zerodisplayskips command (which this example does not do). the enumerate is in the main document flow but you have specified that the tikz is in a float so is taken out of the flow and is an insert that may be inserted to help with page breaking, so there isn't really a definite space between these things.

A float which is positioned by h will have \intextsep spacing added above and below so you could reduce that, however if you always want the tikz to be above the enumerate then you should not float it, and simply remove the figure environment.

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.