是否有任何包可以修复张量指标的高度?
例如,我想水平对齐以下表达式中的索引,表示反对称化A和b,
\documentclass{article}
\linespread{1.5}\selectfont
\begin{document}
$e_i^{[a}q^{b]c}$
\end{document}
\phantom
是否有任何通用方法不强迫我在每个表达式中使用,就像这里一样?
\documentclass{article}
\linespread{1.5}\selectfont
\begin{document}
$e_i^{[a}q^{b]c}_{\phantom{d}}$
\end{document}
答案1
您可以将\mathstrut
(具有符号高度的框(
)放入下标中q
\documentclass{article}
\linespread{1.5}\selectfont
\begin{document}
$e_i^{[a}q_{\mathstrut}^{b]c}$
\end{document}
或者你可以调整上标上升和下标下降文档范围
\documentclass{article}
\linespread{1.5}\selectfont
\everymath{
\fontdimen14\textfont2=1.1ex
\fontdimen17\textfont2=0.9ex
}
\begin{document}
$e_i^{[a}q^{b]c}$
\end{document}
答案2
这是一个与包类似的实现tensor
,但确保在每个阶段添加空的上标或下标。
\documentclass{article}
\usepackage{amsmath,xparse}
\ExplSyntaxOn
\NewDocumentCommand{\tensor}{mm}
{
#1
\group_begin:
\bilbo_tensor:w #2
}
\cs_new_protected:Npn \bilbo_tensor:w
{% start the recursion
\peek_catcode_remove:NTF \c_math_subscript_token
{
\bilbo_tensor_sub:n
}
{
\peek_catcode_remove:NTF \c_math_superscript_token
{
\bilbo_tensor_sup:n
}
{
\group_end:
}
}
}
\cs_new_protected:Nn \bilbo_tensor_sub:n
{% typeset the subscript with a phantom superscript
{}
\c_math_subscript_token{#1}
\c_math_superscript_token{\vphantom{d}}
% look for a superscript
\bilbo_tensor_sup:w
}
\cs_new_protected:Nn \bilbo_tensor_sup:n
{% typeset the superscript with a phantom subscript
{}
\c_math_superscript_token{#1}
\c_math_subscript_token{\vphantom{d}}
% look for a subscript
\bilbo_tensor_sup:w
}
\cs_new_protected:Npn \bilbo_tensor_sup:w
{% look for a ^
\peek_catcode_remove:NTF \c_math_superscript_token
{
\bilbo_tensor_sup:n
}
{% no ^, end
\group_end:
}
}
\cs_new_protected:Npn \bilbo_tensor_sub:w
{% look for a _
\peek_catcode_remove:NTF \c_math_subscript_token
{
\bilbo_tensor_sub:n
}
{% no _, end
\group_end:
}
}
\ExplSyntaxOff
\begin{document}
$\tensor{e}{_i^{[a}}\tensor{q}{^{b]c}}$
\end{document}