8

I run into the following little problem in the LaTeX math mode:

$ \left \|\tilde{a}  \right \| + \left \| \tilde{b} \right \| $

when trying this in the Latex Equation Editor, it looks a bit weird: the norm around b is much bigger than the norm around a. Without the \tilde over b it acts normal. Is there a way to solve this easily or do i have to change letters? Or is there a smaller way to write \tilde{b} ?

  • Do you prefer $ \left \|\tilde{a} \right \| + \left \| \vcenter{\hbox{$\tilde{b}$}} \right \| $ ? – John Kormylo Jun 11 '15 at 1:16
  • A smaller way to write \left \| \tilde{b} \right \| is \left \| \smash{\tilde{b}} \right \|. – corporal Jun 11 '15 at 1:22
  • See also tex.stackexchange.com/q/102157/15925 – Andrew Swann Jun 11 '15 at 11:40
11

Instead of using \left\|...\right\| which are extensible characters (meaning they grow vertically with the content height), use fixed height versions. You can call on larger versions with \big, \Big, \bigg, and \Bigg.

\documentclass{article}
\begin{document} 
$ \big \|\tilde{a}  \big \| + \big \| \tilde{b} \big \| $
\quad
$ \Big \|\tilde{a}  \Big \| + \Big \| \tilde{b} \Big \| $
\quad
$ \bigg \|\tilde{a}  \bigg \| + \bigg \| \tilde{b} \bigg \| $
\quad
$ \Bigg \|\tilde{a}  \Bigg \| + \Bigg \| \tilde{b} \Bigg \| $
\end{document}

enter image description here

Often, you will see the syntax employed of \bigl\| ... \bigr\| where the extra "l" and "r" indicate "left" and "right". While I originally was unsure if they actually affected the typesetting (or if they were purely a mnemonic to help the programmer keep track of matched delimiter sets), Gustavo and Mico (hat tip) assured me that their inclusion can affect the typesetting itself. Mico was kind enough to provide an example, which I recreate here. I commend his comment below to your attention:

\documentclass{article}
\begin{document} 
$ \big \|+\tilde{a}  \big \|  $
\quad versus \quad
$ \bigl \|+\tilde{a}  \bigr \| $
\quad
\end{document}

enter image description here

  • 5
    \bigl versus \big does affect the typesetting! But best of all it is to use mathtools, as @Mico shows. – GuM Jun 11 '15 at 1:34
  • 4
    One case where using \bigl<something> instead of just \big<something makes a big difference is when the subsequent material starts with a unary - or + symbol: If you use \bigl, the "fence" is given TeX type "mathopen" and the unary symbols will be typeset correctly. In contrast, if you use just \big, TeX will treat the - and + symbols as binary rather than as unary operators, with incorrect spacing, etc. – Mico Jun 11 '15 at 12:03
  • 1
    Please accept my apologies for not having dwelt on explanations: I typed my comment at four in the morning, while I was suffering from insomnia. – GuM Jun 11 '15 at 12:19
  • 1
    @GustavoMezzetti No apologies are necessary. I read your comment late at night and was too tired to explore further at that point. – Steven B. Segletes Jun 11 '15 at 12:22
  • 1
    +1 for picking up on my comment about \bigl vs "just" \big making a big difference if the first symbol after the "fence symbol" needs to be typeset as a unary operator. For an earlier posting on this subject see, e.g., Why use the control sequences \bigl, \biggl, \bigr or \biggr, as I can always use \big or \bigg? For a more in-depth discussion of how TeX determines the math-mode spacing around various symbols, see this answer by (who else?!) @egreg. – Mico Jun 11 '15 at 18:31
13

Typographically speaking, it's neither necessary nor advisable to auto-size the norm bars placed around various variable names. Using the default size of the double-vertical bars for a, b, and \tilde{b} should be fine.

Instead of using the low-level directives \lVert and \rVert directly in a formula, it's preferable to declare a high-level macro named, say, \norm in the preamble and to use it in formulas. That way, the code immediately becomes more readable (and easier to debug, if necessary).

enter image description here

