If and Only If in LaTeX (\iff)
- LaTeX command
\iff- Package
- No package needed: built into LaTeX
- Mode
- Math mode only
- Copy the Unicode character
- ⟺
U+27FA
Where it is used
Writes a long double-headed arrow for logical equivalence, read "if and only if".
\iff produces \Longleftrightarrow with extra thick spacing on both sides. It joins two statements that imply each other, as in a theorem like n \text{ is even} \iff n^2 \text{ is even}. Logic texts often prefer \leftrightarrow or \Leftrightarrow for the biconditional inside formulas, keeping \iff for statements in prose. Because of that padding, \iff looks too loose inside compact subscripts or set-builder conditions. Do not confuse it with \equiv, which means identically equal or congruent modulo n.
Also listed under: Lohika at Proofs
Minimal compilable example
Paste this into an empty .tex file and compile it with pdfLaTeX, XeLaTeX or LuaLaTeX.
\documentclass{article}
\begin{document}
If and Only If: $\iff$
\[ A \subseteq B \iff A \cap B = A \]
\end{document}Related symbols
- For All
\forall - Implies
\implies - Exists
\exists - Greater Than or Equal
\geq - Element Of
\in - Less Than or Equal
\leq
Frequently asked questions
- How do I write If and Only If in LaTeX?
- Type \iff in math mode, for example $A \subseteq B \iff A \cap B = A$. It works in plain LaTeX without loading any package.
- Which package do I need for \iff?
- None. \iff is part of standard LaTeX, so it compiles with nothing in the preamble but the document class.
- Can I use \iff in text mode, or only in math mode?
- Only in math mode. Outside $...$ LaTeX stops with "Missing $ inserted", so write $\iff$ in running text. If you only need the glyph in text, paste the Unicode character ⟺ instead (with XeLaTeX or LuaLaTeX and a font that has it).
Pinakamahusay na AI LaTeX Editor, Alternatibo sa Overleaf
Tinutulungan ng Octree ang mga researcher mula sa 15+ na unibersidad na sumulat ng research papers nang mas mabilis gamit ang AI
- Gumawa ng magagandang TikZ diagrams gamit ang AI
- Mag-upload ng larawan at i-convert ito sa LaTeX nang walang problema
- Makakuha ng instant na tulong sa pagsulat at pag-format ng research papers