Change space between text and text or text and math

I put

<assign|par-first|<macro|0fn>>
<assign|par-par-sep|<macro|0.5fn>>

in a .ts style file derived from tmarticle to set zero indentation of paragraphs and a 0.5fn space between paragraphs. However, it also changes the space between a text paragraph and a displayed formula. (This is also the behavoir of the generic style.)

Since text and math are already visually distinct enough, I’m wondering how to set the space between them to be smaller (similar to that of tmarticle). Alternatively, how can I only set the space between texts?

Thank you.

Hi, if you give a look at the equation* macro, you see this:

<assign|equation*|
  <macro|body|
    <\with|mode|math|math-display|true|par-ver-sep|<eqn-ver-sep>>
       <surround|<no-page-break*><vspace*|<eqn-short-above>><no-indent><htab|0fn>
                |<htab|0fn><vspace|<eqn-short-below>><no-indent*>
                |<arg|body>>
    </with>>>

and you can also check that the equation macro derives from this via equation-lab macro. So there are the variables eqn-ver-sep, eqn-short-above and eqn-short-below which can be used to customise the behaviour. The env-math package also give some brief descripition on what all these spaces are supposed to do:

3 Likes

A convenient way to experiment with these settings is to put the cursor inside an equation and clicking the wrench icon or Focus->Preferences. You will see options Eqn short above etc. that correspond to the parameters that @mgubi pointed out.

Once you’re happy with the settings, you can extract them using Tools->Macros->Extract style package and add them to your style files.

2 Likes

Thanks. These settings seem to work. However, at some places the spacing is too small, but even a 0.01fn of eqn-short-above, eqn-short-below, eqn-long-above, and eqn-long-below will have a huge effect and make the spacing large again.

<assign|par-first|<macro|0fn>>
<assign|par-par-sep|<macro|0.5fn>>
<assign|eqn-short-above|<macro|0fn>>
<assign|eqn-short-below|<macro|0fn>>
<assign|eqn-long-above|<macro|0fn>>
<assign|eqn-long-below|<macro|0fn>>
  1. According to the env-math file, changing par-par-sep should not affect all those parameters and indeed I see those parameters are still default. But the space still changes.

  2. I guess “collision” means overlapping between the formula and the text above/below it? However, even when no such collision happens, increasing eqn-ver-sep still increases the spacing. I expected it to only have an effect when collision happens. In fact the behavior of eqn-ver-sep is pretty strange. It changes some spacing while not others.

  3. I guess no negative values are allowed in those fields as if I do it’s the same as 0fn. If par-par-sep further increases then adjusting these values won’t work.

I think that is controlled by the environment variable par-hor-sep, which for the tmarticle style is set at 0.5fn. You can read the definition of this variable in the manual, section 15.4, Paragraph layout.

For your third point, I observed too no effect for negative values in eqn-short-above and eqn-long-above, which might depend on the C++ code. Let us see if @mgubi and @jeroen have a better idea.