I am trying to get something like this:

enter image description here

which is different from \underbrace or \underbracket. It says that a.c=3. Is there already a command for that? I have not found it. Or should one define it? If yes, can someone help me how to define it?


  • 4
    I think this might confuse the reader. Maybe writing a⋅b⋅c⋅d = \underbrace{a⋅c}_{=3}⋅b⋅d = 1 is an option. Balancing verbosity against comprehensibility is not easy ;-) – bodo Feb 20 '14 at 12:25
  • 2
    Honestly, if I read that in a paper, I wouldn't understand a.c = 3, I would understand a.b.c = 3. – Najib Idrissi Feb 21 '14 at 8:38
  • @nik, You are right. The answers are ok in that regard. – Vahid Feb 22 '14 at 8:50
  • I wouldn't use a square center dot as an operator. It's too subtle a difference. Except if it's just the look of the center dot in your font. Then it's still questionable in my mind but it becomes a matter of taste, not of readability ;) – Christian Feb 23 '14 at 12:47

Done here with stacks. I added a descender to the mix, to make sure that the under-strut did not interfere. The strut/rule parameters are adjustable. \rldp is the vertical underset of the horizontal bar, \rlht are the heights of the vertical struts, and \rlwd is the rule thickness.

Since the answer was accepted, I am EDITING it to provide a fuller explanation of what is done here. As to how the syntax of the stacking commands works, obviously reading the manual would be best. But short of that, in a nutshell, alignments are r right, c center, and l left (the default is c). An S or short stack places two items vertically with a specified gap between the items, whereas a L long stack places two items vertically with a specified distance between the baselines of the two items. The optional argument to \stackunder is that stacking gap (short or long, depending on type). When stacks are nested (\stackunder{...\stackunder{}{}...}{}), it is easiest to work from the inside out in trying to decipher it.

For example, in \uvbarR, which creates the left side of the object, the inner \stackunder places the centrally aligned vertical rule under the leading letter, the bottom of which is placed a distance \rldp below the baseline of that letter (a long stack). The outer \stackunder takes that stacked object, and places the right-aligned chunk of horizontal rule under it, the rule being only 1/2 the letter width. It places it with a negative vertical gap (overlap) of the rule width (short stack), so that finite rule-width lines lay flush.

The other, perhaps, non-obvious facet of the solution is \setbox0\hbox{${}#1{}$} which was used to typeset the central portion (2nd argument of \ubar) into a non-printed box. I did this only so that I could measure that box width (\wd0) so that I knew how long to make the horizontal underbar. The {} on either side of the argument (${}#1{}$) says to math mode to typeset the leading and trailing \cdots of the 2nd argument as if they have something else to their left and to their right (which of course, they do).

EDITED to allow for label content to be wider than spread of under-bracket.

\newcommand\ubar[4]{\uvbarR{#1} \uvbar{#2}{#4} \uvbarL{#3}}
$\ubar{a}{\cdot b\cdot d\cdot e\cdot f\cdot}{g}{a\cdot g=3} \cdot h = 1$

enter image description here

  • Thank you very much. I should read the manual of your package to see what's done here. – Vahid Feb 22 '14 at 8:59
  • @Vahid, Perhaps I'll edit my answer to incorporate my earlier comments, by way of explanation. – Steven B. Segletes Feb 22 '14 at 14:27

With a little TikZ and xparse I defined the macro \linkterms which is used as follows

\linkterms[pin length]{left term}[middle term]{right term}{term underneath}

where the arguments enclosed in [] are optional and can be left out.


\pagestyle{empty}% for cropping
\NewDocumentCommand{\linkterms}{ O{1ex} m O{} m m }{
  \tikz[remember picture,baseline=(A.base)]{\node[inner xsep=0pt] (A) {$#2$};}
  \tikz[remember picture,baseline=(C.base)]{\node[inner xsep=0pt] (C) {$#4$};}
  \tikz[remember picture,overlay]{
    \draw (A.south) -- ([yshift=-#1]A.south) -- coordinate (Z) ([yshift=-#1]C.south) -- (C.south);
    \draw (Z) -- +(0,-#1) node[below] {$#5$};
$\linkterms{a}[\cdot b \cdot]{c}{a \cdot c = 3} \cdot d = 1$ \\[1cm]
$\linkterms{a}{c}{a \cdot c = 3} \cdot d = 1$ \\[1cm]
$\linkterms[1mm]{a}[\cdot b \cdot]{c}{a \cdot c = 3} \cdot d = 1$


enter image description here

  • Thanks for your contribution :) But I am afraid that is not implemented as a command. That would be better. – Vahid Feb 22 '14 at 8:52

A low-weight method using the picture environment.

\usepackage{picture}% great package to use dimensions in picture environment



% #1=left term, #2=middle term, #3=right term
% #4=stuff to be put underneath
      \put (.5\wd\linkboxleft,-.5ex){\line(0,-1){1ex}}
      \put (\wd\linkboxall-.5\wd\linkboxright,-.5ex){\line(0,-1){1ex}}
      \put (.5\wd\linkboxleft-.1ex,-1.5ex){\line(1,0)
      \put (.5\wd\linkboxall,-1.5ex){\line(0,-1){1ex}}
      \put (.5\wd\linkboxall,-3ex){\makebox(,)[t]{\usebox{\linkboxunder}}}



$\linktwoterms{a}{\cdot b \cdot}{c}{\scriptstyle (a\cdot c = 3)}\cdot d = 1$

% aahuiauhdaihda for testing depth above.




The syntax is

\linkterms{left}[optional middle]{right}{underset}

Run it with xelatex:

$\linkterms{a}[\cdot b \cdot]{c}{a \cdot c = 3} \cdot d = 1$ \\[1cm]
$\linkterms{a}{c}{a \cdot c = 3} \cdot d = 1$ \\[1cm]
$\linkterms{a}[\cdot b\cdot d\cdot e\cdot f\cdot]{g}{a\cdot g=3} \cdot h = 1$

enter image description here

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.