答案1
問題出在“i”中,其中上升器將核的總體高度設定為\sin^2
。
你可以透過粉碎「i」來解決這個問題;但是,如果您這樣做,就會產生問題\overline{\sin x}
;解決方案是在真實操作員之前添加另一個幻像。我新增了一個\mathop
包含真實名稱幻像的原子,然後刪除了\!
TeX 在兩個連續原子之間插入的薄空格。\mathop
\documentclass{article}
\usepackage{amsmath}
\makeatletter
\newcommand{\sinname}{sin}% change here
\newcommand{\sin@name}{%
\smash{\operator@font\sinname}\vphantom{s}%
}
\DeclareRobustCommand{\sin}{%
\mathop{\vphantom{\operator@font\sinname}}\!%
\qopname\relax o{\sin@name}%
}
\makeatother
\begin{document}
\begin{gather*}
\frac{1}{\sin\theta}+\frac{1}{\sin\alpha}\ne
\frac{1}{\sin^2\theta}+\frac{1}{\sin^2\alpha}
\\
\frac{1}{\sin\theta}\frac{\partial}{\partial\theta}\ne
\frac{1}{\sin^2\theta}\frac{\partial^2}{\partial\theta^2}
\\
\sqrt{\sin\alpha}+\sqrt{\cos\alpha}
\\
\frac{1}{\sqrt{\sin\alpha}}+\frac{1}{\sqrt{\cos\alpha}}
\\
\overline{\sin\alpha}
\end{gather*}
\end{document}
這世界上沒有什麼是完美的!您可以看到第三行在不同高度有平方根符號。一個可能的解決方案是重新定義\cos
為具有相同的高度\sin
:
\DeclareRobustCommand{\cos}{%
\mathop{\vphantom{\operator@font\sinname}}\!%
\qopname\relax o{cos}%
}
由於某些印刷傳統使用不同的標籤\sin
(可能是“sen”),因此我僅提供,\sinname
因為不需要\cos
更改名稱。
\sin
根據此定義,和的上劃線將處於同一水平\cos
,這可能是也可能不是所需的。
答案2
顯然 (;-) @egreg 的回答很棒並且切中要點,但它確實有一個無限小的缺點:嘗試過的變態$\overline{\sin x}$
會得到一個驚喜。此外,有人可能會爭辯說,激進標誌的放置位置$\sqrt{\sin x}$
並不理想。
數學公式中上標的定位是 TeX 的一個非常低級的功能,它與數學排版的許多其他「親密」細節一起在 TeX 的附錄 G 中進行了描述。教材,請參閱該文件以取得以下解決方案的說明。
\documentclass[a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
% egreg's recipe:
\makeatletter
\DeclareRobustCommand{\sinname}{%
\smash{\operator@font sin}\vphantom{s}%
}
% ... but let us use a different name for the operator:
\newcommand{\ssin}{\qopname\relax o{\sinname}}
\makeatother
% Our recipe:
\setbox0 = \hbox{$$} % load math fonts
\fontdimen18\scriptfont2 = 3.78970pt % turns out to be just enough
\begin{document}
The downside in egreg's answer:
\[\sqrt{\sin x}+\sqrt{\ssin x} + \overline{\sin x}+\overline{\ssin x}\]
That's not fine.
But, with our correction, the exponent of the ``usual'' \verb|\sin| will not be
rised that much:
\[ \frac{1}{\cos^{2}x} + \frac{1}{\sin^{2}x} + \frac{1}{x^{2}} \]
For an explanation, see \textsl{The \TeX book}, Appendix~G, Rule~18a; the
relevant passage is ``set \( u\gets h-q \)\,\ldots\ where $q$\,\ldots\ [is] the
[value] of~$\sigma_{18}$\,\ldots\ in the font corresponding to
[style]~$C{\uparrow}$''. What we are doing is to increase~$q$. The amended
value of~$u$ will be subsequently used in Rule~18c to position the superscript.
\end{document}
這是輸出:
我們也放大關鍵部分:
當然,這個解決方案也可能有缺點:以這種方式更改在如此低的 TeX 等級上運行的參數可能會導致乍看之下並不明顯的副作用。
答案3
答案4
我不知道這個\sin^2
語法,因此我以前從未見過這個問題。您可能想要更改為更常見的內容,如下面我的 MWE 中所示。另一個問題同時解決,因為您不必補償該正弦項中誇張的上標。
% arara: pdflatex
\documentclass{article}
\usepackage{mathtools}
\begin{document}
\[
\frac{1}{\sin\vartheta}\frac{\partial}{\partial\vartheta} \text{ vs. }\frac{1}{\sin(\vartheta)^2}\frac{\partial}{\partial\vartheta^2}
\]
\end{document}
如果您想堅持這種語法,則必須在最左邊的術語中添加一個支柱。這將從右側模仿上標並使所有內容都很好地對齊(您仍然需要修復subdepth
)。
\frac{1}{\sin^{\vphantom{2}}\vartheta}
@egreg 只是告訴我可以重新定義\sin
為
\def\sin{\mathop{\smash{\mathrm{sin}}\vphantom{s}}\nolimits}
為了做到這一點。但不建議這樣做。如果您重新定義一些核心命令,您應該非常清楚自己在做什麼。