# Integral | symbol format

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

What is needed

• \bigg\vert ? tex.stackexchange.com/a/38870/38080 Jun 30, 2020 at 10:14
• I'd also go with Rmanos suggestion. Using left/right constructions often ends up giving scaled fences that are overly large. Jun 30, 2020 at 10:23
• @JairoADelRio what is that \vphantom doing there? 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{...}{...} Jun 30, 2020 at 10:26
• @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} Jun 30, 2020 at 10:27

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}


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}


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}


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}


• 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 Jun 30, 2020 at 10:42
• @daleif In your image the limits are set lower and higher respectively. 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. Jun 30, 2020 at 12:03
• @daleif Now they're at the same height. Jun 30, 2020 at 12:13

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}


• IMO this seems unnecessary large. I chose \Big instead, mostly because if it far away from anything tall 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. Jun 30, 2020 at 10:44

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.

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

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

Better:
$$\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{document}