3

Is there a way to alter the default vertical spacing for the \\ line break command?

I am aware of the optional vertical spacing parameter for it, as well as the \smallskip,\medskip and \bigskip but I was wondering, mostly out of curiosity and not necessity, if this is possible.

8
  • Where do you use it?
    – Werner
    Commented Sep 6, 2015 at 17:47
  • The idea is being able to define it the preample of a class and then using it wherever I typically would be able to. Commented Sep 6, 2015 at 17:52
  • Yes, you may alter it. But it's probably best not to. You can easily define commands of your own, after all.
    – jon
    Commented Sep 6, 2015 at 17:52
  • 3
    The word "typically" is a little concerning: it suggests you may be using \\ far more often than you normally "should" be using it. Outside of tables, there's usually very little need to use \\ directly. And inside of tables, there are better things to do than to fiddle with \\ . Can you elaborate a little bit more with a concrete example?
    – jon
    Commented Sep 6, 2015 at 17:59
  • 1
    I asked mainly out of curiosity rather than necessity. Nonetheless, I probably do use it more often than I should. I'm generally conflicted over the usage of \vspace and \\[len] when trying, for example, to set custom spaces inside a frame when using beamer. Should \vspace be my go-to command? Commented Sep 6, 2015 at 18:27

1 Answer 1

1

Update Here is a solution (thanks to egreg's constructive comments)

\documentclass{article}
\makeatletter
\def\@xnewline{\@ifnextchar[% ] bracket matching
                  \@newline
                 {\@newline[\z@]}}
\def\@newline[#1]{\let \reserved@e \vadjust
                   \@gnewline {\vskip \dimexpr#1+2em\relax}}
\makeatother
\begin{document}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi. Nulla quis sem at nibh elementum imperdiet. Duis sagittis ipsum. Praesent mauris. Fusce nec tellus sed augue semper porta. \\
Mauris massa. Vestibulum \\lacinia arcu eget nulla.\\[1cm]
 Class aptent taciti sociosqu ad litora torquent\\ per conubia nostra, per inceptos himenaeos. Curabitur sodales ligula in libero. Sed dignissim lacinia nunc. 
\end{document}

enter image description here

4
  • You lose the possibility of adding an optional argument.
    – egreg
    Commented Sep 6, 2015 at 20:32
  • @egreg you're right. Let us wait for the OP's response.
    – touhami
    Commented Sep 6, 2015 at 20:40
  • Yes, this is what I originally asked for. Is it possible to alter it in order to include the possibility of adding the optional argument? Commented Sep 6, 2015 at 22:18
  • Hmm, this way you add a feasible page break point after the line with \\, irrespective of using \\*.
    – egreg
    Commented Sep 6, 2015 at 22:52

You must log in to answer this question.

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