4

I have a command:

\newcommand{\HRule}{\rule{\linewidth}{0.2mm}}

and it produces a thickness I am happy with but the space before and after the line is far too large and taking up much of my document. How can I change this?

Chris
  • 831
Alex
  • 163
  • It mostly depends on how and where you want to use it. – egreg Sep 29 '13 at 14:38
  • It is dividing sections on my Resume - but with too much vertical spacing above and below – Alex Sep 29 '13 at 14:39
  • 1
    I think a MWE which includes a preamble and creates the same problem would be useful here. – A.Ellett Sep 29 '13 at 14:40
  • \par\nopagebreak\medskip\hrule\medskip could be better, but it depends on many factors. Please, try and present a minimal example. – egreg Sep 29 '13 at 14:41
  • Have you given \hrule (default thickness: 0.4pt) a try? – Mico Sep 29 '13 at 14:42
  • hrule is a much nicer vertical spacing but it goes all the way to the far right of the page, and everything else is restricted by a margin somehow.. I'm sorry I'm using my brother's template and am not aware really of how it's working – Alex Sep 29 '13 at 14:44
  • 1
    It's essential that you provide an MWE that includes all relevant considerations, such as the fact that you appear to be working with narrow columns. – Mico Sep 29 '13 at 15:59

2 Answers2

6

Here is a version of \HRule that allows you to adjust the gap above/below with an optional argument:

enter image description here

\documentclass{article}
\newcommand{\HRule}[1][\medskipamount]{\par
  \vspace*{\dimexpr-\parskip-\baselineskip+#1}
  \noindent\rule{\linewidth}{0.2mm}\par
  \vspace*{\dimexpr-\parskip-.5\baselineskip+#1}}
\begin{document}
\noindent
\begin{minipage}[t]{.5\linewidth}
Here is some regular text.

\HRule

Here is some regular text.
\end{minipage}%
\begin{minipage}[t]{.5\linewidth}
Here is some regular text.

\HRule[0pt]

Here is some regular text.
\end{minipage}
\end{document}

The default gap (shown on the left) is \medskipamount (6pt plus 2pt minus 2pt), but you can adjust that. For example, on the right a gap of 0pt is set.

Werner
  • 603,163
-1

Is the following command working for you? :

\newcommand{\HRule}{\hrule\vspace{0.2mm}}
Sage
  • 189