
다음은 내 코드의 일부입니다.
\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
이것은 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}
차이점은 다음과 같습니다.
마지막에서 다음 항의 범위를 좁히기 위해(따라서 최종 더하기 주위의 공간을 줄이기 위해) 하위 스택에서 가장 넓은 줄은
\mathclap
(requiresmathtools
)를 사용하여 "압축"되었으며, 첫 번째 줄에 공백이 추가되어 다음의 표기법이 조정되었습니다. 마지막 두 용어는 겹치지 않습니다. (실제로는 이 문구를 줄이는 것이 더 나은 접근 방식일 수 있지만 항상 가능한 것은 아닙니다.)마지막 항의 위 첨자 끝에 음수 공백을 추가하여 중괄호 위에 매달릴 수 있도록 하여 중괄호 크기를 다른 것과 더 가깝게 만들었습니다.
\text
마지막 두 항 사이의 간격을 더욱 향상시키기 위해 마지막 항의 하위 스택의 두 번째 줄에 공간이 추가되었습니다( 내부 ).마지막 항에 대한 표기법의 첫 번째 줄에서는
{+}
안의 간격이k+1
위 첨자의 간격과 광학적으로 유사하도록 중괄호가 주위에 배치되었습니다. (아마도 그럴 것입니다$(k+1)st
. 그러나 논쟁은 하지 말자.)
Sigur의 답변에서 egreg의 매크로 개선 사용은 여기서도 작동하는 좋은 아이디어입니다.
답변2
@egreg가 제안한 대로 를 사용하면 \substack{}
여러 줄을 삽입할 수 있습니다. 또한 글꼴 크기도 자동으로 조정됩니다.
(@Thruston이 요청한) \ \
주변에 추가 공간이 있는지 확인하세요 .\cdots
\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}