3

enter image description here

Hi, what's the best way to write this lines with that symbol between the rows

Jeral
  • 33

4 Answers4

6

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
wipet
  • 74,238
  • 3
    I always enjoy reading your non-LaTeX solutions, but I worry that a LaTeX beginner might develop bad habits (like using $$...$$ instead of \[...\] or \def instead 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
5

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}

array output

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.

frabjous
  • 41,473
5

Here is a possibility with tikz-cd:

enter image description here

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}

Sandy G
  • 42,558
2

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:

enter image description here

Zarko
  • 296,517