TransWikia.com

Up arrow under a sequence

TeX - LaTeX Asked by Kiran K U on September 2, 2021

In a (documentclass[12pt,a4paper,oneside]{report}) document class article, I want the sequence like shown in the figure. . It is a mathematical expression/sequence/set of numbers with the arrow exactly under any one of the numbers (with or without n= 0). How to do it in latex? Any of the up arrow types (single line or double line) shown in the figure is okay.

3 Answers

Basically the same as Werner's answer but with some wrapping around it:

documentclass{article}

usepackage{amsmath}

makeatletter

newcommand*{underarrow}{def@underarrow{relax}@ifstar{@@underarrow}{def@underarrow{hidewidth}@@underarrow}}
newcommand*{@@underarrow}[2][]{underset{@underarrowsubstack{uparrowifrelaxdetokenize{#1}relaxelse#1fi}@underarrow}{#2}}

newcommand*{overarrow}{def@overarrow{relax}@ifstar{@@overarrow}{def@overarrow{hidewidth}@@overarrow}}
newcommand*{@@overarrow}[2][]{overset{@overarrowsubstack{ifrelaxdetokenize{#1}relaxelse#1fidownarrow}@overarrow}{#2}}
makeatother

begin{document}

[
(1, 2, 3)
= (underarrow{1}, 2, overarrow{3})
= (1, underarrow{2}, 3)
= (overarrow[n=1]{1}, 2, underarrow{3})
= (1, underarrow[n = 2]{2}, 3)
= (underarrow*[n=1]{1}, underarrow*[n = 2  n=2]{2}, 3)
]

end{document}

enter image description here

The extra text can be given as optional parameter. The unstarred version ignores the width of the optional parameter, the starred doesn't.

Correct answer by campa on September 2, 2021

A simple uparrow can be placed using underset{uparrow}{<stuff>}. If you're adding wide content, you may want to consider stacking them (using substack - a small array structure) and using mathclap (from mathtools).

enter image description here

documentclass{article}

usepackage{mathtools}

begin{document}

[
  x_1(n) = (1, 2, 3)
         = (underset{uparrow}{1}, 2, 3)
         = (1, underset{uparrow}{2}, 3)
         = (1, 2, underset{uparrow}{3})
         = (1, underset{mathclap{substack{uparrow  n = 2}}}{2}, 3)
]

end{document}

Answered by Werner on September 2, 2021

A lower-level method, adapting an answer by @wipet at Arrow under text, uses mathbin with the formatting provided by limits..., plus boxes and kerning:

limits command formatting

MWE

documentclass{article}

%%From:
%https://tex.stackexchange.com/questions/554923/arrow-under-text
%deftype#1#2{mathbin{mathop{#1kern0pt}%
%   limits_{raise2.5exhbox to0pt{hssstrut$uparrow$hss}hbox to0pt{hss#2hss}}}}

newcommandtypel[2]{%
mathbin{mathop{#1kern0pt}%
   limits_{raisebox{2.5ex}{hbox to0pt{hssstrut$uparrow$hss}}hbox to0pt{hss#2hss}}}
}


newcommandtypem[2]{%
mathbin{mathop{#1kern0pt}%
   limits^{raisebox{2.5ex}{hbox to0pt{hss#2hss}}hbox to0pt{hssstrut$downarrow$hss}}}
}


begin{document}

[
  x_1(n) = (1, 2, 3)
         = (typel{1}{$n=1$}, 2, 3)
         = (1, typel{2}{even}, 3)
         = (1, 2, typel{3}{})
         = (1, typel{2}{$n = 2$}, typem{3}{odd})
]


end{document}

Answered by Cicada on September 2, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP