# Integration brackets are not tall enough

Consider the following latex code:

V = \int_0^2(4-x^2)dx = 4\int_0^2dx - \int_0^2x^2dx
= 4\left[x\right]_0^2 - \left[\frac{x^3}{3}\right]_0^2


Notice how the first pair of brackets renderd by 4\left[x\right]_0^2 are not tall enough. It doesn't look good at all.

Is there a way to make the formula more aestethically pleasing? I would like if the integration brakets always had the same height as the integral sign.

To see why I'm asking for taller brackets, see the screenshot below. The subscript and superscript are much to close together vertically:

• if you want to have equally large brackets, use 4\left[\vphantom{\frac{x^3}{3}}x\right]_0^2 instead of 4\left[x\right]_0^2 – user121799 Mar 27 '17 at 19:20
• The size you want probably depends on the font you are using, but you can certainly set it yourself using \bigl[ ... \bigr], or \Bigl, \biggl, etc. – Ian Thompson Mar 27 '17 at 19:21
• \biggr seem to be the right size. But it seems kind of lame having to write that. Because if I change the font I would have to go back and correct it everywhere. – Björn Lindqvist Mar 27 '17 at 19:29
• You shouldn't be using \left and \right to auto-size the square brackets. Note that the sizing of brackets, and "math fences" in general, is much broader than the title of your posting implies. See the postings Is it ever bad to use \left and \right? and “(” or “\left(” parentheses? for discussions of why the unthinking use of \left and \right can deliver suboptimal results. Do learn how to use manual sizing commands -- \big, \Big, \bigg, and \Bigg -- appropriately. – Mico Mar 31 '17 at 14:49

You shouldn't be using \left and \right to begin with. Instead, I suggest you use \bigl[ and \bigr] for both terms, as follows:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
$V = \int_0^2(4-x^2)\,dx = 4\int_0^2\!dx - \int_0^2\!x^2\,dx = 4\bigl[x\bigr]_0^2 - \bigl[\tfrac{1}{3}x^3\bigr]_0^2$
\end{document}


Addendum: It may be instructive to compare and contrast four different ways of typesetting the evaluated integrand, as is done in the middle four rows of the following screenshot. IMNSHO, the \bigg-sized square brackets are needlessly large; in fact, they dominate visually to an extent that the material they enclose is dwarfed and overwhelmed by the square brackets themselves. A much better typographic balance is struck by the \big-sized square brackets; cf the next-to-last row in the screenshot. Of the two solutions that use a single vertical bar, I'd say the \Big-sized solution is far better than the \bigg-sized solution. Put differently, I see absolutely no (typographic) reason for why the brackets (or bars) should be as tall as the integral symbols.

\documentclass{article}
\usepackage{amsmath} % for 'align*' environment and \tag* macro
\begin{document}
\begin{align*}
V &= \int_0^2(4-x^2)\,dx = 4\int_0^2\!dx - \int_0^2\!x^2\,dx \\[1ex]
&= 4\biggl[x\biggr]_0^2 - \biggl[\frac{1}{3}x^3\biggr]_0^2
\tag*{pair of \texttt{bigg} square brackets}\\[2ex]
&= 4 x\biggr\rvert_0^2 - \frac{1}{3} x^3\biggr\rvert_0^2
\tag*{single \texttt{bigg} vertical bar}\\[2ex]
&= 4 x\Bigr\rvert_0^2 - \tfrac{1}{3} x^3\Bigr\rvert_0^2
\tag*{single \texttt{Big} vertical bar}\\[2ex]
&= 4\bigl[x\bigr]_0^2 - \tfrac{1}{3}\bigl[x^3\bigr]_0^2
\tag*{pair of \texttt{big} square brackets}\\[1ex]
&= 4(2-0)-\tfrac{1}{3}(8-0)=\tfrac{1}{3}(24-8)=16/3.
\end{align*}
\end{document}


Second addendum, prompted by a follow-up comment by the OP that if "a bracket pair appears in math-mode, [and if the] closing bracket [is followed by] both superscript and subscript [terms], then it should be automatically rendered using the big brackets style."

It would be a lot of work, to put it politely, to program pdfLaTeX to automatically recognize all instances of [ ... ] _ {...} ^ {...} in a document and to process them according to your preferences. Your objective may be achieved more easily, though, if you can run LuaLaTeX: One would simply set up a Lua function that makes use of Lua's powerful string-handling functions. (The main syntactic convention is that the subscript and superscript terms must be encased in curly braces. The subscript and superscript terms may be empty, i.e, [x]_{}^{} will be recognized by the Lua function and processed correctly.) The Lua function is assigned to a certain Lua callback that makes it act like a pre-processor on the input. That way, TeX itself never "sees" the original code from the input file; instead will only see something that contains \biggl[ and \biggr] directives.

