Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am unsure how to align the following so that \mathbb{N} is aligned with the n in f(n). I have tried \begin{align*} but that just gave me a bunch of errors. Any help will be much appreciated!

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}
\]
share|improve this question
    
I'm not sure you really want a line break before “Define”, nor that you want “f(n)” aligned with the “ℕ”. –  egreg Dec 29 '13 at 20:31

1 Answer 1

The result is pretty horrible.

\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}

enter image description here

Please, do a favor to your readers and do in the traditional way:

\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}

enter image description here

I'd avoid the usage of k, speaking from a mathematical point of view:

\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}

enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.