TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The calculation of the correct parentheses size fails when a letter with a \hat accent is in between:


Manually specifying the size of the brackets would be a lot of work as they are part of a command (statistics: expected value):


Is there a way to modify the command to produce correctly-sized brackets?

Meta: Is there a way to have LaTeX code converted to images? Maybe it's that obvious that the help page do not mention it ...

share|improve this question
What do you mean by correctly sized? – Ian Thompson Mar 4 '12 at 14:09
For direct conversion to images the standalone package together with convert from Imagemagick is very handy. – zeroth Mar 4 '12 at 14:10
What does the question at the end have to do with the main question? I strongly suggest that you do some minimal amount of research before asking this tacked-on question. – qubyte Mar 4 '12 at 14:15
@MarkS.Everitt: I suspect the OP, coming from another stackexchange site, expected TeX code to automatically be rendered using MathJax (as on other sites). Mirko, on TeX.sx, we are mostly interested by the code, hence rendering is disabled: follow zeroth's suggestions to produce an image (but you would need more reputation anyways to post it, so for this question, don't worry). – Bruno Le Floch Mar 4 '12 at 18:31
@BrunoLeFloch: Ah, I misinterpreted completely then. My apologies to Mirko. – qubyte Mar 5 '12 at 4:49
up vote 7 down vote accepted

This is another case showing that automatic resizing with \left and \right should be used with care. It gives unwanted spaces in some cases and wrong results in others like this.

The best thing I can suggest you is to avoid \left and \right for this command or at least to use the facilities offered by mathtools.

For example, you could define



so that






will give the following result (\left and \right are applied only when the you call \E* instead of \E):

enter image description here

One can also specify explicit size of the brackets with an optional argument:


will produce slightly bigger brackets than $\E{A}$.

share|improve this answer
Thanks for pointing me to the \smash[t] command, that's what I was looking for. – Mirko Vogel Mar 5 '12 at 11:28

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.