[a, b]から派生した新しいシンボル

[a, b]から派生した新しいシンボル

文章の中で使えるように、次の新しい記号を描きたいと思います。

ここに画像の説明を入力してください

どのツールをお勧めしますか? TikZ?

ありがとう

答え1

誰かがTiを持って来る前にZソリューション:-)...

\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}

2 つの長さは、現在の数学スタイルに従ってスケールされます。\@tempdimbは分数規則の厚さで、 は\@tempdima半分ですex(後者は に頼らずに固定できます\fontdimen)。

ここに画像の説明を入力してください

コメントを外すとamsmath、結果は若干異なり\scriptscriptstyle

それなしamsmathここに画像の説明を入力してください

amsmathここに画像の説明を入力してください

短いコードで

\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}%
}

「ボックス」は0.4ptどのスタイルでもデフォルトの太さになります。

答え2

シンボルに過度の深さがない場合(たとえば分数がない場合)、

\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}

ここに画像の説明を入力してください

関連情報