0

This is very introductory question. I want to draw two lines with 3 cm distance. But the code

\noindent\rule{\linewidth}{2pt}
\vspace{3.1cm}
\noindent\rule{\linewidth}{2pt}

does not give 3 cm distance in between. I want equal distance rule above and below the title. enter image description here

How to change it?

2
  • 3
    "By itself" your code should work. The reason it does not work, is because it is not "by itself". Provide more code (a minimal working example) showing how you have structured the title. It should be enough code to build a small PDF.
    – user287367
    Commented Jan 9 at 19:01
  • 1
    you are adding the space after the second rule. use a blank line before the vspace so that it is added between the rules. Commented Jan 9 at 22:37

1 Answer 1

1

You are adding the space after the second rule. use a blank line before the vspace so that it is added between the rules.

See the first vspace acts after the paragraph is broken in to lines, so comes after the second rule, before yyy, but with a blank line before the vspace it is added at that point and comes between the lines not before zzz.

enter image description here

% 
\documentclass{article}

\begin{document}
% 

xxx

\noindent\rule{\linewidth}{2pt}
\vspace{3.1cm}
\noindent\rule{\linewidth}{2pt}

yyy



\noindent\rule{\linewidth}{2pt}

\vspace{3.1cm}
\noindent\rule{\linewidth}{2pt}

zzz
\end{document}

% 
\end{document}

You must log in to answer this question.

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