Math & Sciencea misplaced "="

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
NELLLY
Posts: 113
Joined: Thu Nov 26, 2009 2:21 am

a misplaced "="

Post by NELLLY »

Hi
When I write

Code: Select all

\begin{align*}
\mu^{(0)}=\bordermatrix{&\textit{\small{1}}&\textit{\small{2}}&\textit{\small{3}}&\textit{\small{4}}&\textit{\small{5}}&\textit{\small{6}}\cr
&0&1&0&0&0&0\cr}
\end{align*}
\begin{align*}
\mu^{(1)}&=\mu^{(0)}*P_0^{(1)},\\
\mu^{(1)}&=\bordermatrix{&\textit{\small{1}}&\textit{\small{2}}&\textit{\small{3}}&\textit{\small{4}}&\textit{\small{5}}&\textit{\small{6}}\cr
&a&B&1-a-B&0&0&0\cr}.
\end{align*}
The sign "=" for the second group of formulas is far from "=" of the first formula. What can I do to make them at the same level.
Thanks

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX books
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

a misplaced "="

Post by localghost »

Just merge two align* environments to one.

Code: Select all

\begin{align*}
  \mu^{(0)} &=
  \bordermatrix{
    & \textit{\small{1}} & \textit{\small{2}} & \textit{\small{3}} &\textit{\small{4}} & \textit{\small{5}} & \textit{\small{6}}\cr
    & 0 & 1 & 0 & 0 & 0 & 0 \cr
  }\\
  \mu^{(1)} &= \mu^{(0)}*P_0^{(1)},\\
  \mu^{(1)} &=
  \bordermatrix{
    & \textit{\small{1}} & \textit{\small{2}} & \textit{\small{3}} & \textit{\small{4}} & \textit{\small{5}} & \textit{\small{6}}\cr
    & a & B & 1-a-B & 0 & 0 & 0\cr
  }.
\end{align*}

Best regards
Thorsten
NELLLY
Posts: 113
Joined: Thu Nov 26, 2009 2:21 am

Re: a misplaced "="

Post by NELLLY »

Hi
I can't do this because I have a text betwwen them.
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

a misplaced "="

Post by gmedina »

Hi,

for the text, you can use the \intertext command provided by amsmath:

Code: Select all

\documentclass{article}
\usepackage{amsmath}
  
\begin{document}

\begin{align*}
  \mu^{(0)} &=
  \bordermatrix{
    & \textit{\small{1}} & \textit{\small{2}} & \textit{\small{3}} &\textit{\small{4}} & \textit{\small{5}} & \textit{\small{6}}\cr
    & 0 & 1 & 0 & 0 & 0 & 0 \cr
  }
  \intertext{some text goes here.}
  \mu^{(1)} &= \mu^{(0)}*P_0^{(1)},\\
  \mu^{(1)} &=
  \bordermatrix{
    & \textit{\small{1}} & \textit{\small{2}} & \textit{\small{3}} & \textit{\small{4}} & \textit{\small{5}} & \textit{\small{6}}\cr
    & a & B & 1-a-B & 0 & 0 & 0\cr
  }.
\end{align*}
\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

a misplaced "="

Post by localghost »

NELLLY wrote:[...] I can't do this because I have a text betwwen them.
If so, then why didn't you provide the complete code right a t the beginning? How should we know what the final result is going to look like? That's what a minimal working example (MWE) is made for.
NELLLY
Posts: 113
Joined: Thu Nov 26, 2009 2:21 am

Re: a misplaced "="

Post by NELLLY »

Thanks this works well. However I have another question. How can I reduce the space between the text in the intertext, the last equation before the text, and the last equation after the text because the space is too large for me.
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

a misplaced "="

Post by gmedina »

You can use the optional argument of the \\ command:

Code: Select all

\documentclass{article}
\usepackage{amsmath}
  
\begin{document}

\begin{align*}
  \mu^{(0)} &=
  \bordermatrix{
    & \textit{\small{1}} & \textit{\small{2}} & \textit{\small{3}} &\textit{\small{4}} & \textit{\small{5}} & \textit{\small{6}}\cr
    & 0 & 1 & 0 & 0 & 0 & 0 \cr
  }\\[-4mm]
  \intertext{some text goes here.}\\[-10mm]
  \mu^{(1)} &= \mu^{(0)}*P_0^{(1)},\\
  \mu^{(1)} &=
  \bordermatrix{
    & \textit{\small{1}} & \textit{\small{2}} & \textit{\small{3}} & \textit{\small{4}} & \textit{\small{5}} & \textit{\small{6}}\cr
    & a & B & 1-a-B & 0 & 0 & 0\cr
  }.
\end{align*}
\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

a misplaced "="

Post by localghost »

NELLLY wrote:Thanks this works well. However I have another question. How can I reduce the space between the text in the intertext, the last equation before the text, and the last equation after the text because the space is too large for me.
Get used to giving concrete examples for a problem. Nobody is willing to participate in a quiz. You can also try the \shortintertext command provided by the mathtools package from the mh bundle.
Post Reply