I'm creating a function (HInt) for a traditional output for integrates. For example:

HInt[f, x]

enter image description here

If I specify just the domain, like this:

HInt[f, {v, V}]

I have:

enter image description here

How to modify my function in order to obtain, the following result, if I specify the domain. In other words, how to set de ScriptCapital letters in my code.

enter image description here

Here is my code:


Examples to ilustrate:

HInt[f, {a, A}]
HInt[f, {s, S}]
HInt[f, {v, V}]
HInt[f, {g, G}]

enter image description here

enter image description here

enter image description here

enter image description here

  • 1
    $\begingroup$ I tried really hard to explain ToBoxes problem in an answer to your recent question. $\endgroup$
    – Kuba
    Jan 30, 2019 at 19:09
  • $\begingroup$ I will check... $\endgroup$
    – Mateus
    Jan 30, 2019 at 19:11
  • 1
    $\begingroup$ Does this question boils down to how to convert V to "\[ScriptCapitalV]"? $\endgroup$
    – Kuba
    Jan 30, 2019 at 20:04
  • $\begingroup$ How to implement \[ScriptCapital #] (where # can be any letter) in my code. This way every time that I put HInt[f, {#, #}] he gives de integrate output with the ScriptCapital. $\endgroup$
    – Mateus
    Jan 30, 2019 at 20:09
  • $\begingroup$ I don't get why do you say {#,#} if {v, V} has two different characters. What about characters that don't have script capital version? Please provide couple of examples of HInt[f, ...] and show what should be the final RowBox[...]. $\endgroup$
    – Kuba
    Jan 30, 2019 at 20:11

2 Answers 2


Since the question is not very precise I will focus on the core of the problem, namely how to convert n to "\[DoubleStruckN]"

ToDSChar // ClearAll
ToDSChar // Attributes = {HoldAll, Listable};

ToDSChar[n_Symbol] := ToDSChar[#] &@ToString[Unevaluated[n], InputForm]
ToDSChar[str_String] := Which[
  StringLength[str] != 1, str,
  97 <= ToCharacterCode[str][[1]] <= 122, "\\[DoubleStruck" <> ToUpperCase@str <> "]",
  65 <= ToCharacterCode[str][[1]] <= 90,   "\\[DoubleStruckCapital" <> str <> "]",
  True, str

ToDSChar[x : Except[_List]] := MakeBoxes[x]

RawBoxes /@ ToDSChar@{a, B, cd, 1, s, expr}

enter image description here


I believe this accomplishes what you want:

First we define the function sc (for Script):

sc[symb_] := 
Symbol[StringJoin["\\[Script", ToUpperCase@ToString[symb], "]"]], 
Symbol[StringJoin["\\[ScriptCapital", ToUpperCase@ToString[symb], 
"]"]], True, symb]

sc /@ {A, b, 1}

enter image description here

Then we define the function int:

int[integrand_, intVar_, lower_] := Integrate[integrand, {intVar, lower, ""}] // HoldForm


int[f, sc[a], sc[A]]

enter image description here

  • $\begingroup$ It will fail if A or b have values. $\endgroup$
    – Kuba
    Feb 3, 2019 at 20:53
  • $\begingroup$ @Kuba I didn't think it mattered, because it seems like he's only asking a typesetting question, and he's not trying to typeset values with DoubleStruck or Script. But I modified it to simply return a value, if given, rather than failing. $\endgroup$
    – theorist
    Feb 3, 2019 at 21:47

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.