Introduction  This question is already asked . If you want you could consider this one a duplicate. However, even if the proposed solution satisfied the one that posted the question, it doesn't completely satisfy me (and this is the reason for this duplicated question).  My aim is to declare a new operator for the expected value that behave like the summation symbol. The proposed solution is to declare it with \DeclareMathOperator*{}{} command (note the presence of the asterisk). This solution satisfies the feature of \sum like operators that put superscripts and subscripts in a different way depending on the current math mode. However, in \sum like operators, the size of the symbol itself change accordingly to the current math mode.  In the following a visual example that shows the difference between \sum and the new math operator.    And this is the code to generate it:  \documentclass{article} \usepackage[utf8]{inputenc} \usepackage{amsmath} \usepackage{amssymb} \DeclareMathOperator*{\expec}{\mathbb{E}}  \begin{document} $\sum_a x_a$ vs $\displaystyle \sum_a x_a$ ~~~ $\expec_a x_a$ vs $\displaystyle \expec_a x_a$ \end{document}   Real question  How could I define the new operator in order to scale it differently based on the current math mode?  Bonus question: I'm interested only in scaling the symbol. However, in some cases, one may want to use a different symbol (I'm thinking about the \int command, that in a lot of fonts use two different symbols for inline and display math). So, a solution that takes into account also this feature would be appreciated.    Of course, it could be that I miss something really obvious like that already exist a math operator for the expected value. In this case, I will appreciate if you notify me. However, the question remains valid for other new defined operators.
4229
I would like to create a new "big operator", by which I mean something like the Σ character used for summations.     I know about the \DeclareMathOperator* command, which creates an operator whose superscripts and subscripts are written directly above and below the operator. Here is an example of that.  \documentclass{article} \usepackage{amsmath} \usepackage{amsfonts} \DeclareMathOperator*{\foo}{\maltese}  \begin{document} \[ \foo_{i=3}^{6}(f^2(i)) \] \end{document}     However, I would like to make my operator "big". I tried this:  \DeclareMathOperator*{\foo}{\text{\Large $\maltese$}}     but that feels like a bit of a hack. Besides, the operator is too high, and needs moving down a tad to align it properly with its operand. So, what's the proper way to do this? How, for instance, is the \sum operator defined?
6575
Why does the addition of a \left and \right introduces an extra space around the formula? Specifically, why do $\cos(\theta)$ and $\cos\left(\theta\right)$ render differently?  Is there a way to use resizable delimiters without introducing the spurious spaces?  Why did Knuth design it like this?  Edit: This occurs too, if \operatorname{MYOP} or some other operator, like \lim, \min etc. is used. (This edit is basically to make it easier to find this answer.)
82015
I have an equation contained inside \[...\], which automatically makes a \sum with sub- and superscripts turn big--so that the summation sign looks awkward inside parenthesis.  Any idea how to make the parenthesis completely enclose the whole summation?  \documentclass{article} \begin{document} We have: \[ \sum_{i=1}^n i = (\sum_{i=1}^{n-1} i) + n = \frac{(n-1)(n)}{2} + n = \frac{n(n+1)}{2} \] \end{document}
7830
I would like to put some text in math mode below a mathematical operator (or a symbol), similar to \substack in \sum, as the red text below the \max operator in the following image  How to do this?
28119
What is the "best LaTeX practices" for writing absolute value symbols?  Are there any packages which provide good methods?  Some options include |x| and \mid x \mid, but I'm not sure which is best...
15837
Knuth hid a special rule for delimited arguments in exercise 20.5 of the TeXbook.     If the very last character of the   parameter text is #, so that this #   is immediately followed by {, TeX   will behave as if the { had been   inserted at the right end of both the   parameter text and the replacement   text.   This means that a macro can be defined as,  \def\a#1#{#1}   calling it as \a 10 will give a runaway argument error whereas calling it as \a{12}, will compile with no trouble.  I struggled to find a practical application for such macros even after looking at TeX by Topic, TeXbook and LaTeX source.   Here is my take on it, create some commands to typeset and do some calculations for fractions, as for example those found in basic arithmetic texbooks. You type this,  \[\FRAC ADD{3}{8}+{1}{7}\] \[\FRAC SUB{5}{8}-{1}{7}\] \[\FRAC MUL{5}{8}x{13}{1201}\]   and you get this:    Here is the code,  \documentclass{article}  \begin{document} %% macro factory \def\FRAC#1#{\csname #1\endcsname} %% add \def\ADD#1#2+#3#4{%   \frac{#1}{#2}+\frac{#3}{#4}=   \frac{\the\numexpr(#4*#1)+(#3*#2)}{\the\numexpr#2*#4} } %% subtract \def\SUB#1#2-#3#4{%ok top   \frac{#1}{#2}-\frac{#3}{#4}=   \frac{\the\numexpr(#4*#1)-(#3*#2)}{\the\numexpr(#2*#4)} } %% multiply \def\MUL#1#2x#3#4{%   \frac{#1}{#2}\times\frac{#3}{#4}=   \frac{\the\numexpr(#1*#3)}   {\the\numexpr#2*#4} } %% testing \[\FRAC ADD{3}{8}+{1}{7}\] \[\FRAC SUB{5}{8}-{1}{7}\] \[\FRAC MUL{5}{8}x{13}{1201}\] \end{document}   Are there any practical applications for such macros? Are there any special precautions one should take? Why would Knuth include this facility in the first place?
1731
Consider this question:    Unfortunately, the question title is displayed on SO as:     is `x— > 0 &amp;&amp; array[x]` well defined behavior in c++?   There are two issues here:   Less severe, the backticks are displayed verbatim and don’t delimit a code span. Not very nice but bearable. On the other hand, MathOverflow has this really nice math mode even in titles – why not also introduce this on SO for code? The -- operator is transformed into an em-dash. This is slightly misleading and simply unnecessary. I am all in favour of using SmartyPants (or whatever SO uses) to glam up the question title typography. But this shouldn’t go at the cost of correctness.   So I suggest allowing limited Markdown in titles (e.g. as in comments?) or at least fixing the formatting bug.
77675
Although many have attempted to explain the difference among \mathrm, \textrm, \textnormal and \text (and others?), I found them misleading.  See for example the LaTeX's Wiki \mathrm explanation   Why is it wrong? Let's try all of them within an article and a beamer and you'll see the difference and, therefore, error.  equation.tex  \begin{eqnarray*}   \int_1^9\! \cos{x} \,\mathrm{d}x &amp; &amp; \textrm{this is textrm}\   \sum_1^9 y                       &amp; &amp; \textsf{this is textsf}\   \prod_1^9 z                      &amp; &amp; \textnormal{this is textnormal}\   \bigcup_1^9 w                    &amp; &amp; \text{and this is just text} \end{eqnarray*}   article.tex  \documentclass{article} \usepackage{amsmath} \usepackage{amsfonts} \usepackage{amssymb}  \begin{document}   \input {equation} \end{document}     And until here everything looks fine...  beamer.tex  \documentclass{beamer} \usepackage{amsmath} \usepackage{amsfonts} \usepackage{amssymb}  \begin{document}   \begin{frame}     \input{equation}   \end{frame} \end{document}     And here we can clearly see that \mathrm does not behave as expected, i.e. does not provide a function aspect to the d. Does anyone know what am I supposed to use here instead? Just \text?? o.O  Moreover, I cannot see any difference between \textnormal and \text.  Finally, \textrm looks useless..
48745
I'm reading the textbook Stochastic Calculus for Finance: Volume I by Steven Shreve, and on page 101 (incase somebody has it on hand) I am unsure of the notation.  There is a I where the top and bottom horizontal lines are connected by two vertical lines, instead of just one.  There is then a subscript saying {τ&lt;=N}, denoting that this mystery operator applies to all tau less than or equal to N.    The I looks very similar to the E meaning expectation and P meaning probability measure, in that there is a doplication of vertical lines to make the letter look hollow.  What is this mystery operator?
46973
A solution I saw somewhere suggested to use   \usepackage{bbold} $\mathbb{1}$   which works well and I get what I want. However, now other symbols used to represent real numbers, natural numbers, etc look ugly.    I'd like them to look (without using bbold)    I'd like to only use that package to achieve that strange double one. Is there any way I can do that?
64085
After browsing through related threads, I am now of the understanding (please correct me if I am wrong) that the rule of thumb is to use the \bigl,\bigr pair with brackets, parentheses, etc. for operators like sums, products, and integrals, and \left,\right in all other cases.  I only recently found out about \middle , which has solved what had been a vexing problem for me: delimiters for function arguments (slashes, bars) not scaling properly. Leafing through my cheatsheet has not been of much help, so I wish to ask: is there an equivalent of \middle for \bigl and \bigr, or would the use of \middle along with that pair not be gauche?
76023
On  I've noticed a strange problem with nested \tilde and \breve commands, when amsmath is used.  In this code the X appears also in the output of the second and the third formula:  \documentclass{article} \usepackage{amsmath} \begin{document} \[ \breve{\tilde{X}} \] \[ \breve{\breve{{T}}\breve{{v}}} \] \[ \tilde{{\tilde{T}}{\tilde{v}}} \] \end{document}     If I don't load amsmath, the code works fine. This seems to be a bug in amsmath. How can it be solved?
91089
I remember reading a while back about arithmetics with only a single operator that did all the work of the familiar $+ - \times /$ operators. If there is such a thing, could someone point me to it?  As background: I have a side project where I'm playing with neural nets and genetic search algorithms. Right now it's the good old kind, with matrix multiplication and addition. I thought it would be interesting to implement a sort of neural network that used a combined or "all in one" operator.  I've googled like heck and can't pick up the trail of where I thought I saw that before.  Is there study in that area, or am I mis-remembering, or worse, just making it up? I'd appreciate any pointers.
118876
I wanted to make a command that outputs a number in math mode. This is how my file looks like:  \documentclass{scrartcl}  %\usepackage{epsdice} %\newcommand{dice}[1]{\epsdice{#1}}  \newcommand{dice}[1]{\ensuremath{#1}}  \begin{document} Lorem ipsum... \end{document}   But when I compile this with XeTeX, I always get this error:  ! LaTeX Error: Missing \begin{document}.  See the LaTeX manual or LaTeX Companion for explanation. Type  H &lt;return&gt;  for immediate help.  ...                                                l.13 \newcommand{dice}[1]{\ensuremath{#1}}   I have not that much experience with TeX, I think the solution is quite easy.
5061
Okay, so $\displaystyle \frac{d}{dx} |x| = \frac{|x|}{x}$. But I have trouble seeing why.  Here's what I've tried: $$\frac{d}{dx}|x|=\begin{cases} \frac{d}{dx}x &amp; \text{if }x &gt; 0 \\ \frac{d}{dx}(-x)&amp;\text{if }x &lt; 0 \end{cases} = \begin{cases} \,\,\,\,1 &amp; \text{if }x &gt; 0 \\ -1&amp;\text{if }x &lt; 0 \end{cases}$$ But I do not see how that far-right expression can be used to arrive at $\displaystyle\frac{|x|}{x}$, besides graphing.
57977
I'm using Emacs with AUCTeX to do all my LaTeX. When it comes to syntax highlighting it seems that all mathematics is by default just orange. Do you know of a mode or package that adds some more fine grained syntax highlighting? For example all commands (\foo), matching braces, sub- and superscripts, etc. should get a different color.
103660
We know that the multiplicative operator is construct by iterating the additive one, and the power operator is construct by iterating the multiplicative one.   Which makes us wonder if we can construct a decent operator, lets name it $\triangle$ (triangle) so that the addition would be an iteration of triangle, i.e. $$\underbrace{a\triangle \cdots \triangle a}_{n \text{ times}}=a+n.$$  May be such a construction would have to take place in $\mathbb R\cup \{-\infty\}$, so that $-\infty$ could be the identity element for $\triangle$. May be not.  May be one can use the natural logarithme or the exponential which can upgrade or downgrade an operator in some way.  Anyway, i just want to know any ideas you may have about that kind of operator.