I would like to draw the following new symbol, so that I can use it in sentences.
Which tool would you advise? TikZ?
Thanks
Before someone comes with a TikZ solution :-)...
\documentclass{article}
% \usepackage{amsmath}
\makeatletter
\newcommand{\foo}[1]{{\mathpalette\foo@{#1}}}
\newcommand{\foo@}[2]{%
@tempdima=.5\fontdimen5
\ifx#1\displaystyle\textfont\else
\ifx#1\textstyle\textfont\else
\ifx#1\scriptstyle\scriptfont\else
\scriptscriptfont\fi\fi\fi\tw@
@tempdimb=\fontdimen8
\ifx#1\displaystyle\textfont\else
\ifx#1\textstyle\textfont\else
\ifx#1\scriptstyle\scriptfont\else
\scriptscriptfont\fi\fi\fi\thr@@
\setbox\z@=\vtop{\hbox{$\m@th#1#2$}\kern@tempdima}%
\setbox\tw@=\vbox{\hrule@width@tempdima@height@tempdimb\kern\ht\z@\kern@tempdima}%
\vtop{\hbox{\vrule@width@tempdimb\copy\tw@\copy\z@\copy\tw@\vrule@width@tempdimb}\hrule@height@tempdimb}%
}
\makeatother
\begin{document}
$\foo{a,b}$
$\scriptstyle\foo{a,b}$
$\scriptscriptstyle\foo{a,b}$
\medskip
$\displaystyle\foo{-\frac{a}{2},\frac{a}{2}}$
$\foo{-\frac{a}{2},\frac{a}{2}}$
$\scriptstyle\foo{-\frac{a}{2},\frac{a}{2}}$
$\scriptscriptstyle\foo{-\frac{a}{2},\frac{a}{2}}$
\end{document}
The two lengths scale according to the current math style: \@tempdimb is the fraction rule thickness, while \@tempdima is half ex (the latter could be fixed without resorting to \fontdimen).
If you uncomment amsmath then the result will differ slightly in \scriptscriptstyle, where you get
With the shorter code
\newcommand*{\foo@}[2]{%
\@tempdima=.5\fontdimen5
\ifx#1\displaystyle\textfont\else
\ifx#1\textstyle\textfont\else
\ifx#1\scriptstyle\scriptfont\else
\scriptscriptfont\fi\fi\fi\tw@
\setbox\z@=\vtop{\hbox{$\m@th#1#2$}\kern\@tempdima}%
\setbox\tw@=\vbox{\hrule\@width\@tempdima\kern\ht\z@\kern\@tempdima}%
\vtop{\hbox{\vrule\copy\tw@\copy\z@\copy\tw@\vrule\@width\@tempdimb}\hrule}%
}
the "box" has the default thickness of 0.4pt in every style.
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]{%
\big\lceil\colas@segment{#1}\big\rceil
}
\newcommand{\colas@segment}[1]{%
\mspace{-4.85mu}%
\underline{\mspace{5mu}#1\vphantom{j}\mspace{5mu}}%
\mspace{-4.85mu}%
}
\makeatother
\begin{document}
\Huge
\indent\rlap{\vrule height0pt depth0.1pt width 4cm}%
$\segment{a,b}={ta+(1-t)b: t\in[0,1]}$
\indent\rlap{\vrule height0pt depth0.1pt width 4cm}%
$\segment{p,q}={tp+(1-t)q: t\in[0,1]}$
\end{document}
[\![a,b]\!]instead. – Michael Hoppe Nov 13 '20 at 17:05