\documentclass{article}
\usepackage{mathtools} % for "\DeclarePairedDelimiter" macro
\DeclarePairedDelimiter{\norm}{\lVert}{\rVert}
\begin{document}
$\norm{\tilde{a}} + \norm{\tilde{b}}$  \quad default size

\medskip
$\norm[\big]{\tilde{a}} + \norm[\big]{\tilde{b}}$ \quad\verb+\big+ size

\medskip
$ \left \|\tilde{a}  \right \| + \left \| \tilde{b} \right \| $ \quad \verb+\left ... \right+ method: much too large!
\end{document} 
  • 1
    Plus, “\left … \right constructions are treated as ‘inner’ subformulas, which means that they will be surrounded by additional space in certain circumstances” (The TeXbook, bottom of p. 155). – GuM Jun 11 '15 at 1:48
  • 2
    @GustavoMezzetti not when you use the \norm*, mathtools will fix that additional space. Internally \norm[\big] is also converted into the \bigl and \bigr versions. – daleif Jun 11 '15 at 7:11
  • @daleif: Yes, I know: I made my remark because Mico’s code mentions a \left … \right construction, probably with the intention of comparing the right way of doing things with the wrong one. Indeed, I said in another comment that mathtools and its \DeclarePairedDelimiter command is the solution to this type of problems. – GuM Jun 11 '15 at 10:26
6

For a simple code, we can use mathtools and etoolbox, to define a \norm command, which has a star version (automatically adapted to the size of its argument) and a nostar version which accepts an optional argument: \big, \Big, \bigg, \Bigg, if you want to fine-tune the size of the vertical rules. The DeclarePairedDelimiterX, w.r.t. DeclarePeiredDelimiter has an argument which allows to insert a macro between the delimiters – here, it inserts a dot if \norm has an empty argument:

\documentclass{article}
\usepackage{mathtools, etoolbox}
\DeclarePairedDelimiterX\norm[1]\lVert\rVert{\ifblank{#1}{\:\cdot\:}{#1}}

\begin{document}

\begin{alignat*}{3}
   & \norm{\tilde{a}} + \norm{\tilde{b}} &\qquad & \norm*{\tilde{a}} + \norm*{\tilde{b}} &\qquad & \norm[\big]{\tilde{a}} + \norm[\big]{\tilde{b}}\\
 & \norm*{\frac{\tilde{b}}{\tilde{a}}} & \qquad & \norm[\bigg]{\frac{\tilde{b}}{\tilde{a}}}& \qquad & \norm{}
\end{alignat*}

\end{document} 

enter image description here

  • 1
    I cannot see \norm{} in your code, yet I see in the picture the output that (if I understand well) it is supposed to produce. – GuM Jun 11 '15 at 2:03
  • Oops! Sorry, I hadn't included it first, then thought it would demonstrate a little more, added the result, but forgot to update the code! Corrected now. – Bernard Jun 11 '15 at 7:50
  • You may want to mention which benefits (if any) \DeclarePairedDelimiterX enjoys over \DeclarePairedDelimiter. This might help, at the margin, inform readers as to which variant of the macro they should choose for their own documents. – Mico Jun 11 '15 at 11:39
  • @Mico: You're right. You were posting your answer while I finished to write mine, and was tempted to delete it, as they're very close. Finally I decided to leave it due to this difference,, but the least I could do was to explain it. Thanks for pointing it. – Bernard Jun 11 '15 at 12:02
2

Fixed-size large delimiters as in the other answers are one option, but another way to ensure delimiters have the same size in such situations is to use \phantom and friends:

$ \left\| \vphantom{\tilde b} \tilde a \right\| + \left\| \tilde b \right\| $
  • Given that the double-vertical bars are too tall anyway, typographically speaking, when they surround just \tilde{b}, why would you want more of the too-tall bars? – Mico Jun 11 '15 at 12:53
  • In this specific case, shorter bars may look better. However, this solution is applicable generally to situations where delimiters with uneven sizes break some sort of a symmetry in a formula, and in most cases it’s desirable to keep the larger size for both. – Emil Jeřábek Jun 11 '15 at 13:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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