mavam
mavam

Reputation: 12552

Suppressing linebreak when entering environment

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.

Upvotes: 6

Views: 4695

Answers (4)

Charles Stewart
Charles Stewart

Reputation: 11837

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.

Upvotes: 1

Will Robertson
Will Robertson

Reputation: 64530

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}

Upvotes: 3

Alok Singhal
Alok Singhal

Reputation: 96121

It's hard to know exactly what you want—why are you using align? What is it that needs aligning?

Maybe you're looking for tabbing in Latex?

\begin{tabbing}
text \= more text \= still more text \= last text \\
second row \>  \> more \\
.
.
.
\end{tabbing}

Upvotes: 0

ezod
ezod

Reputation: 7411

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

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

Upvotes: 0

Related Questions