# How to define space as a variable?

I want to define a command that makes vertical space like \\[30pt] variable. I want to define the string between the brackets so that it is variable like 20pt or 1.5cm. Thus I would be able to define my desired vertical space just once.

• Can you please explain better what's your aim? – egreg Jan 12 '16 at 20:33
• @Werner It seems that \ gives you double backlash while I have got a single one. What I am doing wrong? – Przemysław Scherwentke Jan 12 '16 at 21:12
• @PrzemysławScherwentke: See this comment. You need <bt><bt>\\<bt><bt> (where <bt>=). – Werner Jan 12 '16 at 21:14
• @Werner Thank you! Curiosities of MathJax conquer me from time to time. – Przemysław Scherwentke Jan 13 '16 at 16:41

## 1 Answer

As far as I understand you want something like

\def\myspace{\vspace{20pt}}


or

\newcommand{\myspace}{\vspace*{1.5cm}}


It will be used in vertical mode, e.g. \myspace in the paragraph will move the next line of this paragraph.

• Thanks for the suggestion. However \[30pt] does two things: new line and vertical space. Is it possible to combine them in a way as you suggested? – Aymen Jan 12 '16 at 21:01
• Yes, it is possible, but using \ (Double backlash. How to obtain it in a comment?!) to obtain a new line outside special envirenments, e.g. tabular is a bad idea. If you want to use your vertical space in a tabular-like environment, you can simply define, say, \def\1{\\[30pt]} and use \1 instead of \. – Przemysław Scherwentke Jan 12 '16 at 21:07
• Use “double backquote, double backslash, double backquote”: \\ – egreg Jan 12 '16 at 23:00
• @egreg Thank you! I will remember it now, I hope. – Przemysław Scherwentke Jan 13 '16 at 16:41