源自 [a, b] 的新符號

源自 [a, b] 的新符號

我想畫出以下新符號,以便我可以在句子中使用它。

在此輸入影像描述

您會建議使用哪一種工具?蒂克Z?

謝謝

答案1

在有人帶著Ti到來之前kZ解:-)...

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

這兩個長度根據當前的數學風格進行縮放:\@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}

在此輸入影像描述

相關內容