I'm trying to define a new command similar to

\newcommand {\mainv} {\par\noindent\hspace*{0pt}\ignorespaces}

However, I want to have some negative preceding vertical space. I know that \vspace adds vertical space after the text. Is there a similar command that can add vertical space before the text?

The command that will provide the following output will be:

\main {This text is written using command main}
\mainv {This text is written using command mainv}

where \main is defined as

\newcommand {\main} {\par\noindent\hspace*{0pt}\ignorespaces}

The following image in MS Word shows what I'm looking for:

  • Could you provide an image of what you mean?
    – Werner
    Commented Jul 11, 2016 at 4:33
  • @Werner I added a sample text which is written in MS Word. The preceding space of second line is reduced.
    – Matt
    Commented Jul 11, 2016 at 4:40
  • Can you also show the command usage that would provide the required output?
    – Werner
    Commented Jul 11, 2016 at 5:17
  • @Werner Sure. It would be something like \main {This text is written using command main} \mainv {This text is written using command mainv}
    – Matt
    Commented Jul 12, 2016 at 15:18
  • How is the macro \main defined?
    – Mico
    Commented Jul 12, 2016 at 18:32

3 Answers 3


Something like this?




\main Some text
\main Some text
\main Some text
\mainV some other, overlapping text

Output from the code above


It is not completely clear to me what you are trying to achieve and why do you want to overlap lines, so I’ll stick to the question “Is there a command that can add vertical space before a line of text?”.

The pdfTeX engine has a \vadjust pre primitive that can conveniently be used for this. See the following MWE.

% My standard header for TeX.SX answers:
\documentclass[a4paper]{article} % To avoid confusion, let us explicitly 
                                 % declare the paper format.

\usepackage[T1]{fontenc}         % Not always necessary, but recommended.
% End of standard header.  What follows pertains to the problem at hand.


    \ifvmode % if in vertical mode, act as "\vspace{#1}"
        \vskip #1
        \vskip \z@skip
        \vadjust pre {%
            \vskip #1
            \vskip \z@skip



Here is some nonsensical text, written for the sole purpose of filling up at
least one line.  Well, after all I~think that two lines would be even better.
And now, we use our new command exactly here\vspacebeforeline{18pt plus 6pt 
minus 6pt}, followed by a few other words to end the test.


It can be used in vertical mode, too.


This is the output it produces:

Output of the code

  • Learn something everyday :) Commented Jul 12, 2016 at 19:29
  • Thanks Gustavo. I'll try this solution later today, but I guess it does what I'm looking for.
    – Matt
    Commented Jul 13, 2016 at 15:47

Unless you are trying to overlap lines, I would venture to guess you're looking for the variable \baselineskip or \baselinestretch? But you probably don't want to change those variables directly because other macros scale off of them.

\baselineskip: A parameter that tells TeX the distance between baselines.

or \linespread

e.g. set line spread for next font change: \linespread{1.5}\selectfont

Otherwise, yeah, just manipulating the space around vertical boxes, \vspace{<natural height> plus <stretching> minus <shrinking>} is your tool.

To get yourself on the right track

  • Thanks a lot for your explanation. There is a lot of useful information in your answer. Sorry I can't up-vote yet.
    – Matt
    Commented Jul 12, 2016 at 19:05
  • @Mahdi No prob. Yea without a working example from you, it's a shot in the dark, but I see you're new here. Commented Jul 12, 2016 at 19:07

You must log in to answer this question.

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