3

enter image description here

I want to show simple summing like in the picture, without using colors. But I've no idea, that's not a undercase command.

1
  • 1
    You can use mathtools package that have these specific braces.
    – Sebastiano
    Aug 28, 2022 at 11:29

1 Answer 1

6

Here is a solution using tikzmark. Note that you must compile the document twice.

enter image description here

Define a new command \nub (nested under-bracket). The usage is \nub{<level>}{<content>}.

The levels must be non-repeating integers, and must range from 1 to the number of brackets. The brackets will cross if they are out of order. Spacing between brackets is controlled globally by \unitht, currently set to .8ex.

If you use more than one nub sequence in the document, each sequence must have its own "prefix". As stated in the screenshot, you must redefine \nubpre using \renewcommand{\nubpre}{<prefix>}.

Here is the code for the screenshot above:

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{tikzmark}
\newcommand{\unitht}{.8ex}
\newcommand{\nubpre}{A}

\newcommand{\nub}[2]{\tikzmark{a\nubpre#1}#2\tikzmark{b\nubpre#1}
    \begin{tikzpicture}[remember picture,overlay]
        \draw (pic cs:a\nubpre#1) --++(0,-#1*\unitht) -| (pic cs:b\nubpre#1);
    \end{tikzpicture}\vspace{\unitht}%
}

\begin{document}

\[\nub{5}{11+\nub{4}{12+\nub{3}{13+\nub{2}{14+\nub{1}{15+16}+17}+18}+19}+20}=31\times5=155.\]
You must choose a different nub prefix for each subsequent use
\renewcommand{\nubpre}{B}
\[\nub{3}{1+\nub{2}{2+\nub{1}{3+\cdots+98}+99}+100}=101\times50=5050.\]
using \verb`\renewcommand{\nubpre}{<prefix>}`. The default prefix is \verb`A`.

\end{document}

You must log in to answer this question.

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