Function in LaTeX (f(x))
- LaTeX command
f(x)- Package
- No package needed: built into LaTeX
- Mode
- Text and math mode
Where it is used
Function f applied to an argument x, the basic notation for a function value.
Single-letter names like f, g and h are set in italic, which is correct for symbols that stand for functions. Multi-letter named functions are different: write \sin x or \log x, and for your own names use \operatorname{softmax}(z) so they print upright instead of as a product of italic letters. In optimization, f(x) is often the objective, as in \min_x f(x) subject to constraints. When the argument is tall, use \left( \right) or \bigl( \bigr) to size the parentheses. For vector arguments, f(\mathbf{x}) with a bold x is common.
Also listed under: التحسين
Minimal compilable example
Paste this into an empty .tex file and compile it with pdfLaTeX, XeLaTeX or LuaLaTeX.
\documentclass{article}
\begin{document}
Function: $f(x)$
\[ f(x) = x^3 - 2x + 1 \]
\end{document}Related symbols
- Function Definition
f: A \to B - Maps To
\mapsto - Approaches
\to - Long Right Arrow
\longrightarrow - Composition
f \circ g - Inverse Function
f^{-1}
Frequently asked questions
- How do I write Function in LaTeX?
- Type f(x) in math mode, for example $f(x) = x^3 - 2x + 1$. It works in plain LaTeX without loading any package.
- Which package do I need for f(x)?
- None. f(x) is part of standard LaTeX, so it compiles with nothing in the preamble but the document class.
- Can I use f(x) in text mode, or only in math mode?
- Both. f(x) compiles in running text as well as inside $...$; in a formula keep it in math mode so it gets math fonts and spacing.
أفضل محرر LaTeX بالذكاء الاصطناعي، بديل Overleaf
يساعد Octree الباحثين من أكثر من 15 جامعة على كتابة أوراق البحث بشكل أسرع باستخدام الذكاء الاصطناعي
- أنشئ رسوم TikZ جميلة باستخدام الذكاء الاصطناعي
- ارفع صورة وحولها إلى LaTeX بسلاسة
- احصل على مساعدة فورية في كتابة وتنسيق أوراق البحث