3

When using more than one mathematical accent on top of a symbol inside \left[ \right], the symbol appears in the vertical centre of the brackets, leaving an empty space in the lower part of the symbol. Here is a MWE

\documentclass{article}
\usepackage{bm}

\newcommand{\sub}[1]{{\scriptscriptstyle\mathrm{#1}}} %Small Math Sub
\newcommand{\Cov}[1]{\mathrm{Cov}\left[#1\right]}

\begin{document}
$\left[\vec{\bm{s}}_\sub{n}\right]$

$\left[\hat{\vec{\bm{s}}}_\sub{n}\right]$

$\Cov{\vec{\bm{s}}_\sub{n}}$

$\Cov{\hat{\vec{\bm{s}}}_\sub{n}}$

$\Cov{\tilde{\bm{A}}_\sub{L_\sub{n}}}$
\end{document}

This extra space is a problem e.g. when inserting a math expression inline with text.

How can one remove the vertical empty space under the symbol so that the lower end of the brackets are aligned with it?

2 Answers 2

2

You can use \vcenter

\documentclass{article}
\usepackage{amsmath,bm}

\newcommand{\sub}[1]{{\scriptscriptstyle\mathrm{#1}}} %Small Math Sub

\begin{document}
$\left[\vec{\bm{s}}_\sub{n}\right]$

$\left[\vcenter{\hbox{$\hat{\vec{\bm{s}}}_\sub{n}$}}\right]$

$\bigl[\vcenter{\hbox{$\hat{\vec{\bm{s}}}_\sub{n}$}}\bigr]$
\end{document}

enter image description here

Or

\documentclass{article}
\usepackage{mathtools,bm}

\newcommand{\sub}[1]{{\scriptscriptstyle\mathrm{#1}}} %Small Math Sub
\DeclarePairedDelimiterX\mybracket[1]{[}{]}{\vcenter{\hbox{$#1$}}}

\begin{document}
$\mybracket{\vec{\bm{s}}_\sub{n}}$

$\mybracket{\hat{\vec{\bm{s}}}_\sub{n}}$

$\mybracket{\hat{\vec{\bm{s}}}_\sub{n}}$

$\mybracket[\big]{\hat{\vec{\bm{s}}}_\sub{n}}$   %% optional argument can be size

$\mybracket*{\hat{\vec{\bm{s}}}_\sub{n}}$    %% starred version uses `\left and \right
\end{document}
2
  • 1
    Put the symbols next to each other and you'll see that the “s” doesn't sit on the baseline any more.
    – egreg
    Nov 1, 2015 at 14:36
  • @egreg I agree. This was a solution in a hurry.
    – user11232
    Nov 2, 2015 at 5:17
2

There's no need that fences cover entirely the symbols between them. Don't use \left and \right unless really necessary and in this case they aren't.

\documentclass{article}
\usepackage{amsmath,bm}

\newcommand{\sub}[1]{{\scriptscriptstyle\mathrm{#1}}} %Small Math Sub

\begin{document}
$[\vec{\bm{s}}_\sub{n}]$
$[\,\hat{\!\vec{\bm{s}}}_\sub{n}]$
$\bigl[\,\hat{\!\vec{\bm{s}}}_\sub{n}\bigr]$
\end{document}

Note the usage of amsmath that improves a bit the placement of the hat, which however needs some more help.

enter image description here

2
  • The particular MWE does not need \left and \right, but is a simplification of a more complex problem. In reality I define new commands like \newcommand{\Cov}[1]{\mathrm{Cov}\left[#1\right]} which I use in many places with different arguments. Thus I need that the size of the brackets is "adaptive" (see the edited MWE)
    – user24528
    Nov 1, 2015 at 21:17
  • 1
    @user24528 I can't see where \Cov needs \left and \right in those examples. Look for \DeclarePairedDelimiter in the manual of mathtools for better “adaptive” fence macros.
    – egreg
    Nov 1, 2015 at 21:22

You must log in to answer this question.

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