Math & ScienceAlignment with Functions

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
Sidd
Posts: 1
Joined: Mon Jul 11, 2011 9:22 pm

Alignment with Functions

Post by Sidd »

Hey there, I'm having issues dealing with the "align" command and functions. I haven't found any answer on the board yet, please excuse me if any exists.

What I want to do is having functions aligned properly with :
[Name of the function] : [First set] -> [Second set] and then [First variable(s)] -> [Second variable(s)].
The problem is it is either I use just one "&" to align or it is going to put an enourmous space before the second one (I also tried with "&" and then "&&"). I'm sure there is an easy way to do that since it is a pretty common thing to write :)

Here is my code :

Code: Select all

\documentclass{article}
\usepackage[frenchb]{babel}
\usepackage[utf8]{inputenc}
\usepackage{dsfont}
\usepackage{amsmath}
\usepackage[T1]{fontenc}

\begin{document}

\begin{align*}
Z : \mathds{N} &\longrightarrow \mathds{N} \\
    x          & \longrightarrow Z(x) = 0
\end{align*}

\begin{align*}
Z : & \mathds{N} &&\longrightarrow \mathds{N} \\
    & x          && \longrightarrow Z(x) = 0
\end{align*}

\end{document}
Thank you for your help!

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

5gon12eder
Posts: 126
Joined: Sun Feb 13, 2011 8:36 pm

Alignment with Functions

Post by 5gon12eder »

Try the alignat environment instead of align.

Best
I'm using pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009/Debian).
Post Reply