I am new to Latex. I am aiming to define a function appropriately using latex, that is to first define the sets, e.g. $f:X \to Y$ and then how the elements map into the image, i.e. $x \to f(x)$. I would like both rows to align well. Below is the code and problem I encountered:
\begin{alignat*}{2}
X \colon T &\rightarrow {}&& \mathcal{D} \\
t&\mapsto \lim\limits_{n \to \infty}\sum_{\substack{i = 0,...,m}}(f(t_{i,n})-f(t_{i-1,n})\cdot(f(t_{i,n})-f(t_{i-1,n}))\\
\end{alignat*}
I want the "D" to be just in line with the start of the limit in the "mapsto" row. Could anyone show me how to do this?
align
(notalginat
).\documentclass{article} \usepackage{amsmath} \begin{document} \begin{align*} X \colon T &\rightarrow \mathcal{D} \\ t&\mapsto \lim\limits_{n \to \infty} \sum_{\substack{i =0,\dots,m}} (f(t_{i,n})-f(t_{i-1,n})\cdot(f(t_{i,n})-f(t_{i-1,n})) \end{align*} \end{document}
align
is the way to go. I'm just going to verbally suggest adjustments. The&&
you used is what is shifting the\mathcal{D}
way off to the right, so get rid of them. But since there is a limit on\lim
, the "l" may be a bit to the right of the "D". Rather than trying to shift the\lim
expression, if it's needed add a small space before the "D".\,
should be more than enough; if it's too much, then\mspace{2mu}
should work. (mu
is a "math" unit, and a thin space =3mu
.)&
symbols. Since the first row has more&
than the second, the extra&
come after everything in the second row, and then the\mathcal{D}
comes after that.