Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have defined a macro for 2 closely spaced horizontal lines,

\newcommand{\myline}{\par\noindent% 
\rule{\linewidth}{1.5pt} \\[-0.80\baselineskip]%
\rule{\linewidth}{0.8pt}}

Now I noticed that when putting it at different places in the text and at different environments, results in a slightly different vertical spacing between them. Is it possible to fix the spacing between them? (regardless of the line spacing in the environment they are inside)

Edit:

also when defining a linespace in definite units, it still depends on the font. For example:

\documentclass[a4paper,10pt,english]{article}
\usepackage{babel}
\usepackage{blindtext}

\newcommand{\myline}{\par\noindent% 
\rule{\linewidth}{1.5pt} \\[-9pt]%
\rule{\linewidth}{0.8pt}}

\begin{document}
    \noindent \blindtext
    \myline

\begin{quotation}
    \small \myline
\end{quotation}

\end{document}
share|improve this question
    
Just write \\[-3pt] or something like this with an explicit length (\baselineskip can change across environments). An example would be useful, anyway. –  egreg Oct 7 '11 at 8:25
    
@egreg See my edit –  PineApple Oct 7 '11 at 8:42
    
\\[x] doesn't work, it starts a new line after x. Even if x is explicit, the newline is not. –  Roelof Spijker Oct 7 '11 at 9:01

2 Answers 2

up vote 8 down vote accepted

You can try

\newcommand{\myline}{\par
  \kern3pt % space above the rules
  \hrule height 1.5pt
  \kern2pt % space between the rules
  \hrule height 0.8pt
  \kern3pt % space below the rules
}

Change the spacings to suit your needs.

share|improve this answer
    
Thanks! it seems stable –  PineApple Oct 7 '11 at 11:04

This is because you are using \baselineskip, rather use a fixed value \\[3pt]

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.