How to avoid spaces after figure

Im trying to make the rules equally spaced

\begin{center}
\rule{\textwidth}{.6pt}
\end{center}

\begin{figure}[H]
\centering
\rule{0.5cm}{0.5cm}
\end{figure}

\begin{center}
\rule{\textwidth}{.6pt}
\end{center}

• Do you really need figure? Mar 1, 2018 at 22:31

It's better to use a low level primitive, namely \hrule:

\documentclass{article}

\begin{document}

\begin{center}
\hrule height 0.6pt

\vspace{1cm}

\rule{0.5cm}{0.5cm}

\vspace{1cm}

\hrule height 0.6pt
\end{center}

\end{document}


• texdef does not work on \hrule. How to see its definition? Mar 1, 2018 at 23:40
• @Sigur \hrule is a TeX primitive. Mar 1, 2018 at 23:44
• But is it possible to understand better what it is? I mean, how it was defined, constructed, or some other method related to it. For example, how to make it to produce a line? Mar 1, 2018 at 23:48
• @Sigur Look in the TeXbook or in TeX by topic Mar 2, 2018 at 6:56

Also possible with tikz:

\documentclass{article}
\usepackage{tikz}
\begin{document}

\noindent%
\begin{tikzpicture}
\draw (0, 0) -- ++(\linewidth,0)
(0,-2) -- ++(\linewidth,0);
\node [draw,fill,minimum size=.5cm] at (\linewidth/2,-1){};
\end{tikzpicture}

\end{document}