That said, I think you'd be even better off setting up a dedicated LaTeX macro called, say, \inteval, and to edit the math material to make use of this macro. A nice aspect of this approach is that while the default size of the square brackets would be "\bigg, one could provide an option to override the default and to specify a size of\big,\Big, or\Bigg. Both possibilities are examined in the following screenshot and associated code. Whichever way you pursue, I recommend you add a bit of whitespace padding inside the enclosing square bracket and to snug up the sub- and superscript terms to the right-hand square bracket.

% !TeX program = lualatex
\documentclass{article}
%% LaTeX macro called "\inteval
\newcommand\inteval[4][bigg]{%
\csname #1l\endcsname [ \mkern1.5mu #2 \mkern1.5mu%
\csname #1r\endcsname]_{\mkern-2mu#3}^{\mkern-2mu#4}%
}
\usepackage{amsmath} % for 'align*' environment

\usepackage{luacode}
%% Lua-side code: Set up a Lua function called 'int_eval'
\begin{luacode}
function int_eval ( s )
return ( string.gsub ( s ,
"(%b[])%s-_%s-(%b{})%s-%^%s-(%b{})" ,
function ( a, b, c)
a = "\\biggl[\\mkern1.5mu" .. string.sub(a,2,-2)
.. "\\mkern1.5mu\\biggr]"
b = "_{\\mkern-2mu" .. string.sub(b,2,-2) .. "}"
c = "^{\\mkern-2mu" .. string.sub(c,2,-2) .. "}"
return (a..b..c)
end ) )
end
\end{luacode}
%% TeX-side code: Assign the Lua function to the 'process_input_buffer'
%% callback to make it operate like a preprocessor on the entire input.
"process_input_buffer", int_eval , "int_eval" )}}

\begin{document}
\begin{align*}
\int_0^2\!(4-x^2)\,dx
&= 4[x]_{0}^{1} - [\frac{x^3}{3}] _ {0} ^ {2} \\[1ex]
&= 4\inteval{x}{0}{2} - \inteval{\frac{x^3}{3}}{0}{2}
= 4\inteval[big]{x}{0}{2} % note use of "big" option
- \inteval{\frac{x^3}{3}}{0}{2} \\[2ex]
\int_0^X \!\!\frac{1}{3+t}\,dt
&= [\ln(3+t)] _{0} ^ {X} \\[1ex]
&= \inteval{\ln(3+t)}{0}{X} % no optional sizing argument
= \inteval[Big]{\ln(3+t)}{0}{X} % note use of "Big" option
\end{align*}
\end{document}

• Perhaps I'm using the wrong font, 10pt, because bigl isn't big enough. – Björn Lindqvist Mar 28 '17 at 11:23
• @BjörnLindqvist - Not sure I understand your comment. Both the answers shown above use 10pt as well. Please clarify what you mean by "not big enough". – Mico Mar 28 '17 at 20:41
• In your image, the integration brackets aren't as tall as the integration signs. – Björn Lindqvist Mar 29 '17 at 7:59
• @BjörnLindqvist - That's entirely by design: I can see no good typographic reason for why the square brackets should be as tall as the display-style integral symbols. If I made the brackets as tall as the integral symbols, there would be a very real risk of the material that's encased by the square brackets disappearing, visually speaking. Successful typography is, in large part, about creating visual balance: No one element should dominate the other. In my view, the output of \tfrac{1}{3}\bigl[x^3\bigr]_0^2 is easier to scan visually than is that of \biggl[ \frac{x^3}{3}\biggr]_0^2. – Mico Mar 29 '17 at 8:20
• @BjörnLindqvist - I've updated my answer to show the output of four different ways to display the evaluated forms of the integrands. Hopefully, having four different solution to compare will make it (more) obvious that there's no reason to believe that that the pairs of square brackets (or the single vertical bars) should be as tall as the integral symbols. :-) – Mico Mar 30 '17 at 14:12

The simplest and tightest is probably to use a bmatrix environment instead:

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{alignat*}{2}
V = \int_0^2(4-x^2)\,\mathrm d x &= 4\int_0^2dx - \int_0^2x^2\,\mathrm d x
& & = 4\bigl[x\bigr]_0^2 - \begin{bmatrix}\dfrac{x^3}{3}\end{bmatrix}_0^2 \\%
\text{ or simply} & & & = \begin{bmatrix}4x-\dfrac{x^3}{3}\end{bmatrix}_0^2
\end{alignat*}

\end{document}


• I think the OP's complaint is that the square brackets in 4\left[x\right]_0^2` aren't as tall as those in the subsequent term. – Mico Mar 27 '17 at 20:05
• Oh! Maybe I misunderstood. But the second pair of brackets wasn't tall enough, for me. I'll update my answer. – Bernard Mar 27 '17 at 20:10