3

I tried this code and it created a large space like this

\begin{align}
&C^\text {UL} &= \log_2\left|{\bf I}_M + \frac{\rho_\text{ul}}{K}{\bf H}{\bf H}^\dagger\right|\\
%\end{align}
%\begin{align}
&C^\text {DL} &= \log_2\left|{\bf I}_K + \frac{\rho_\text{dl}}{M}{\bf H}{\bf H}^\dagger\right| \nonumber \\
&&= \log_2\left|{\bf I}_M + \frac{\rho_\text{dl}}{M}{\bf H}{\bf H}^\dagger\right|  
\end{align}

enter image description here

How can I fix this?

2
  • 1
    Welcome to TeX.SX!. Please provide a full MWE.
    – Steradiant
    Jun 4, 2020 at 15:41
  • 2
    Rather use \mathbf{H} than {\bf H}.
    – Werner
    Jun 4, 2020 at 15:48

3 Answers 3

6

Delete the & in front of the lines

\documentclass{article}
\usepackage{amsmath}

\begin{document}
\begin{align}
C^\text {UL} &= \log_2\left|{\mathbf I}_M + \frac{\rho_\text{ul}}{K}{\mathbf H}{\mathbf H}^\dagger\right|\\
C^\text {DL} &= \log_2\left|{\mathbf I}_K + \frac{\rho_\text{dl}}{M}{\mathbf H}{\mathbf H}^\dagger\right| \nonumber \\
&= \log_2\left|{\mathbf I}_M + \frac{\rho_\text{dl}}{M}{\mathbf H}{\mathbf H}^\dagger\right|  
\end{align}
\end{document}

enter image description here

6
  • That works! Thank you very much
    – hidaimrd
    Jun 4, 2020 at 15:47
  • 1
    note \bf is not defined by default in LaTeX, use \mathbf{I} Jun 4, 2020 at 15:48
  • Thank you, I will fix that. I'm a beginner :))
    – hidaimrd
    Jun 4, 2020 at 15:53
  • If you like my answer I'd be happy if you accept it :)
    – Steradiant
    Jun 4, 2020 at 15:57
  • 1
    Please, fix \bf.
    – egreg
    Jun 4, 2020 at 20:02
5

In addition to (a) removing the detrimental & symbols at the start of each line and (b) replacing {\bf ...} with \mathbf{...}, you may also want to (c) employ \mathrm instead of \text -- just in case this equation ever occurs inside a theorem-like environment -- and (d) reduce the heights of the absolute-value fences. For the final objective, I suggest you define an "absolute value" macro with the help of the \DeclarePairedDelimiter macro of the mathtools package.

enter image description here

\documentclass{article}
\usepackage{mathtools} % for '\DeclarePairedDelimiter' macro
\DeclarePairedDelimiter\abs\lvert\rvert 
\begin{document}
\begin{align}
C^\mathrm{UL} &= \log_2\abs[\big]{\mathbf{I}_M 
                 + \frac{\rho_{\mathrm{ul}}}{K} \mathbf{H}\mathbf{H}^\dagger} \\
C^\mathrm{DL} &= \log_2\abs[\big]{\mathbf{I}_K 
                 + \frac{\rho_{\mathrm{dl}}}{M} \mathbf{H}\mathbf{H}^\dagger} \nonumber \\
              &= \log_2\abs[\big]{\mathbf{I}_M 
                 + \frac{\rho_{\mathrm{dl}}}{M} \mathbf{H}\mathbf{H}^\dagger}  
\end{align}
\end{document}
1
  • That helps me a lot. Thank you
    – hidaimrd
    Jun 4, 2020 at 16:18
2

Rather than align, use the alignat environment. The alignat environment will need an additional argument for the maximum number of left-right column-pairs you want to use, but giving a far larger number is not wrong.

\begin{alignat}{2}
    &C^\text {UL} &= \log_2\left|{\bf I}_M + \frac{\rho_\text{ul}}{K}{\bf H}{\bf H}^\dagger\right|\\
    &C^\text {DL} &= \log_2\left|{\bf I}_K + \frac{\rho_\text{dl}}{M}{\bf H}{\bf H}^\dagger\right| \nonumber \\
    &&= \log_2\left|{\bf I}_M + \frac{\rho_\text{dl}}{M}{\bf H}{\bf H}^\dagger\right|  
\end{alignat}

rendered with alignat The difference to me is that align wants to make equal spacing between each column-pair, whereas alignat will move them as close together as the alignment will allow, then center the whole thing.

Be sure where you place the alignment markers as the left-right aligned nature of the columns will otherwise mess up your output.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .