tags:

views:

56

answers:

4

In the following LaTeX fragment, how can I suppress the newline that is automatically generated between XXX and YYY after entering the align* environment.

XXX
\begin{minipage}{t}{0.1in}
  YYY
  \begin{align*}
     ZZZ...
  \end{align*}
\end{minipage}

yields

XXX YYY
ZZZ...

But I want

XXX YYY ZZZ...

Perhaps align* is simply the wrong environment, but I couldn't find an alternative that provides similar functionality, yet doesn't introduce a linebreak.

A: 

For single-line, in-line equations, you can use the $ math environment delimiter:

XXX
\begin{minipage}{t}{0.1in}
    YYY $ZZZ...$
\end{minipage}
ezod
A: 
Alok
Apologies for being a little too short with my example, but what you describe comes in handy as well.
Matthias Vallentin
No problem. For typesetting math, I recommend Mathmode by Hervert Voss a lot.
Alok
+1  A: 

I'm not really sure if it's supposed to be used like this, but perhaps the aligned environment is what you're after?

\documentclass{article}
\usepackage{amsmath}
\begin{document}
XXX
\begin{minipage}[t]{1in}
YYY
$
  \begin{aligned}
     ZZZ...
  \end{aligned}
$
\end{minipage}
\end{document}
Will Robertson
Perfect, that's exactly what I needed. I did not know that the aligned environment existed.
Matthias Vallentin
A: 

The reason Latex forces a linebreak when entering the minipage environment is that you move from entering text in horizontal mode, to introducing a new paragraph-like environment, minipage. You can stop this linebreak by using \vbox{...}, so:

XXX
\vbox{
\begin{minipage}[t]{2in} % Note that the first parameter is optional
  YYY
  ...
\end{minipage}
}

\vbox won't stop the align environment's linebreak, though, because that is explicitly made by with the environment's Tex code: for that use Will's suggestion of using aligned.

Charles Stewart