Hi, what's the best way to write this lines with that symbol between the rows
4 Answers
You didn't specify what TeX format is expected. I can show you how to do this in OpTeX:
\fontfam[lm]
\def\N{{\bbchar N}}
\def\rotin{\rotbox{90}{$\in$}}
$$
\matrix{
\N \times \N & \longrightarrow & \N \cr
\rotin & & \rotin \cr
(n,m) & \longmapsto & n + m \cr
}
$$
\bye
- 74,238
-
3I always enjoy reading your non-LaTeX solutions, but I worry that a LaTeX beginner might develop bad habits (like using
$$...$$instead of\[...\]or\definstead of\newcommand) because they don't realize that OpTeX is different from LaTeX. Just a thought. – Sandy G Oct 11 '22 at 18:28 -
IMHO, it is not true: each TeX beginner = LaTeX beginner. I know many examples they refutes this equality. – wipet Oct 13 '22 at 16:51
I'd probably use an array, like this:
\documentclass{article}
\usepackage{amssymb}
\usepackage{graphicx}
\newcommand{\N}{\mathbb{N}}
\newcommand{\upin}{\rotatebox[origin=c]{95}{(\in)}}
\begin{document}
[
\begin{array}{@{}c@{~}c@{~}c@{}}
\N \times \N & \rightarrow & \N \
\upin & & \upin \
(n,m) & \mapsto & n+m \
\end{array}
]
\end{document}
I'm using \rotatebox from the graphicx package to rotate the symbols. I believe the stix package also defines an \upin command you could use directly.
The spacing with the upper right ℕ is not great, but I'm not sure there's a good way to solve that.
- 41,473
Here is a possibility with tikz-cd:
The ∈ symbols are labels on phantom arrows with the sloped option to follow the direction of the (invisible) arrow.
\documentclass{article}
\usepackage{tikz-cd, amsfonts}
\newcommand{\N}{\mathbb{N}}
\begin{document}
\begin{tikzcd}
\N\times\N\arrow[r] & \N\
(n,m)\arrow[r, mapsto]\arrow[u, phantom, "\in", sloped] & n+m\arrow[u, phantom, "\in", sloped]
\end{tikzcd}
\end{document}
- 42,558
Try this:
\documentclass[11pt,a4paper]{book}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage[italian]{babel}
\begin{document}
\begin{alignat*}{4}
\mathbb{N}\times\mathbb{N} && \rightarrow && \mathbb{N}\\
\rotatebox{90}{$\epsilon$} && && \rotatebox{90}{$\epsilon$}\\
(n,m) && \rightarrow && n+m
\end{alignat*}
\end{document}
Output:
- 296,517
- 9,702
-
3I think it should be
\rotatebox{90}{$\in$}, not\rotatebox{90}{$\epsilon$}, – Mico Oct 11 '22 at 20:10 -




\in. It is understood that the (n,m) and n+m belongs to the sets indicated. – mickep Oct 12 '22 at 05:23