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?

  • 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
  • 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
5

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.

-1

Is the following command working for you? :

\newcommand{\HRule}{\hrule\vspace{0.2mm}}
  • This looks like an answer, but it does not address the issue raised by the OP. – Patrick Trentin Aug 22 at 14:32

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.