TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

in the MWE below, the norm symbol appears in different sizes in the denominator like this:

enter image description here

I would like the \norm lines to be the same length in the denominator. Thanks for your help.

Here is the code that I have:

\documentclass{book}
\usepackage{amsmath,amsfonts,amssymb,amsthm}
\usepackage{mathtools}
\usepackage{commath}
\usepackage[sc,osf]{mathpazo}

\begin{document}

\begin{equation*}
  \mu(\mathbf{A}) = \max_{1\leqslant i,j\leqslant n, i\neq j}\dfrac{|\mathbf{A'}_{:,i}\mathbf{A}_{:,j}|}{\norm{\mathbf{A}_{:,i}}\norm{\mathbf{A}_{:,j}}}
\end{equation*}

\end{document}
share|improve this question
    
Let me guess it is autoscalling, as you can see not a good idea. It is probably the j that is causing it. I'd use mathtools to construct a better norm, it is on the manual. – daleif Mar 4 at 8:26
2  
The answer is very simple: don't use commath; look at tex.stackexchange.com/search?q=commath+user%3A4427 to see why. – egreg Mar 4 at 9:08
    
It's a case for \strut or \smash or simply specifying the size explicitly with \bigg and the like. No need for package bloat. – The Vee Mar 4 at 13:21
up vote 6 down vote accepted

This is because the subscripts i and j have different depths and you are using automatic scaling.

There are two easy ways to fix this, since you are already using the mathtools and commath packages:

Solution with mathtools (preferred solution)

Make the \norm symbols the same size by using \DeclarePairedDelimiter from mathtools to declare \norm, and give a size as an optional argument as \norm[\big]{...}. Since you are using the commath package, which itself defines \norm, you can "save" and "undefine" the old definition of \norm before (re)declaring it using mathtools. You should also place the prime outside of \mathbf{...}, otherwise the subscript is placed too far right.

\documentclass{book}
\usepackage{amsmath,amsfonts,amssymb,amsthm}
\usepackage{mathtools}
\usepackage{commath}
\usepackage[sc,osf]{mathpazo}

\let\oldnorm\norm   % <-- Store original \norm as \oldnorm
\let\norm\undefined % <-- "Undefine" \norm
\DeclarePairedDelimiter\norm{\lVert}{\rVert}

\begin{document}

\begin{equation*}
  \mu(\mathbf{A}) = \max_{1\leqslant i,j\leqslant n, i\neq j}\dfrac{|\mathbf{A}'_{:,i}\mathbf{A}_{:,j}|}{\norm[\big]{\mathbf{A}_{:,i}}\norm[\big]{\mathbf{A}_{:,j}}}
\end{equation*}

\end{document}

Output with mathtools

or without optional argument (most correct size in my opinion), i.e. with {\norm{\mathbf{A}_{:,i}}\norm{\mathbf{A}_{:,j}}:

Best output

Solution with commath

The \norm command from the commath also takes an optional argument, ranging from 0 to 4 where 0 is the smallest size and 4 the biggest. Notice how the spacing before the first \norm is wrong – you will have to manually adjust this with e.g. \; to get a pleasing result.

\documentclass{book}
\usepackage{amsmath,amsfonts,amssymb,amsthm}
\usepackage{mathtools}
\usepackage{commath}
\usepackage[sc,osf]{mathpazo}

\begin{document}

\begin{equation*}
  \mu(\mathbf{A}) = \max_{1\leqslant i,j\leqslant n, i\neq j}\dfrac{|\mathbf{A}'_{:,i}\mathbf{A}_{:,j}|}{\norm[1]{\mathbf{A}_{:,i}}\norm[1]{\mathbf{A}_{:,j}}}
\end{equation*}

\end{document}

Output with commath


You should consider using \abs instead of |...| as well. Same approach as above with mathtools:

\let\oldabs\abs % Store original \abs as \oldabs
\let\abs\undefined % "Undefine" \abs
\DeclarePairedDelimiter\abs{\lvert}{\rvert}

and then use \abs*{...} to get automatic sizing, or with optional argument to manually size \abs[\big]{...}.

For commath the approach is also the same as above: \abs[1]{...}.


As you can see, the spacing before the first \norm in the denominator with commath (last image) is wrong, so personally I'd recommend using the mathtools approach, as that gives the correct spacing.

share|improve this answer

A prime example why \left and \right should not be used without checking. I can't recommend using commath macros for several reasons, see http://tex.stackexchange.com/search?q=commath+user%3A4427 for some of them.

The problem of using \left and \right shows here in full clarity: the descender in j is the cause of the sudden growth of the delimiters' size.

Let's simplify the situation. Look at the following code

\documentclass{article}
\usepackage[osf,sc]{mathpazo}
\usepackage{amsmath}

\begin{document}

\begin{gather}
\left\|\mathbf{A}_{i}\right\|\ne
\left\|\mathbf{A}'_{i}\right\|\ne
\left\|\mathbf{A}_{j}\right\|\ne
\left\|\mathbf{A}'_{j}\right\|
\\
\left\|\mathbf{A}_{i}\right\|+\left\|\mathbf{A}_{j}\right\|
\\
\lVert\mathbf{A}_{i}\rVert+\lVert\mathbf{A}_{j}\rVert
\\
\left\|\mathbf{A}'_{i}\right\|+\left\|\mathbf{A}'_{j}\right\|
\\
\lVert\mathbf{A}'_{i}\rVert+\lVert\mathbf{A}'_{j}\rVert
\end{gather}

\end{document}

and the output

enter image description here

Using \left\| and \right\| is basically the same as using \norm from commath.

You can notice that there are three delimiter sizes in line 1, two in lines 2 and 4. In particular, when \mathbf{A}'_{j} is used, the size is definitely too big.

It's clear to me that the “right” output is that in lines 3 and 5, with no size increase.

If you use mathtools, you can define a correct \norm macro and do manual adjustment only when necessary, which is not the case of your formula. I also suggest \substack for the long subscript.

\documentclass{article}
\usepackage[osf,sc]{mathpazo}
\usepackage{amsmath,mathtools,amssymb}

\DeclarePairedDelimiter{\norm}{\lVert}{\rVert}

\begin{document}

\begin{equation*}
\mu(\mathbf{A}) =
\max_{1\leqslant i,j\leqslant n, i\neq j}
  \dfrac{|\mathbf{A'}_{:,i}\mathbf{A}_{:,j}|}
        {\norm{\mathbf{A}_{:,i}}\norm{\mathbf{A}_{:,j}}}
\end{equation*}

\begin{equation*}
\mu(\mathbf{A}) =
\max_{\substack{1\leqslant i,j\leqslant n \\ i\neq j}}
  \dfrac{|\mathbf{A'}_{:,i}\mathbf{A}_{:,j}|}
        {\norm{\mathbf{A}_{:,i}}\norm{\mathbf{A}_{:,j}}}
\end{equation*}

\end{document}

enter image description here

share|improve this answer

The size of the first \norm command doesn't correspond to any of the predefined sizes which can be used as an optional argument. So the only solution I can imagine is to \smash j:

\documentclass{book}
\usepackage{amsmath,amsfonts,amssymb,amsthm}
\usepackage{mathtools}
\usepackage{commath}
\usepackage[sc,osf]{mathpazo}

\begin{document}

\begin{equation*}
  \mu(\mathbf{A}) = \max_{1\leqslant i,j\leqslant n, i\neq j}\dfrac{|\mathbf{A'}_{:,i}\mathbf{A}_{:,j}|}{\norm{\mathbf{A}_{:,i}}\norm{\mathbf{A}_{:,\smash[b]{j}}}}
\end{equation*}

\end{document} 

enter image description here

share|improve this answer

You could insert a strut into the first norm's index to make it taller:

\norm{\mathbf{A}_{:,i\mathstrut}}

A strut is a zero-width “letter” that extends as low and as high as any other letter. This forces the norm sign to be larger.

equation with equal-sized bars

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.