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}$$
  • 4
    You might want to rephrase your question, I have no clue what it is you're asking – daleif Apr 14 '16 at 13:57
  • @daleif I wanna the signal \midbut biggest. How I make this? What are the sizes that I can choose? – Carmen González Apr 14 '16 at 14:00
  • 5
    What is signal in this context? Please provide an example – daleif Apr 14 '16 at 14:05
  • @daleif $$\mid\frac{\partial I}{\partial M}\mid = \frac{T^2 dg}{4\pi^2}$$in this context I wanna the \mid biggest to the partial derivation fit here. – Carmen González Apr 14 '16 at 14:06
  • 2
    Is $$\left|\frac{\partial I}{\partial M}\right| = \frac{T^2 dg}{4\pi^2}$$ a solution to your question? – Harald Hanche-Olsen Apr 14 '16 at 14:24
  • 2
    Check question http://meta.tex.stackexchange.com/questions/228/ive-just-been-asked-to-write-a-minimal-example-what-is-that 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 '16 at 14:24
  • @HaraldHanche-Olsen Thanks for help. Now it's working :) – Carmen González Apr 14 '16 at 14:35
  • 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 '16 at 14:41
  • 1
    Don't use $$ for display maths if you are using LaTeX unless your system is at least 20 years out of date. – cfr Apr 14 '16 at 23:31
  • @HaraldHanche-Olsen You might as well post that as an answer :-) – Johannes_B May 01 '16 at 16:51
  • I did some fairly heavy editing of the question. I hope it did preserve the meaning. – Harald Hanche-Olsen May 02 '16 at 10:14
  • @Johannes_B Okay, done. – Harald Hanche-Olsen May 02 '16 at 10:14

2 Answers2

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}

Mico
  • 506,678
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.)