3

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}$$
13
  • 4
    You might want to rephrase your question, I have no clue what it is you're asking
    – daleif
    Apr 14, 2016 at 13:57
  • 5
    What is signal in this context? Please provide an example
    – daleif
    Apr 14, 2016 at 14:05
  • 2
    Is $$\left|\frac{\partial I}{\partial M}\right| = \frac{T^2 dg}{4\pi^2}$$ a solution to your question? Apr 14, 2016 at 14:24
  • 2
    Check question meta.tex.stackexchange.com/questions/228/… to add a MWE! Also, you have asked a number of questions and some of these have received several, often extensive answers. Please consider accepting answers to some of your existing questions. You can do this by clicking on the greyed-out tick at the top left of the answer you want to accept. Generally, this should be the answer which most helped you.This helps other users identify useful answers and is the local way of saying 'thank you' to people who've assisted you.
    – Mensch
    Apr 14, 2016 at 14:24
  • 4
    It might also be an idea to check the context of the symbols you want to use, \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 the mathtools package (it is an example of the \DeclarePairedDelimiter macro)
    – daleif
    Apr 14, 2016 at 14:41

2 Answers 2

7

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.

enter image description here

\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}
1
  • 1
    Great answer. Note to self: Don't forget the star!
    – PatrickT
    Jan 14 at 0:23
4

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.)

6
  • 1
    Please, no $$
    – egreg
    May 2, 2016 at 11:30
  • 2
    Usage of $$...$$ in LaTeX should be discouraged
    – egreg
    May 2, 2016 at 15:47
  • 1
    Thanks for answering, though i agree with egreg that `$$ should be avoided. So i am still holding back my upvote for a while :-)
    – Johannes_B
    May 2, 2016 at 16:25
  • 2
    @HaraldHanche-Olsen The usual reference to Why is \[ … \] preferable to $$? suffices
    – egreg
    May 2, 2016 at 19:42
  • 1
    Meta question: Often referenced questions
    – egreg
    May 2, 2016 at 20:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .