
ここに私のコードの一部を示します:
\begin{center}
$\small \displaystyle \underbrace{(- \frac{1}{2})^0}_{\text{1st term, j = 0}} +
\underbrace{(- \frac{1}{2})^1}_{\text{2nd term, j = 1}} + \underbrace{(- \frac{1}{2})^2}_
{\text{3rd term, j = 2}} + ~...+ \underbrace{(- \frac{1}{2})^k}_{\text{kth term, 2nd to \linebreak last term, j = k}} + \underbrace{(- \frac{1}{2})^{k+1}}_{\text{(k+1)th term,
last in the sum}}$
\end{center}
そしてこれが出力です
これを 1 行にまとめたいのですが、最後の 2 つの用語の下の注釈を 2 つに分割したいのですが、どうすればよいですか?
答え1
これは Sigur の回答とわずかに異なりますが、少し調整する価値があると思います。
\documentclass{article}
\usepackage{mathtools}
\begin{document}
\begingroup
\small
\[
\displaystyle
\underbrace{\left(-\frac{1}{2}\right)^0}_{\substack{\text{1st term,}\\ j = 0}}
+ \underbrace{\left(-\frac{1}{2}\right)^1}_{\substack{\text{2nd term,}\\ j = 1}}
+ \underbrace{\left(-\frac{1}{2}\right)^2}
_{\substack{\text{3rd term,}\\ j = 2}}
+ \ \cdots\
+ \underbrace{\left(-\frac{1}{2}\right)^k}
_{\substack{\text{\ \ $k$th term,\ \ }\\ \mathclap{\text{2nd to last term,}}\\ j = k}}
+ \underbrace{\left(-\frac{1}{2}\right)^{k+1\mkern-20mu}}
_{\substack{\text{$(k{+}1)$th term,}\\ \text{ last in the sum }}}
\]
\endgroup
\end{document}
違いは次のとおりです。
最後から 2 番目の項を狭める (つまり、最後のプラス記号の周りのスペースを減らす) ために、サブスタック内の最も広い行が
\mathclap
( が必要mathtools
) を使用して「圧縮」され、最後の 2 つの項の表記が重ならないように調整するために最初の行にスペースが追加されました。 (このフレーズを短くする方が実際にはおそらくより良いアプローチですが、必ずしも実行可能であるとは限りません。)最後の用語の上付き文字の末尾に負のスペースが追加され、括弧の上に垂れ下がるようになり、結果として括弧のサイズが他の括弧に近くなりました。
\text
最後の 2 つの項間の間隔をさらに改善するために、最後の項のサブスタックの 2 行目にスペース ( 内) が追加されました。最後の項の表記の最初の行では、 の周囲に中括弧が付けられ、その
{+}
中の間隔が上k+1
付き文字の間隔と視覚的に比較可能になっています。(おそらく であるべきです$(k+1)st
が、細かいことは気にしないことにします。)
egreg が Sigur の回答でマクロの改良を使用したのは良いアイデアで、ここでも有効です。
答え2
@egreg の提案どおり、 を使用すると\substack{}
複数行を挿入できます。また、フォント サイズは自動的に調整されます。
\ \
周囲に余分なスペースがあることに注意してください\cdots
(@Thruston のリクエストによる)。
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\[
\underbrace{\left( -\frac{1}{2}\right)^0}_{\substack{
\text{1st term,}\\ j = 0}} +
\underbrace{\left( -\frac{1}{2}\right)^1}_{\substack{\text{2nd term,}\\ j = 1}} +
\underbrace{\left( -\frac{1}{2}\right)^2}_{\substack{\text{3rd term,}\\ j = 2}}
+ \ \cdots \ +
\underbrace{\left( -\frac{1}{2}\right)^k}_{\substack{\text{$k$th term,}\\ \text{2nd to last term,}\\ j = k} } +
\underbrace{\left( -\frac{1}{2}\right)^{k+1}}_{\substack{\text{$(k+1)$th term,}\\ \text{last in the sum}} }
\]
\end{document}
キーストロークを減らし、エラーの可能性を最小限に抑えるための改良:
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\[
% Define a shortcut macro just for this display;
% use \left and \right instead of \Bigl and \Bigr
% if you feel these are too small
\newcommand{\myterm}[2]{%
\underbrace{\Bigl(-\frac{1}{2}\Bigr)^{#1}}_{\substack{#2}}%
}
\myterm{0}{\text{1st term,} \\ j=0}+
\myterm{1}{\text{2nd term,} \\ j=1}+
\myterm{2}{\text{3rd term,} \\ j=2}+
\;\cdots\;+ % some space around the dots
\myterm{k}{\text{$k$th term,} \\ \text{2nd to last,} \\ j=k}+
\myterm{k+1}{\text{$(k+1)$th term,} \\ \text{last in the sum}}
\]
\end{document}