Discussion:
Amsmath / \intertext
(too old to reply)
Luc Mercier
2006-04-26 21:28:19 UTC
Permalink
Hi,

I want to have, in an align environment, some very short text
introducing equation. The text is so short (one or two words) that
placing it using intertext looks weird, and wastes room. I'd like to
have it left-aligned, on the same line as the equation.

I thought the vertical space after an \intertext was \abovedisplayskip.

I tried:
- to set \abovedisplayskip to 0pt before the \intertext: does not change
anything. I also tried to change \abovedisplayshortskip,
\belowdisplayskip, \belowdisplayshortskip: same result.

- to place a negative space after the intertext. I tried with
(-\baselineskip), (-\baselineskip - \abovedisplayskip) and other such
combinations. I haven't found any which produce the desired alignment.

- to use the nccmath package and to use \intertext[0pt]{blah blah}:
still not aligned.


Any idea ?

Thx.
Lars Madsen
2006-04-26 23:32:36 UTC
Permalink
Post by Luc Mercier
Hi,
I want to have, in an align environment, some very short text
introducing equation. The text is so short (one or two words) that
placing it using intertext looks weird, and wastes room. I'd like to
have it left-aligned, on the same line as the equation.
I thought the vertical space after an \intertext was \abovedisplayskip.
- to set \abovedisplayskip to 0pt before the \intertext: does not change
anything. I also tried to change \abovedisplayshortskip,
\belowdisplayskip, \belowdisplayshortskip: same result.
- to place a negative space after the intertext. I tried with
(-\baselineskip), (-\baselineskip - \abovedisplayskip) and other such
combinations. I haven't found any which produce the desired alignment.
still not aligned.
Any idea ?
Thx.
try \shortintertext from the mathtools package

/daleif
Achim Blumensath
2006-04-27 06:09:51 UTC
Permalink
Hello,
Post by Luc Mercier
I want to have, in an align environment, some very short text
introducing equation. The text is so short (one or two words) that
placing it using intertext looks weird, and wastes room. I'd like to
have it left-aligned, on the same line as the equation.
I'm using the following macro for this purpose:

\newcommand\prefixtext[1]{%
\ifvmode\else\\\@empty\fi
\noalign{%
\penalty0%
\vbox{\mathstrut}%
\penalty10000%
\vskip-\baselineskip
\penalty10000%
\vbox to 0pt{%
\normalbaselines
\ifdim\linewidth=\columnwidth
\else
\parshape\@ne
\@totalleftmargin\linewidth
\fi
\vss
\noindent#1\par}%
\penalty10000%
\vskip-\baselineskip}%
\penalty10000}

Achim
--
________________________________________________________________________
| \_____/ |
Achim Blumensath \O/ \___/\ |
TU Darmstadt =o= \ /\ \|
www.mathematik.tu-darmstadt.de/~blumensath /"\ o----|
____________________________________________________________________\___|
Luc Mercier
2006-04-27 14:55:48 UTC
Permalink
Awesome ! Exactly what I wanted. The mathtools' \shortintertext didn't
suit my need.

Thx to both of you.
Post by Achim Blumensath
Hello,
Post by Luc Mercier
I want to have, in an align environment, some very short text
introducing equation. The text is so short (one or two words) that
placing it using intertext looks weird, and wastes room. I'd like to
have it left-aligned, on the same line as the equation.
\newcommand\prefixtext[1]{%
\noalign{%
\penalty0%
\vbox{\mathstrut}%
\penalty10000%
\vskip-\baselineskip
\penalty10000%
\vbox to 0pt{%
\normalbaselines
\ifdim\linewidth=\columnwidth
\else
\fi
\vss
\noindent#1\par}%
\penalty10000%
\vskip-\baselineskip}%
\penalty10000}
Achim
Lars Madsen
2006-04-27 15:06:32 UTC
Permalink
Post by Luc Mercier
Awesome ! Exactly what I wanted. The mathtools' \shortintertext didn't
suit my need.
Thx to both of you.
Post by Achim Blumensath
Hello,
Post by Luc Mercier
I want to have, in an align environment, some very short text
introducing equation. The text is so short (one or two words) that
placing it using intertext looks weird, and wastes room. I'd like to
have it left-aligned, on the same line as the equation.
\newcommand\prefixtext[1]{%
\noalign{%
\penalty0%
\vbox{\mathstrut}%
\penalty10000%
\vskip-\baselineskip
\penalty10000%
\vbox to 0pt{%
\normalbaselines
\ifdim\linewidth=\columnwidth
\else
\fi
\vss
\noindent#1\par}%
\penalty10000%
\vskip-\baselineskip}%
\penalty10000}
Achim
could you give an example of your use of achims code?

(maybe it was something I could include in my LaTeX book)
--
/daleif (remove RTFSIGNATURE from email address)

LaTeX FAQ: http://www.tex.ac.uk/faq
Superb Class: http://www.ctan.org/tex-archive/help/Catalogue/entries/memoir.html
LaTeX book: http://www.imf.au.dk/system/latex/bog/ (in Danish)
Remember to post minimal working examples.
Luc Mercier
2006-04-27 17:47:03 UTC
Permalink
Sure. Try that:

(here it looks actually weird, because minimal have small margins and
equations are not large enough, so the horizontal space is gigantic, but
you get the idea)


\documentclass{minimal}

\usepackage{amsmath}

\newcommand\prefixtext[1]{%
\ifvmode\else\\\@empty\fi
\noalign{%
\penalty0%
\vbox{\mathstrut}%
\penalty10000%
\vskip-\baselineskip
\penalty10000%
\vbox to 0pt{%
\normalbaselines
\ifdim\linewidth=\columnwidth
\else
\parshape\@ne
\@totalleftmargin\linewidth
\fi
\vss
\noindent#1\par}%
\penalty10000%
\vskip-\baselineskip}%
\penalty10000}



\begin{document}

This is a demo of the \verb+\prefixtext+ command by Achim Blumensath.

\begin{align*}
f(x) &= g(x) + h(x) \\
\prefixtext{where} g(x) &= ax + b\\
\prefixtext{and} h(x) &= \sin x.
\end{align*}

\end{document}



----

-- Luc
Post by Lars Madsen
could you give an example of your use of achims code?
(maybe it was something I could include in my LaTeX book)
Lars Madsen
2006-04-27 19:43:16 UTC
Permalink
hmm, might be handy, but somehow I don't quite like equations looking like that

but then again that might just be me...
--
/daleif (remove RTFSIGNATURE from email address)

LaTeX FAQ: http://www.tex.ac.uk/faq
Superb Class: http://www.ctan.org/tex-archive/help/Catalogue/entries/memoir.html
LaTeX book: http://www.imf.au.dk/system/latex/bog/ (in Danish)
Remember to post minimal working examples.
Loading...