對齊分段函數和函數定義數學

對齊分段函數和函數定義數學

我不確定如何對齊以下內容,以便與in\mathbb{N}對齊。我已經嘗試過了,但這給了我很多錯誤。任何幫助都感激不盡!nf(n)\begin{align*}

It suffices to show that $\mathbb{Z}\preceq \mathbb{N}$.
\\* Define $f : \mathbb{N}\longrightarrow \mathbb{Z}$ by \[
f(n) =
\begin{cases}
k &\text{if } n=2k \text{ for } k\in \mathbb{Z},\\
-k &\text{if } n=2k+1 \text{ for } k\in \mathbb{Z}.
\end{cases}
\]

答案1

結果是相當可怕的。

\documentclass{article}
\usepackage{amsmath,amssymb}
\begin{document}
It suffices to show that $\mathbb{Z}\preceq \mathbb{N}$.
\[
\begin{array}{@{} r @{} c @{} l @{} }
\text{Define }f \colon &\mathbb{N} & {} \longrightarrow \mathbb{Z} \text{ by}\\[1ex]
&f(n) &{}=\displaystyle
\begin{cases}
k &\text{if } n=2k \text{ for } k\in \mathbb{Z},\\
-k &\text{if } n=2k+1 \text{ for } k\in \mathbb{Z}.
\end{cases}
\end{array}
\]
\end{document}

在此輸入影像描述

請幫您的讀者一個忙,並以傳統方式進行:

\documentclass{article}
\usepackage{amsmath,amssymb}
\begin{document}
It suffices to show that $\mathbb{Z}\preceq \mathbb{N}$.
Define $f \colon\mathbb{N} \to \mathbb{Z}$ by
\[
f(n)=
\begin{cases}
k &\text{if } n=2k \text{ for } k\in \mathbb{Z},\\
-k &\text{if } n=2k+1 \text{ for } k\in \mathbb{Z}.
\end{cases}
\]
\end{document}

在此輸入影像描述

我會避免使用k,從數學角度來說:

\documentclass{article}
\usepackage{amsmath,amssymb}
\begin{document}
It suffices to show that $\mathbb{Z}\preceq \mathbb{N}$.
Define $f \colon\mathbb{N} \to \mathbb{Z}$ by
\[
f(n)=
\begin{cases}
\hphantom{-}\dfrac{n}{2} &\text{if $n\in\mathbb{N}$ is even},\\[2ex]
-\dfrac{n-1}{2} &\text{if $n\in\mathbb{N}$ is odd}.
\end{cases}
\]
\end{document}

在此輸入影像描述

相關內容