How I make in Latex the modulus, or absolute value, match the size of the expression within? I want to know what are the sizes available.
Example:
$$\mid\frac{\partial I}{\partial M}\mid
= \frac{T^2 dg}{4\pi^2}$$
I suggest you load the mathtools
package and define a macro called \abs
as follows:
\usepackage{mathtools} % for '\DeclarePairedDelimiter' macro
\DeclarePairedDelimiter{\abs}{\lvert}{\rvert}
Then, in the body of the document, you'd write
\[
\abs*{\frac{\partial I}{\partial M}} = \frac{T^2 dg}{4\pi^2}
\]
The *
("star" or "asterisk") symbol after \abs
indicates to LaTeX that the delimiter symbols (here: plain vertical bars) should be scaled vertically to the height and depth of the macro's argument.
Here's a screenshot to compare the look of the auto-sized fences (which happens to corresponds to \bigg
) and of the look that results from choosing \Big
manually. Speaking for myself, I have slight preference for look produced by the manually-chosen size.
\documentclass{article}
\usepackage{mathtools}
\DeclarePairedDelimiter{\abs}{\lvert}{\rvert}
\begin{document}
auto-sized (\texttt{\textbackslash bigg}):
\[
\abs*{\frac{\partial I}{\partial M}} = \frac{T^2 dg}{4\pi^2}
\]
\bigskip
using \texttt{\textbackslash Big} directly:
\[
\abs[\Big]{\frac{\partial I}{\partial M}} = \frac{T^2 dg}{4\pi^2}
\]
\end{document}
Use
\[\left|\frac{\partial I}{\partial M}\right|
= \frac{T^2 dg}{4\pi^2}\]
instead. Note that \mid
is a relation symbol, and not appropriate here. It produces different spacing, for one.
The \left
…\right
construction can be used with all kinds of parentheses, brackets, and the like.
(Incidentally, replaced $$
by proper math delimiters.)
\[ … \]
preferable to $$
? suffices
$$\left|\frac{\partial I}{\partial M}\right| = \frac{T^2 dg}{4\pi^2}$$
a solution to your question?\mid
is clearly not the correct symbol here as it does not scale (as it is not a fence). I even see users using||x||
for norms which is also wrong. You might want to look up the definition of\abs
in themathtools
package (it is an example of the\DeclarePairedDelimiter
macro)