Following on from this question, I'd like to be able to do this but with an integral sign.

The proposed solution is the following:

   {\vcenter{\hbox{\huge A}}} 
   {\vcenter{\hbox{\Large A}}}{\mathrm{A}}{\mathrm{A}}}\displaylimits}

I tried to modify this for an integral sign:

    {\huge\int #1 \, d#2}
    {\Large\int #1 \, d#2}{\mathrm{A}}{\mathrm{A}}}\displaylimits}

Applying this via \integral{x}{x}_0^1 for instance then gives the following:

Example Integral

However, this centres the limits above and below the integral instead of where you want them at the left.

So my question is: how to align them in the right place? Also, what should I write instead of \mathrm{A} in the other two type modes that are shown above?



2 Answers 2


Easy but inflexible answer


And then you have to always use the command with the limits and in that order. So if you don't want limits you would need \integral{f(x)}{x}_{}^{}.

A better solution would be xparse, but I cannot try if it works correctly right now (if someone checks and it doesn't work I will remove it).

\NewDocumentCommand\integral{ m m e{_^} }{\integralaux{#1}{#2}#3}

With this second version, you can use with flexibility \integral{x}{x}, \integral{x}{x}_{a}, \integral{x}{x}^{a}, \integral{x}{x}_{a}^{b}, \integral{x}{x}^{a}_{b}.

Also, it's possible to do it with \@ifnextchar and classical LaTeX, and has already been done in this site.


You might do something like this, but note the name I gave to the new command.



\badint_0^1 f(x)\,dx \ne \int_0^1 f(x)\,dx
\badint_0^1 f(x)\,dx \ne \int_0^1 f(x)\,dx


I find the output really ugly.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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