定義新的可變寬度數學重音

定義新的可變寬度數學重音

我希望定義一個 LaTeX 宏,它的功能或多或少與\overrightarrow除了用魚叉代替箭頭之外完全相同。我研究了很多解決方案,但沒有一個能完全勝任這項工作。

  1. 蒂克茲解決方案:看起來不錯,但寬度不可變。
  2. 重疊解決方案:如果向下移動魚叉,則有效,但寬度也不能改變。
  3. 魚叉封裝解決方案:寬度可變,但魚叉高度是應有高度的兩倍。魚叉的形狀也隨著其寬度而變化,而不是保持相同的魚叉頭並改變尾部的長度。
  4. 口音設定解決方案:不可變寬度。
  5. XeTeX解決方案:這看起來和我想要的一模一樣,但我正在用 LaTeX 排版我的文件。

有沒有辦法在 LaTeX 中重現 XeTeX 解決方案,或更改其他解決方案之一以適應我想要的屬性?

答案1

\overrightarrow一個相當粗略的解決方案是複製from的定義amsmath

\documentclass{article}
\usepackage{amsmath}

\makeatletter
\newcommand{\overrightharpoon}{%
  \mathpalette{\overarrow@\rightharpoonfill@}}
\def\rightharpoonfill@{\arrowfill@\relbar\relbar\rightharpoonup}
\makeatother

\begin{document}

$\overrightharpoon{aaaaaaa}+\overrightharpoon{a}$

\end{document}

在此輸入影像描述

您可以透過使用修改後的程式碼來獲得更小的魚叉https://tex.stackexchange.com/a/248297/4427

\documentclass{article}
\usepackage{amsmath}

\makeatletter
\newcommand{\overrightsmallharpoon}{\mathpalette{\overarrowsmall@\rightharpoonfill@}}
\def\rightharpoonfill@{\arrowfill@\relbar\relbar\rightharpoonup}
\newcommand{\overarrowsmall@}[3]{%
  \vbox{%
    \ialign{%
      ##\crcr
      #1{\smaller@style{#2}}\crcr
      \noalign{\nointerlineskip}%
      $\m@th\hfil#2#3\hfil$\crcr
    }%
  }%
}
\def\smaller@style#1{%
  \ifx#1\displaystyle\scriptstyle\else
    \ifx#1\textstyle\scriptstyle\else
      \scriptscriptstyle
    \fi
  \fi
}
\makeatother

\begin{document}

$\overrightsmallharpoon{aaaaaaa}+\overrightsmallharpoon{a}$

\end{document}

在此輸入影像描述

相關內容