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 want to mark the weight function in an equation, using something similar to \underbrace. Using this piece of code:

(x^2y')' + \lambda \underbrace{x^2}_{\text{Weight function}}y = 0

I get

equation.

I don't want such a big space between the and the other parts of the equation. I wouldn't mind, for example, having an arrow leading downwards, and there to write the description. Is there any way to do what I describe?

share|improve this question
add comment

3 Answers

up vote 5 down vote accepted

Here I've played around with different ways of highlighting without resorting to any (major) additional packages. There are ways of doing it more elegantly (using tikz, for example):

Different ways of highlight math elements

\documentclass{article}
\usepackage{grahpicx}% http://ctan.org/pkg/graphicx
\usepackage{amsmath}% http://ctan.org/pkg/amsmath
\begin{document}
\[
  (x^2y')' + \lambda \underbrace{x^2}_{\text{\makebox[0pt]{Weight function}}}y = 0
\]

\[
  (x^2y')' + \lambda \mathop{\rlap{\resizebox{1em}{\ht\strutbox}{$\underbrace{\phantom{x^2}}$}}x^2}_{\text{\makebox[0pt]{Weight function}}}y = 0
\]

\[
  (x^2y')' + \lambda
  \begin{array}[t]{@{\,}c@{\,}}
    x^2 \\ \downarrow \\ \makebox[0pt]{\scriptsize Weight function}
  \end{array}
  y = 0 
\]

\[
  (x^2y')' + \lambda
  \begin{array}[t]{@{}c@{}}
    \setlength{\fboxsep}{1pt}
    \fbox{$x^2$} \\ \downarrow \\ \makebox[0pt]{\scriptsize Weight function}
  \end{array}
  y = 0 
\]

\[
  (x^2y')' + \lambda \underset{\text{\makebox[0pt]{Weight function}}}{\underset{\downarrow}{x^2}}  y = 0 
\]
\end{document}

Option 1 is fairly basic. Option 2 sets a fake with a appropriate \underbrace, but resizes it to the width of 1em, before typesetting the rest of the expression as \mathop. Options 3 & 4 use an array to stack symbols. Option 5 uses a stacked-\underset.

share|improve this answer
    
Thanks! It's weird that we have to use an array to do such a basic thing. Do you think it is possible to combine the first and last one, i.e. do that brace and the arrow? –  Hugo Jan 28 '12 at 19:40
    
@Hugo: I've added a "resized \underbrace" option. I don't think it would look good to have an \underbrace and a \downarrow, since they both are arrow-like. –  Werner Jan 28 '12 at 20:03
    
That does look good. Thanks! :-) –  Hugo Jan 28 '12 at 20:06
add comment

The mathtools package gives the command \mathclap, which can be used to give

screenshot

\documentclass{article}

\usepackage{mathtools}

\begin{document}
\[
    (x^2y')' + \lambda \underbrace{x^2}_{\mathclap{\text{Weight function}}}y = 0
\]
\end{document}
share|improve this answer
    
Thank you. That does narrow the gap, but still isn't quite what I wanted. –  Hugo Jan 28 '12 at 19:37
    
I find this to be the cleanest solution of all the offered ones. –  tohecz Jan 28 '12 at 23:11
add comment

Here's a simple way:

\let\hw\hidewidth
$$
  (x^2y')'+\lambda \underbrace{\mathop{x^2}}_{\hw\fam0 Weight~function\hw} y = 0
$$
\bye

enter image description here

share|improve this answer
add comment

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.