Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I would like to achieve the following inside an math environment enter image description here

But i can't get the text below the equation

\operatorname{min} \left|
\overbrace{\text{Hadamard product}}^{\begin{pmatrix}
X \circ X \end{pmatrix}} - \begin{pmatrix} 1 & 2 & 3 & \dots & M \end{pmatrix}
\right|^2

results in: enter image description here

share|improve this question
1  
Use \underbrace –  azetina Jan 29 '13 at 19:43
1  
In this special case I personally like the overbrace more and underbrace does not solve the problem, the brackets get to big –  tripplet Jan 29 '13 at 19:51

2 Answers 2

up vote 2 down vote accepted

Here's a way that doesn't need box measurements. I define a command \setbelow with one optional and two mandatory arguments. With the optional argument, the stuff below can be lowered more if needed. The result is essentially the same as in Werner's answer:

output

For a more flexible solution that also works with \left and \right see this answer of mine.

\documentclass{article}
\usepackage{mathtools}
\newcommand*\setbelow[3][0ex]{%
  \mathop{#2\rule[-#1]{0pt}{0pt}}_{\mathclap{#3}}%
  }
\begin{document}
\[
  \min \bigl|
  \bigl( X \mathbin{\setbelow[0.2ex]{\circ}
                    {\overbrace{\scriptstyle\text{Hadamard product}}}} X \bigr)
  - \begin{pmatrix} 1 & 2 & 3 & \dots & M \end{pmatrix}
  \bigr|^2
\]
\end{document}

Note that you can simply write \min instead of \operatorname{min}!

share|improve this answer
    
I accepted your answer, because I specially like that everything is warped in a single command –  tripplet Jan 30 '13 at 14:57

abraces can be used for this - swapping/mixing ofthe brace directions:

enter image description here

\documentclass{article}
\usepackage{abraces,mathtools}% http://ctan.org/pkg/{abraces,mathtools}
\begin{document}
\[
  \setbox9=\hbox{$(X \circ X)$}
  \operatorname{min} \big| 
    \mathrlap{\hspace{.5\wd9}\mathclap{\aunderbrace[L1U1R]{\scriptstyle\phantom{\text{Hadamard product}}}_{\text{Hadamard product}}}}
    (X \circ X) - (1 \ 2 \ 3 \ \cdots \ M )\big|^2
\]
\[
  \operatorname{min} \big| 
    \underbrace{(X \circ X)}_{\mathclap{\text{Hadamard product}}}
    - (1 \ 2 \ 3 \ \cdots \ M )\big|^2
\]
\end{document}

The use of \box9 is just for finding the correct width of (X \circ X). That is, some box movement is required in order to place the \aunderbrace at the correct location. The second option looks better though.

You could use an \overbrace as well. And, using \big (and friends) instead of \left...\right allows for a better appearance in terms of the absolute delimiters.

share|improve this answer
    
works perfectly, thanks for the fast answer –  tripplet Jan 29 '13 at 19:57
    
I think it's best practise to always use \bigl and \bigr instead of \big. Otherwise you may get wrong spacing, e.g. for \big|\sin x\big|. –  Hendrik Vogt Jan 30 '13 at 9:17

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.