(新手)嗨,我如何生成带有水平线的矢量(文本符号)?如果可能的话,更好的方法是将\rightharpoonup
标记放在字母(或单词)上方,即所讨论的矢量。(希望这\rightharpoonup
是它的正确名称)。
我还需要包括一些张量工作 - 是否有专门用于矢量/张量文本的包?
目前我已经添加了bm
包并且适合粗体矢量符号 - 但我更喜欢上面描述的那个。谢谢。
答案1
答案2
像这样?
\documentclass[a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[ascii]{inputenc}
\newcommand*{\ttensor}{\mathbin{\overline{\otimes}}}
\begin{document}
Text \( a\ttensor b \) text.
\end{document}
附录:我仍然欠你一个你实际提出的问题的答案。 Christian 的回答非常好,特别是因为它提供了你似乎要求的可扩展鱼叉(当你说覆盖整个单词时);但假设你不喜欢该fdsymbol
包为此使用的字体,并且你想坚持使用“Computer Modern 鱼叉”(在字体的位置"28
、"29
、"2A
和"2B
中找到的那些cmmi
);在该包的帮助下amsmath
,“手动”制作所需的命令并不困难:
\documentclass[a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[ascii]{inputenc}
\usepackage{amsmath}
\makeatletter
\newcommand*\MY@leftharpoonupfill@{%
\arrowfill@\leftharpoonup\relbar\relbar
}
\newcommand*\MY@rightharpoonupfill@{%
\arrowfill@\relbar\relbar\rightharpoonup
}
% These are not needed, for now:
% \newcommand*\MY@leftharpoondownfill@{%
% \arrowfill@\lefttharpoondown\relbar\relbar
% }
% \newcommand*\MY@rightharpoondownfill@{%
% \arrowfill@\relbar\relbar\rightharpoondown
% }
\newcommand*\overleftharpoon{%
\mathpalette{\overarrow@\MY@leftharpoonupfill@}%
}
\newcommand*\overrightharpoon{%
\mathpalette{\overarrow@\MY@rightharpoonupfill@}%
}
\makeatother
\begin{document}
A formula: \(
\overrightharpoon{x}:=\overrightharpoon{\textit{counter}}
\). Another formula: \(
\overleftharpoon{x}:=\overleftharpoon{\textit{counter}}
\).
\end{document}
输出如下:
第二次补充:再三考虑,我觉得覆盖鱼叉的尺寸可能太大了:如果\scriptstyle
尺寸合适的话(当主尺寸为文本尺寸时),效果会更好。这需要多花点功夫:
% My standard header for TeX.SX answers:
\documentclass[a4paper]{article} % To avoid confusion, let us explicitly
% declare the paper format.
\usepackage[T1]{fontenc} % Not necessary, but recommended.
\usepackage[ascii]{inputenc} % Just to check that the source is still pure,
% 7-bit-clean ASCII when you execute it, as it
% was when I wrote it.
% End of standard header. What follows pertains to the problem at hand.
\usepackage{amsmath}
\makeatletter
\newcommand*\MY@leftharpoonupfill@{%
\arrowfill@\leftharpoonup\relbar\relbar
}
\newcommand*\MY@rightharpoonupfill@{%
\arrowfill@\relbar\relbar\rightharpoonup
}
% These are not needed, for now:
% \newcommand*\MY@leftharpoondownfill@{%
% \arrowfill@\lefttharpoondown\relbar\relbar
% }
% \newcommand*\MY@rightharpoondownfill@{%
% \arrowfill@\relbar\relbar\rightharpoondown
% }
\newcommand*\overleftharpoon{%
\mathpalette{\overarrow@\MY@leftharpoonupfill@}%
}
\newcommand*\overrightharpoon{%
\mathpalette{\overarrow@\MY@rightharpoonupfill@}%
}
% Support for smaller size arrows:
\newcommand*\@dblsty@mathpalette[2]{%
% Works like "\mathpalette", but macro passed in #1 must take
% (at least) three arguments, of which the first _two_ are
% style selections.
\mathchoice
{#1\displaystyle \scriptstyle {#2}}%
{#1\textstyle \scriptstyle {#2}}%
{#1\scriptstyle \scriptscriptstyle {#2}}%
{#1\scriptscriptstyle \scriptscriptstyle {#2}}%
}
\newcommand*\@dblsty@overarrow@[4]{%
% #1 := stretchable covering arrow
% #2 := base style
% #3 := style for covering arrow
% #4 := base symbol
\vbox{\ialign{##\crcr
#1#3\crcr
\noalign{\nointerlineskip}%
$\m@th\hfil #2#4\hfil$\crcr
}}%
}
\newcommand*\smalloverleftharpoon{%
\@dblsty@mathpalette{\@dblsty@overarrow@\MY@leftharpoonupfill@}%
}
\newcommand*\smalloverrightharpoon{%
\@dblsty@mathpalette{\@dblsty@overarrow@\MY@rightharpoonupfill@}%
}
\makeatother
\begin{document}
\section{Normal size}
A formula: \(
\overrightharpoon{x}:=\overrightharpoon{\textit{counter}}
\). Another formula: \(
\overleftharpoon{x}:=\overleftharpoon{\textit{counter}}
\).
\section{Smaller size}
A formula: \(
\smalloverrightharpoon{x}:=\smalloverrightharpoon{\textit{counter}}
\). Another formula: \(
\smalloverleftharpoon{x}:=\smalloverleftharpoon{\textit{counter}}
\).
\end{document}
在输出中,您可以比较两种尺寸并选择您喜欢的尺寸。但请注意,较小的尺寸与包中“over-arrows”的其他用法不一致amsmath
。
第三次补充: 需要注意的是,这两个命令(的强版本)\overleftharpoon
和\overrightharpoon
定义在确切地和上面展示的一样,通过包装MnSymbol
。另一方面,据我所知,“小”版本是正品新品。