Add tags
LaTeX specific issues not fitting into one of the other forums of this category.
by fenghedo on Sat Oct 4th, 2008
Hi all, I know one could use align in the following manner to align equations  Code: Select all • Open in online LaTeX editor
\begin{align*} A&=B\\ &=C \end{align*}
But I have a long equation and I want to save some space by doing the following  Code: Select all • Open in online LaTeX editor
\begin{align*} &A\\ &=B\\ &=C \end{align*}
But the whole equation just got pushed way right and left a big blank space on the left. Is there any way I could tell LaTeX to align the whole thing left? Thanks.

fenghedo

 Posts: 19
 Joined: Sat Oct 4th, 2008
by localghost on Sat Oct 4th, 2008
I'm not sure whether I understand you right. You could set the fleqn (force left equation) option for the document class.
Best regards and welcome to the board Thorsten¹

localghost
 Site Moderator

 Posts: 9218
 Joined: Fri Feb 2nd, 2007
 Location: Braunschweig, Germany
by fenghedo on Sat Oct 4th, 2008
Thanks localghost. I did that and now it aligns to the left. However, LaTeX still leaves a margin of about 4 spaces to the left of the whole equation (I guess this is supposed to make it look nicer in the surrounding text environment). Please see the attached image.
Is there any way I could remove this shift?
Thanks.
 Attachments

 left_alignment.JPG (13.85 KiB) Viewed 15413 times

fenghedo

 Posts: 19
 Joined: Sat Oct 4th, 2008
by localghost on Sat Oct 4th, 2008
Giving help would be easier if you provided the code of this excerpt shown in the screenshot.

localghost
 Site Moderator

 Posts: 9218
 Joined: Fri Feb 2nd, 2007
 Location: Braunschweig, Germany
by fenghedo on Sat Oct 4th, 2008
localghost wrote:Giving help would be easier if you provided the code of this excerpt shown in the screenshot.
 Code: Select all • Open in online LaTeX editor
Then equation something can be written as \begin{align} &E_{ic} = \frac{1}{N}\sum\limits_{z_k\in V} \left[ \norm{m_f(z_k;\mu_f) + m_b(z_k+m_f(z_k;\mu_f);\mu_b)}^2 \right.\notag\\ &\quad \left. +\norm{m_b(z_k;\mu_b) + m_f(z_k+m_b(z_k;\mu_b); \mu_f)}^2 \right] \notag\\ & = \frac{1}{N}\sum\limits_{z_k\in V} \left[ \norm{\begin{bmatrix} m_{fx}(z_k;\mu_{fx}) + m_{bx}(z_k+m_f(z_k;\mu_{f});\mu_{bx})\\ m_{fy}(z_k;\mu_{fy}) + m_{by}(z_k+m_f(z_k;\mu_{f});\mu_{by}) \end{bmatrix}}^2 \right.\notag\\ &\quad \left. +\norm{\begin{bmatrix} m_{bx}(z_k;\mu_{bx}) + m_{fx}(z_k+m_b(z_k;\mu_{b}); \mu_{fx})\\ m_{by}(z_k;\mu_{by}) + m_{fy}(z_k+m_b(z_k;\mu_{b}); \mu_{fy}) \end{bmatrix}}^2 \right] \notag\\ \end{align}
I've seen people put full width equations in double column layouts. Do you know how to do that? Thanks. I really appreciate the help.

fenghedo

 Posts: 19
 Joined: Sat Oct 4th, 2008
by Stefan_K on Sat Oct 4th, 2008
Hi fenghedo, fenghedo wrote:However, LaTeX still leaves a margin of about 4 spaces to the left of the whole equation. Is there any way I could remove this shift?
Just set \mathindent to 0pt:  Code: Select all • Open in online LaTeX editor
\setlength{\mathindent}{0pt}
Btw. in the first line of the formula above you probably want to write  Code: Select all • Open in online LaTeX editor
E_{ic} &= \frac{1}{N} ...
look at the position of the &. Stefan
LaTeX Community Administrator

Stefan_K
 Site Admin

 Posts: 7440
 Joined: Mon Mar 10th, 2008
 Location: Hamburg, Germany

