problem with array "how to make it in the same line"

\documentclass{article}

\usepackage{amsmath,amssymb,amsthm}

\begin{document}

let
$\begin{array}{cccc} f: & \mathbb{R}&\longrightarrow &]-1,1[\\ &x&\mapsto & \dfrac{x}{1+|x|} \end{array}$
be a continuous function

\end{document}


can I put $f$ in the same line of the texte ?

• You might want to use the interval package to format that ] - 1,1[, note how in all the examples below, the minus has the wrong spacing (because ]  is used in a wrong context. The interval package let's you use this syntax while also making signs appear the correct way and not like here where it acts as an addition Jul 27, 2019 at 21:09

I would do that with aligned– simpler code and better spacing. A small improvement with colon in the place of a real colon (better spacing) and the \mfrac command, preferably to \dfrac for online maths:

\documentclass{article}

\usepackage{mathtools, amssymb, amsthm}
\usepackage{nccmath}

\begin{document}

let
\begin{aligned}[t] f\colon \mathbb{R}&\longrightarrow ]-1,1[\\[-0.5ex] x & \longmapsto \mfrac{x}{1+|x|} \end{aligned}\;
be a continuous function

\end{document}


array has an optional argument to specify which line of the array should be placed on the baseline of the surrounding text, so just do \begin{array}[t]{cccc}. t for top, aligns the first row of the array with the text.

\documentclass{article}

\usepackage{amsmath,amssymb,amsthm}

\begin{document}

let
$\begin{array}[t]{cccc} f: & \mathbb{R}&\longrightarrow &]-1,1[\\ &x&\mapsto & \dfrac{x}{1+|x|} \end{array}$
be a continuous function

\end{document}

• what it means [t] please? Jul 26, 2019 at 15:56
• @PolineSandra I edited my answer a bit after first posting it, is it still unclear? Jul 26, 2019 at 15:58

Considering that the tag is also arrays (peraphs is off-topic with lot of sincerity) you could use also tikz-cd or a matrix. My proposal is this MWE.

\documentclass[a4paper,12pt]{article}
\usepackage{mathtools}
\usepackage{tikz-cd}
\usepackage{amssymb}
\usepackage{lipsum}

\begin{document}
let \begin{tikzcd}[column sep=.15in,row sep=-.1in]
f\colon \mathbb{R} \arrow[r] & {]-1,1[}         \\
x \arrow[r, maps to]         & \frac{x}{1+|x|}
\end{tikzcd} be a continuous function \lipsum[1]
\end{document}


Of course, you should take into account that the two mathematical lines affect in the space colored with the red color if there is more text.