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.
최고의 AI LaTeX 편집기, Overleaf 대안
Octree는 15개 이상의 대학의 연구자들이 AI를 사용하여 논문을 더 빠르게 작성하도록 도움
- AI로 아름다운 TikZ 다이어그램 생성
- 이미지를 업로드하고 LaTeX로 원활하게 변환
- 논문 작성 및 서식에 대한 즉각적인 지원 받기