by localghost on Sat Oct 4th, 2008
Another way of aligning could be the following.  Code: Select all • Open in online LaTeX editor
\begin{align*} E_{ic}= \begin{split} & \frac{1}{N}\sum\limits_{z_k\in V} \left[\norm{m_f(z_k;\mu_f) + m_b(z_k+m_f(z_k;\mu_f);\mu_b)}^2 \right. \\ & \left. +\norm{m_b(z_k;\mu_b) + m_f(z_k+m_b(z_k;\mu_b); \mu_f)}^2 \right] \end{split}\\ = \begin{split} & \frac{1}{N}\sum\limits_{z_k\in V} \left[ \norm{\begin{bmatrix} m_{fx}(z_k;\mu_{fx}) + m_{bx}(z_k+m_f(z_k;\mu_{f});\mu_{bx})\\ m_{fy}(z_k;\mu_{fy}) + m_{by}(z_k+m_f(z_k;\mu_{f});\mu_{by}) \end{bmatrix}}^2 \right. \\ & \left. +\norm{\begin{bmatrix} m_{bx}(z_k;\mu_{bx}) + m_{fx}(z_k+m_b(z_k;\mu_{b}); \mu_{fx})\\ m_{by}(z_k;\mu_{by}) + m_{fy}(z_k+m_b(z_k;\mu_{b}); \mu_{fy}) \end{bmatrix}}^2 \right] \end{split} \end{align*}

localghost
 Site Moderator

 Posts: 9218
 Joined: Fri Feb 2nd, 2007
 Location: Braunschweig, Germany
by Juanjo on Sun Oct 5th, 2008
I assume that you have defined \norm more or less by \newcommand{\norm}[1]{\left\Vert#1\right\Vert}. The solution proposed by localghost works if you replace \begin{split} by \begin{aligned}[t], and \end{split} by \end{aligned}. Anyway, I would remark the following facts:  The equation number usually is vertically centered, which is not the case in your code. This can be simply achieved by replacing align by a combination of equation and split.
 You break lines which contain brackets in such a way that the opening bracket falls in one line and the closing one, in the second line. If you use \left  \right to fix the size of brackets, it may happen that the opening and closing brackets have different sizes, depending on the mathematical surrounding expressions. I find better to manually fix sizes.
 Since breaks happens inside a bracketed expression, the alignment point should on the left of the opening bracket.
Taking these points into account, I would propose the following code:  Code: Select all • Open in online LaTeX editor
\begin{equation} \begin{split} E_{ic}&=\! \begin{aligned}[t] \frac{1}{N}\sum_{z_k\in V} \Bigl[&\norm{m_f(z_k;\mu_f) + m_b(z_k+m_f(z_k;\mu_f);\mu_b)}^2 \Bigr. \\ \Bigl. & +\norm{m_b(z_k;\mu_b) + m_f(z_k+m_b(z_k;\mu_b); \mu_f)}^2 \Bigr] \end{aligned}\\ &=\! \begin{aligned}[t] \frac{1}{N}\sum_{z_k\in V} \Biggl[ &\norm{\begin{bmatrix} m_{fx}(z_k;\mu_{fx}) + m_{bx}(z_k+m_f(z_k;\mu_{f});\mu_{bx})\\ m_{fy}(z_k;\mu_{fy}) + m_{by}(z_k+m_f(z_k;\mu_{f});\mu_{by}) \end{bmatrix}}^2 \Biggr. \\ \Biggl. & +\norm{\begin{bmatrix} m_{bx}(z_k;\mu_{bx}) + m_{fx}(z_k+m_b(z_k;\mu_{b}); \mu_{fx})\\ m_{by}(z_k;\mu_{by}) + m_{fy}(z_k+m_b(z_k;\mu_{b}); \mu_{fy}) \end{bmatrix}}^2 \Biggr]. \end{aligned} \end{split} \end{equation}
I have also added a point at the end. Mathematical expressions should be punctuated with commas and points, as done with ordinary text.

Juanjo

 Posts: 656
 Joined: Sat Jan 27th, 2007
Return to General
Users browsing this forum: No registered users and 16 guests
