6

When trying to type in this integral, the | symbol with the -1, 1 bounds at the end is too small. How would I make it bigger, to match the size of the integral symbol?

\int_{-1}^{1}8x^3-5x^2+4dx=\frac{8}{4}x^4-\frac{5}{3}x^3+4x\big|_{-1}^{1}

The issue

enter image description here

What is needed

enter image description here

6
  • 2
    \bigg\vert ? tex.stackexchange.com/a/38870/38080
    – Rmano
    Jun 30, 2020 at 10:14
  • 1
    I'd also go with Rmanos suggestion. Using left/right constructions often ends up giving scaled fences that are overly large.
    – daleif
    Jun 30, 2020 at 10:23
  • 1
    @JairoADelRio what is that \vphantom doing there?
    – daleif
    Jun 30, 2020 at 10:23
  • Also do remember that the code you provide is actually mathematically wrong (the evaluations as the end are in the wrong order), the image of what you wanted is correct. BTW the smaller fractions in the "needed" image can be made using \tfrac{...}{...}
    – daleif
    Jun 30, 2020 at 10:26
  • 2
    @JairoADelRio and if you want to use \left - \right you should apply it to the second term: ... = \left. \frac{8}{4}x^4-\frac{5}{3}x^3+4\right\rvert_{1}^{-1}
    – Rmano
    Jun 30, 2020 at 10:27

4 Answers 4

9

In this case I'd just use \Big|_{-1}^{1}.

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\[
\int_{-1}^{1}8x^3-5x^2+4dx=\tfrac{8}{4}x^4-\tfrac{5}{3}x^3+4x\Big|_{-1}^{1}
\]
\end{document}

enter image description here

And here is why I don't recommend using anything similar to \left. \int_{-1}^{1}....\right|_{-1}^{1} as then the | with limits is actually taller than the integral which is unnecessary

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\[
\left.\int_{-1}^{1}\right|_{1}^{-1} 
\]
\end{document}

enter image description here

5

I'm not a fan of this notation, because it doesn't make clear what the evaluation should apply to.

\documentclass{article}
\usepackage{amsmath}

\newcommand{\evalint}{%
  \left.\kern-\nulldelimiterspace
  \vphantom{\int}\right|%
}

\begin{document}

\[
\int_{-1}^{1}(8x^3-5x^2+4)\,dx=
\frac{8}{4}x^4-\frac{5}{3}x^3+4x\evalint_{-1}^{1}
\]

$
\int_{-1}^{1}(8x^3-5x^2+4)\,dx=
\frac{8}{4}x^4-\frac{5}{3}x^3+4x\evalint_{-1}^{1}
$

\end{document}

enter image description here

A different implementation that guarantees the limits to be (quite accurately, although not completely exact) at the same height as in the integral.

\documentclass{article}
\usepackage{amsmath}
\usepackage{xparse}

\makeatletter
\NewDocumentCommand{\evalint}{e{_^}}{%
  \mathpalette\eval@int{{#1}{#2}}%
}
\newcommand{\eval@int}[2]{\eval@@int#1#2}
\newcommand{\eval@@int}[3]{%
  \ifx#1\displaystyle\eval@@@int{#2}{#3}\else
    \ifx#1\textstyle\big|_{#2}^{#3}\else
      \vert_{#2}^{#3}\fi\fi
}

\newcommand{\eval@@@int}[2]{%
  \left.\kern-\nulldelimiterspace
  \sbox0{$\displaystyle\int_{#1}^{#2}$}\global\dimen1=\dimexpr\ht0+\dp0\relax
  \vphantom{\int}%
  \right|\!
  \vcenter to\dimen1{\hbox{$\scriptstyle#2$}\vfill\hbox{$\scriptstyle#1$}}%
}
\makeatother

\begin{document}

\[
\int_{-1}^{1}(8x^3-5x^2+4)\,dx=
\frac{8}{4}x^4-\frac{5}{3}x^3+4x\evalint_{-1}^{1}
\]

$
\int_{-1}^{1}(8x^3-5x^2+4)\,dx=
\frac{8}{4}x^4-\frac{5}{3}x^3+4x\evalint_{-1}^{1}
$

\end{document}

enter image description here

4
  • Compare with the last image in my answer. Is there any reason to have the limits on the evaluation sitting higher than on the integral
    – daleif
    Jun 30, 2020 at 10:42
  • @daleif In your image the limits are set lower and higher respectively.
    – egreg
    Jun 30, 2020 at 11:57
  • yes they are even worse there, in your example here are also placed higher an lower than on the integral and thus getting unnecessary large.
    – daleif
    Jun 30, 2020 at 12:03
  • 1
    @daleif Now they're at the same height.
    – egreg
    Jun 30, 2020 at 12:13
4

With \Big as @daleif suggested, or \bigg, and some cosmetic improvements: a correctly spaced upright d, and medium-sized fractions for numerical coefficients:

\documentclass[ a4paper]{article}
\usepackage{nccmath}

\newcommand*{\dd}{\mathop{}\!\mathrm{d}}

\begin{document}

\[ \int_{-1}^{1}(8x^3-5x^2+4)\dd x =\mfrac{8}{4}x^4-\mfrac{5}{3}x^3+4x\bigg|_{1}^{-1} \]

\[ \int_{-1}^{1}(8x^3-5x^2+4)\dd x =\mfrac{8}{4}x^4-\mfrac{5}{3}x^3+4x\Big|_{1}^{-1} \]

\end{document} 

enter image description here

2
  • IMO this seems unnecessary large. I chose \Big instead, mostly because if it far away from anything tall
    – daleif
    Jun 30, 2020 at 10:40
  • @daleif: I also tested this one, and found it was a bit too small (probably an optical effect due to the integral with bounds on the other side). I'll add it to let the O.P. compare and choose.
    – Bernard
    Jun 30, 2020 at 10:44
2

This is easy with the physics package and its \eval function. Here are two versions, one without all the brackets (using \eval{}) and the second with some nice brackets which makes better mathematical sense (using \eval[|) and also \dd{} for a proper typesetting of the "dx" term.

enter image description here

\documentclass{article}
\usepackage{amsmath}
\usepackage{physics}

\begin{document}
Okay:
\begin{equation}
\int_{-1}^{1}8x^3-5x^2+4dx = \eval{\frac{8}{4}x^4-\frac{5}{3}x^3+4x}_{-1}^{1}
\end{equation}

Better:
\begin{equation}
\int_{-1}^{1}(8x^3-5x^2+4)\dd{x} = \eval[\frac{8}{4}x^4-\frac{5}{3}x^3+4|_{-1}^{1} 
\end{equation}
\end{document}

You must log in to answer this question.

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