Secant in LaTeX (\sec)
- LaTeX command
\sec- Package
- No package needed: built into LaTeX
- Mode
- Math mode only
Where it is used
Secant, the reciprocal of cosine, as an upright named operator.
\sec\theta = 1/\cos\theta, and its square appears as the derivative of tangent, \frac{d}{dx}\tan x = \sec^2 x. The integral \int \sec x\,dx = \ln|\sec x + \tan x| + C is a classic of calculus courses and of Mercator projection formulas. Typing sec without a backslash leaves italic letters and loses the space before the argument. In geometry, a secant line is a different object, named in words rather than with this command. Like the other trig commands, powers attach directly, \sec^2 x, with the argument after them.
Minimal compilable example
Paste this into an empty .tex file and compile it with pdfLaTeX, XeLaTeX or LuaLaTeX.
\documentclass{article}
\usepackage{amsmath}
\begin{document}
Secant: $\sec$
\[ \int \sec x \, dx = \ln\lvert \sec x + \tan x \rvert + C \]
\end{document}Related symbols
All Trigonometry →Frequently asked questions
- How do I write Secant in LaTeX?
- Type \sec in math mode, for example $\int \sec x \, dx = \ln\lvert \sec x + \tan x \rvert + C$. It works in plain LaTeX without loading any package.
- Which package do I need for \sec?
- None. \sec is part of standard LaTeX, so it compiles with nothing in the preamble but the document class.
- Can I use \sec in text mode, or only in math mode?
- Only in math mode. Outside $...$ LaTeX stops with "Missing $ inserted", so write $\sec$ in running text.
Best AI LaTeX Editor, Overleaf Alternative
Octree helps researchers from 15+ universities write research papers faster using AI
- Generate beautiful TikZ diagrams using AI
- Upload image and convert it to LaTeX seamlessly
- Get instant assistance with writing and formatting research papers