縮短 \textleftarrow 和 \textrightarrow

縮短 \textleftarrow 和 \textrightarrow

我希望由\textleftarrow和創建的箭頭\textrightarrow分別為 50% 和 75%更短,同時保持箭頭大小相同。我在非數學環境中使用它;只是普通文字。

我查閱了以下帖子但無濟於事,因為它們似乎都是基於數學的:

答案1

您可以使用該trimclip套件來實現此目的。

在此輸入影像描述

clipbox*命令刪除 4 個座標指定的框之外的文字部分:

\clipbox*{{.25\width} 0pt {\width} {\height}} \textrightarrow

將留下箭頭右側的 75%。相似地,

\clipbox*{0pt 0pt {.75\width} {\height}} \textleftarrow

將留下箭頭左側的 75%。根據需要進行調整。

這是代碼:

%XeLaTeX
\documentclass[11pt]{book}
\usepackage{polyglossia}
\usepackage{trimclip}

\newcommand{\shorttextrightarrow}{\clipbox*{{.25\width} 0pt {\width} {\height}} \textrightarrow}
\newcommand{\shorttextleftarrow}{\clipbox*{0pt 0pt {.75\width} {\height}} \textleftarrow}

\begin{document}

Why \textrightarrow\ can't I figure this out \textleftarrow ?

Why \shorttextrightarrow\ can't I figure this out \shorttextleftarrow ?

\end{document}

相關內容