Recently I have been doing a lot of double and triple integrals. To my disappointment, MMA does not have built-in integral signs for those advanced or special integrals. Fortunately, I have found out a way to introduce those integral signs from Unicode. In MMA, it can be introduced by typing the "\:unicode"of the integral sign.

But a new problem emerged after the introduction: when converting expressions containing my self-introduced integral sign with a fractional integrand after it into Latex code, MMA will multiply the integral sign into the numerator of the integrand.

For example, I have this expression input in my note book:

FontSize->24], \(1 <= 
\*SuperscriptBox[\(x\), \(2\)] + 
\*SuperscriptBox[\(y\), \(2\)] <= 4\)]\) Sin[\[Pi] Sqrt[
   x^2 + y^2]]/Sqrt[x^2 + y^2] \[DifferentialD]x \[DifferentialD]y

which looks like :

enter image description here

However, what the latex code MMA made for this expression displays is:

$$ \frac{\iint\limits_{1\leq x^2+y^2\leq 4}\sin \left(\pi \sqrt{x^2+y^2}\right)\mathrm{d}x\mathrm{d}y}{\sqrt{x^2+y^2}} $$

where apparently MMA regards my self-introduced integral sign as an ordinary term which can be multiplied into the numerator. But unfortunately, it can't. By doing so the meaning and value of the expression has totally changed from the correct one.

Moreover, I have noticed that, for built-in integral signs, MMA will interpret the integral expression properly and will not multiply the integral sign in to the numerator, which shows there must be some way to pull it off.

I already know that to convert an expression into its TexForm, Mathematica will work on its Box representation of its traditional form. As a result, I was wondering, how I can prevent my self-introduced integral sign being multiplied into the numerator of the integrand when converting the whole expression into latex code.

To be clear: I do not want to rearrange the boxes by hand/by sight each time I need to do this kind of conversion. Because there can be a ton of integrals of this kind in a notebook of mine. What I need is a way to automate the process, like a function associated with MakeBoxes[] so that every time I do the conversion, MMA can automatically recognize it is an integral sign with a fractional integrand, consequentially the integral sign can not be multiplied into the numerator.

  • 1
    $\begingroup$ Perhaps the Notation package can help? $\endgroup$
    – Michael E2
    Commented Apr 8, 2022 at 17:15
  • $\begingroup$ @MichaelE2, Thanks Michael, I have read the tutorial of notation package carefully and did find it helpful to tackle my issue. Although merely depending on it cannot solve the problem completely, but it offers an important step stone leading to the ultimate solution of the problem. $\endgroup$
    – AlbertLew
    Commented Apr 12, 2022 at 12:57

1 Answer 1


I am not sure if the problem at hand lends itself to a lightweight solution, since Mathematica can not interpret the given expression as an integral and as such I doubt it can generate meaningful TeX Strings for it. That being said here is a solution using a custom regionInt method I wrote which currently has two main functions: render a nice expression of itself in StandartForm and generate a meaningful TeXForm using the TeXUtilities (github.com/jkuczm/MathematicaTeXUtilities), which I found almost a must when trying to do any in depth work on TeXForm.


  dd=StringJoin["\\mathrm{d} "<>ToString[#,TeXForm]&/@args];


Which when evaluating

regionInt[Sin[\[Pi] Sqrt[x^2+y^2]]/Sqrt[x^2+y^2],{x,y},{1<=x^2+y^2<=4}]



which renders as

$$\iint\limits_{\substack{1\leq x^2+y^2\leq 4}}\frac{\sin \left(\pi \sqrt{x^2+y^2}\right)}{\sqrt{x^2+y^2}}\mathrm{d}x\mathrm{d} y$$

The downside of this solution is that it is currently not possible to generate this by a StandartForm/DisplayForm user input which -- depending on the workflow or use case -- might be a quite severe downside. If one intents any computation/manipulation of such expressions in Mathematica I prefer using solutions like this on InputForm/FullForm level with a custom output routine to render pleasing StandartForm outputs.

  • $\begingroup$ Thanks @N0va. I have read your code carefully and did find it revelatory and helpful to form my solution. A major difference between us is that I am only used to inputting by the function name for integrals whose value can be worked out by the very function, like Integrate[]. For special integrals whose value cannot be returned by the function directly, I always input by a StandardForm/DisplayForm user input and want to have the correct latex code of them generated, both of which plays its role completely on symbolizing and representing the integral rather than giving me its value. $\endgroup$
    – AlbertLew
    Commented Apr 12, 2022 at 13:21
  • $\begingroup$ As a result, what I have done first was to grapple with the "severe downside" described by you in your solution. And it surely can be solved nicely. It is smart of you to have defined a function regionInt[], which amounts to have established an internal representation of the special integral, while the essence of the StandardForm/DispalyForm user input is an external representation of the same integral. So, to make the latter work we only need to set up a connection between the two. That can be realized by the function Notation[A=>B] in the Notation package. $\endgroup$
    – AlbertLew
    Commented Apr 12, 2022 at 13:33
  • $\begingroup$ But be careful since notation defining can be tricky, you are strongly recommended to do so by the notation palette launched by << Notation``. Moreover, the StandardForm/DispalyForm` user input is more ambiguous for MMA to recognize than directly Function name input, so I recommend use the BlankSequence(__) of double blanks to represent the integrand. When I was trying to use the single blanks like expr_, sometimes MMA fails to recognize the integral's StandardForm/DispalyForm user input due to its potential ambiguity. $\endgroup$
    – AlbertLew
    Commented Apr 12, 2022 at 13:47
  • $\begingroup$ For the TeX code generation part, TeXUtilities is not very helpful to me because of my habit of generating such code in MMA. My solution is to write a function to well define the box structure for the TraditionalForm of the special integral you have defined, which is similar to your definition of a function making boxes for its StandardForm. Since what MMA's TeX code is generated from the TraditionalForm box structure of the expr, once that has been well defined, satisfying TeX code can be basically generated from already built-in TeX rules in MMA. $\endgroup$
    – AlbertLew
    Commented Apr 12, 2022 at 14:01
  • 1
    $\begingroup$ /;BoxFormUseIcons` prevents the generation of the custom StandartForm when looking up the documentation (using e.g. Information or ?). For details see my question and answers: mathematica.stackexchange.com/a/231387/42436 $\endgroup$
    – N0va
    Commented Apr 12, 2022 at 14:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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