TransWikia.com

New symbol derived from [a, b]

TeX - LaTeX Asked on February 16, 2021

I would like to draw the following new symbol, so that I can use it in sentences.

enter image description here

Which tool would you advise? TikZ?

Thanks

2 Answers

Before someone comes with a TikZ solution...

documentclass{article}

% usepackage{amsmath}

makeatletter
newcommand*{foo}{mathpalette@foo}
newcommand*{@foo}[2]{%
   % rule thickness
   @tempdima=fontdimen8
       ifx#1displaystyletextfontelse
       ifx#1textstyletextfontelse
       ifx#1scriptstylescriptfontelse
       scriptscriptfontfififi 3
   % spacing around the symbols 0.5ex
   @tempdimb=0.5fontdimen5
       ifx#1displaystyletextfontelse
       ifx#1textstyletextfontelse
       ifx#1scriptstylescriptfontelse
       scriptscriptfontfififi 2
   sbox0{m@thkern@tempdimb$#1#2$kern@tempdimb}%
   ht0=dimexprht0+@tempdimbrelax
   dp0=dimexprdp0+@tempdimbrelax
   lowerdimexprdp0+@tempdimarelax
      hbox{%
        vrule@width@tempdima
        vbox{offinterlineskip
          hb@xt@wd0{vrule@height@tempdima@width@tempdimbhfilvrule@height@tempdima@width@tempdimb}%
          box0
          hrule@height@tempdima
        }%
        vrule@width@tempdima
      }%
}
makeatother

begin{document}

$foo{a,b}$
$scriptstylefoo{a,b}$
$scriptscriptstylefoo{a,b}$

medskip
$displaystylefoo{-frac{a}{2},frac{a}{2}}$
$foo{-frac{a}{2},frac{a}{2}}$
$scriptstylefoo{-frac{a}{2},frac{a}{2}}$
$scriptscriptstylefoo{-frac{a}{2},frac{a}{2}}$

end{document}

The two lengths scale accordingly to the current math style: @tempdima is the standard rule thickness, while @tempdimb is basicall half ex (the latter could be fixed without resorting to fontdimen).

enter image description here

If you uncomment amsmath then the result will differ slightly in scriptscriptstyle, where you get

without amsmath: enter image description here

with amsmath: enter image description here

Correct answer by campa on February 16, 2021

If your symbols don't have excessive depth (no fractions, for instance), you can get away with

documentclass{article}
usepackage{amsmath,array}

makeatletter
newcommand{segment}[1]{%
  biglceilcolas@segment{#1}bigrceil
}
newcommand{colas@segment}[1]{%
  mspace{-4.85mu}%
  underline{mspace{5mu}#1vphantom{j}mspace{5mu}}%
  mspace{-4.85mu}%
}
makeatother

begin{document}
Huge

indentrlap{vrule height0pt depth0.1pt width 4cm}%
$segment{a,b}={ta+(1-t)b: tin[0,1]}$

indentrlap{vrule height0pt depth0.1pt width 4cm}%
$segment{p,q}={tp+(1-t)q: tin[0,1]}$

end{document}

enter image description here

Answered by egreg on February 16, 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