2

I have a block of text:

Blah: \\
line1 \\
line2 \\
line3 \\
Blah.

I want to change the line spacing between lines 1-3 only. But somehow I cannot do that with \linespread{} or \setstretch{} -- the line spacing created by \\ seems to be unaffected by those commands. What can I do?

  • 5
    In which context are you using those manual line breaks? You could use the optional argument, as in \\[-5pt] or \\[15pt], but if you tell us the real-case use at hand, perhaps we could suggest better alternatives? – Gonzalo Medina Aug 10 '15 at 0:32
  • 1
    With \\[<amount of vertical space>]. For example \\[3pt] ? – Zarko Aug 10 '15 at 0:35
  • Yes, that solves the problem beautifully. – Yan King Yin Aug 10 '15 at 0:41
  • I was trying to inline some code in a literary work. Don't want to invoke the algorithms package :) – Yan King Yin Aug 10 '15 at 0:41
2

I would have a look on the package listings if you want to add code to your text.

For your example, you may use any addition of vertical space as mentioned here: https://tex.stackexchange.com/a/41488

Here are some examples:

% arara: pdflatex

\documentclass{article}

\begin{document}
\noindent   
Blah: \\[1cm]
line1 \medskip\\ % or smallskip or bigskip
line2 \vspace{1cm}\\
line3 \\
Blah.
\end{document}

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.