# Creating a function for a traditional output for integrates

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

HInt[f, x]


If I specify just the domain, like this:

HInt[f, {v, V}]


I have:

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.

Here is my code:

HInt/:MakeBoxes[HInt[f_,x_],StandardForm]:=RowBox[{"\[Integral]",ToBoxes[f],"\[DoubleStruckD]",ToBoxes[x]}]
HInt/:MakeBoxes[HInt[f_,{x_,x1_}],StandardForm]:=RowBox[{SubscriptBox["\[Integral]",ToBoxes[x1]],ToBoxes[f],"\[DoubleStruckD]",ToBoxes[x]}]


Examples to ilustrate:

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


• I tried really hard to explain ToBoxes problem in an answer to your recent question. – Kuba Jan 30 '19 at 19:09
• I will check... – Mateus Jan 30 '19 at 19:11
• Does this question boils down to how to convert V to "\[ScriptCapitalV]"? – Kuba Jan 30 '19 at 20:04
• 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. – Mateus Jan 30 '19 at 20:09
• 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[...]. – Kuba Jan 30 '19 at 20:11

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}


I believe this accomplishes what you want:

First we define the function sc (for Script):

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

sc /@ {A, b, 1}


Then we define the function int:

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


Then:

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


• It will fail if A or b have values. – Kuba Feb 3 '19 at 20:53
• @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. – theorist Feb 3 '19 at 21:47