Function Definition in LaTeX (f: A \to B)
- LaTeX command
f: A \to B- Package
- No package needed: built into LaTeX
- Mode
- Math mode only
Where it is used
Declares f as a function from the domain A to the codomain B.
This signature line opens most definitions in analysis and algebra, often followed by the element rule x \mapsto x^2. Typing a bare colon gives relation spacing on both sides, which looks too wide; \colon gives proper tight punctuation spacing, f\colon A \to B. \to and \rightarrow produce the same arrow; \longrightarrow adds emphasis in displays. Pair it with \mapsto for the element-level rule: f\colon \mathbb{R} \to \mathbb{R}, x \mapsto x^2. Diagrams with several maps between several objects are better drawn with a dedicated commutative-diagram environment.
Minimal compilable example
Paste this into an empty .tex file and compile it with pdfLaTeX, XeLaTeX or LuaLaTeX.
\documentclass{article}
\usepackage{amssymb}
\begin{document}
Function Definition: $f: A \to B$
\[ f\colon \mathbb{R} \to \mathbb{R}, \quad x \mapsto x^2 \]
\end{document}Related symbols
- Maps To
\mapsto - Function
f(x) - Approaches
\to - Long Right Arrow
\longrightarrow - Composition
f \circ g - Inverse Function
f^{-1}
Frequently asked questions
- How do I write Function Definition in LaTeX?
- Type f: A \to B in math mode, for example $f\colon \mathbb{R} \to \mathbb{R}, \quad x \mapsto x^2$. It works in plain LaTeX without loading any package.
- Which package do I need for f: A \to B?
- None. f: A \to B is part of standard LaTeX, so it compiles with nothing in the preamble but the document class.
- Can I use f: A \to B in text mode, or only in math mode?
- Only in math mode. Outside $...$ LaTeX stops with "Missing $ inserted", so write $f: A \to B$ in running text.
최고의 AI LaTeX 편집기, Overleaf 대안
Octree는 15개 이상의 대학의 연구자들이 AI를 사용하여 논문을 더 빠르게 작성하도록 도움
- AI로 아름다운 TikZ 다이어그램 생성
- 이미지를 업로드하고 LaTeX로 원활하게 변환
- 논문 작성 및 서식에 대한 즉각적인 지원 받기