Constraint in LaTeX (g(x) \leq 0)
- LaTeX command
g(x) \leq 0- Package
- No package needed: built into LaTeX
- Mode
- Math mode only
Where it is used
Generic inequality constraint: the function g must be non-positive at a feasible point x.
Writing inequality constraints in the standard form g_i(x) \leq 0 is the convention in convex optimization, so a constraint like x_1 + x_2 \geq 1 becomes 1 - x_1 - x_2 \leq 0. \leq has a short alias \le, and both give the same glyph; \leqslant draws a slanted bar preferred in some European typography. Index multiple constraints as g_i(x) \leq 0 for i = 1, \dots, m. In KKT analysis each inequality gets a multiplier \lambda_i \geq 0 with complementary slackness \lambda_i g_i(x) = 0. For problem layouts, align them with &.
Minimal compilable example
Paste this into an empty .tex file and compile it with pdfLaTeX, XeLaTeX or LuaLaTeX.
\documentclass{article}
\begin{document}
Constraint: $g(x) \leq 0$
\[ g_i(x) \leq 0, \quad i = 1, \dots, m \]
\end{document}Related symbols
- Equality Constraint
h(x) = 0 - Subject To
\text{s.t.} - Lagrangian
\mathcal{L}(x, \lambda) - Maximize
\max_{x} - Lambda
\lambda - Minimize
\min_{x}
Frequently asked questions
- How do I write Constraint in LaTeX?
- Type g(x) \leq 0 in math mode, for example $g_i(x) \leq 0, \quad i = 1, \dots, m$. It works in plain LaTeX without loading any package.
- Which package do I need for g(x) \leq 0?
- None. g(x) \leq 0 is part of standard LaTeX, so it compiles with nothing in the preamble but the document class.
- Can I use g(x) \leq 0 in text mode, or only in math mode?
- Only in math mode. Outside $...$ LaTeX stops with "Missing $ inserted", so write $g(x) \leq 0$ in running text.
Editor LaTeX AI Terbaik, Alternatif Overleaf
Octree membantu penyelidik dari 15+ universiti menulis kertas penyelidikan dengan lebih cepat menggunakan AI
- Jana diagram TikZ yang cantik menggunakan AI
- Muat naik imej dan tukar ke LaTeX dengan lancar
- Dapatkan bantuan segera untuk menulis dan memformat kertas penyelidikan