Change TeXForm of ArcTanFormat and TeXForm does not work as expectedis it possible to change/customize some conversions done by TeXForm?Awkward output of TeXFormMultiplication sign in TeXForm?TeXForm producing weird outputsUsing patterns to modify TeXForm outputTeXForm: Adding colorMultiple TeXForm returns just single outputHow to Custominze the Output of TeXFormUsing TeXForm for subscripted variablesImproving TeXForm handling of fraction

My cat gets angry and scared at me if I stand

How do the other crew members know the xenomorph is "big", if they haven't seen it?

Copying files: does Windows write to disk if files are identical?

Could the principle of owls' silent flight be used for stealth aircraft?

How can I get something for my shares in a company I used to be employed by?

What can players do while waiting for a troll to regenerate?

A word/phrase means "a small amount" (of a color)

Does recycling lead to less jobs?

Program to print the multiple occurrence of numbers in a list

Why does hashing public keys not actually provide any quantum resistance?

instead of pressurizing an entire spacesuit with oxygen could oxygen just pressurize the head and the rest of the body be pressurized with water?

How to make the following format

Do you celebrate paying your mortgage off with colleagues?

My professor has no direction

Can someone interview their sibling?

What happened to the SEV instruction on the 6502?

How can I more clearly ask people to accomodate for my autism?

Python algorithm that converts array-like data into MathJax

At what point can you walk out of a restaurant if they make you wait to pay the bill?

Can a company prevent a co-author of a paper to put his name on it?

What could an alternative human-powered transportation method look like?

As tourist in China do I have to fear consequences for having publicly liked South Park

Volrath's Shapeshifter, Static Buffs, and Combat damage

What's the origin of the trope that dragons used to be common but aren't any more?



Change TeXForm of ArcTan


Format and TeXForm does not work as expectedis it possible to change/customize some conversions done by TeXForm?Awkward output of TeXFormMultiplication sign in TeXForm?TeXForm producing weird outputsUsing patterns to modify TeXForm outputTeXForm: Adding colorMultiple TeXForm returns just single outputHow to Custominze the Output of TeXFormUsing TeXForm for subscripted variablesImproving TeXForm handling of fraction






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty
margin-bottom:0;

.everyonelovesstackoverflowposition:absolute;height:1px;width:1px;opacity:0;top:0;left:0;pointer-events:none;








4














$begingroup$


When using ArcTan, the corresponding TeXForm is tan^-1 and not arctan which I would prefer for aesthetic reasons. How to fix that?










share|improve this question












$endgroup$










  • 2




    $begingroup$
    Possible duplicate: mathematica.stackexchange.com/q/153876/12 (TeXForm was unfortunately not designed to be customizable.)
    $endgroup$
    – Szabolcs
    May 29 at 11:40

















4














$begingroup$


When using ArcTan, the corresponding TeXForm is tan^-1 and not arctan which I would prefer for aesthetic reasons. How to fix that?










share|improve this question












$endgroup$










  • 2




    $begingroup$
    Possible duplicate: mathematica.stackexchange.com/q/153876/12 (TeXForm was unfortunately not designed to be customizable.)
    $endgroup$
    – Szabolcs
    May 29 at 11:40













4












4








4


2



$begingroup$


When using ArcTan, the corresponding TeXForm is tan^-1 and not arctan which I would prefer for aesthetic reasons. How to fix that?










share|improve this question












$endgroup$




When using ArcTan, the corresponding TeXForm is tan^-1 and not arctan which I would prefer for aesthetic reasons. How to fix that?







latex format






share|improve this question
















share|improve this question













share|improve this question




share|improve this question








edited May 29 at 19:15









Carl Woll

92.4k3 gold badges123 silver badges234 bronze badges




92.4k3 gold badges123 silver badges234 bronze badges










asked May 29 at 11:38









KutsubatoKutsubato

694 bronze badges




694 bronze badges










  • 2




    $begingroup$
    Possible duplicate: mathematica.stackexchange.com/q/153876/12 (TeXForm was unfortunately not designed to be customizable.)
    $endgroup$
    – Szabolcs
    May 29 at 11:40












  • 2




    $begingroup$
    Possible duplicate: mathematica.stackexchange.com/q/153876/12 (TeXForm was unfortunately not designed to be customizable.)
    $endgroup$
    – Szabolcs
    May 29 at 11:40







2




2




$begingroup$
Possible duplicate: mathematica.stackexchange.com/q/153876/12 (TeXForm was unfortunately not designed to be customizable.)
$endgroup$
– Szabolcs
May 29 at 11:40




$begingroup$
Possible duplicate: mathematica.stackexchange.com/q/153876/12 (TeXForm was unfortunately not designed to be customizable.)
$endgroup$
– Szabolcs
May 29 at 11:40










2 Answers
2






active

oldest

votes


















6
















$begingroup$

Using the code from my answer to
Format and TeXForm does not work as expected (which I include at the bottom of this answer:



Format[ArcTan[x_], TeXForm] := arctan[x]


Then:



1 + ArcTan[x] //TeXForm



$arctan (x)+1$




Here is the code:



Initial /: Verbatim[TagSetDelayed][Initial[sym_], lhs_, rhs_] := With[

new = Block[sym,
TagSetDelayed[sym, lhs, rhs];
First @ Language`ExtendedDefinition[sym]
],
protect = Unprotect[sym]
,

sym;
Replace[new,
Rule[values_, n:Except[]] :> (
values[sym] = DeleteDuplicates@Join[n, values[sym]]
),
2
];
Protect@protect;
]

Initial[Convert`TeX`ExpressionToTeX] /:
Convert`TeX`ExpressionToTeX[e__] /; !TrueQ@$TeX := Block[
$
TeX = True,
Convert`TeX`ExpressionToTeX[e]
]

Initial[Format] /: TagSetDelayed[sym_Symbol, Verbatim[Format][x_, TeXForm], rhs_] := With[
fmt = TraditionalForm,

Initial[sym] /: MakeBoxes[x, fmt] /; $TeX := MakeBoxes[rhs, fmt]
]

Initial[Format] /: SetDelayed[Verbatim[Format][x_, TeXForm], rhs_] := With[
s = getTagSymbol[Format[x, TeXForm]], fmt = TraditionalForm,
Replace[s,
HoldForm[tag_] :> (
Initial[tag] /: MakeBoxes[x, fmt] /; $TeX := MakeBoxes[rhs, fmt]
)
]
]

SetAttributes[getTagSymbol, HoldFirst]

getTagSymbol[Format[x_, TeXForm]] := Module[dummy, t,
extractTag[Hold[Message[Format::tag, HoldForm@Format, _, tag_], False]] := t = tag;
Internal`HandlerBlock[Message, extractTag,
Quiet[dummy[1] /: Format[x, TeXForm] := 1]
];
t
]

System`Convert`TeXFormDump`maketex[s_String] /; !StringMatchQ[s, """~~___~~"""] && SyntaxQ[s, TeXForm] := Replace[
s,

n_ /; StringMatchQ[n, NumberString] :> n,
w_?wordQ :> "\operatorname"<>w<>""

]

wordQ[s_String] := Length @ StringSplit[s, WordBoundary] == 1





share|improve this answer










$endgroup$














  • $begingroup$
    Looks good but it changes my $text$ blocks into $operatorname$...
    $endgroup$
    – Kutsubato
    May 31 at 7:55


















4
















$begingroup$

Usually the simplest methods tend to be the best. Try the code



expr = ArcTan[x/y] - ArcTan[z/w];
StringReplace[ToString[expr, TeXForm], "\tan ^-1" -> "\arctan"]


which returns



arctanleft(fracxyright)-arctanleft(fraczwright)


and in display form is



$$ arctanleft(fracxyright)-arctanleft(fraczwright) $$






share|improve this answer












$endgroup$














  • $begingroup$
    Should work but tends to be slow
    $endgroup$
    – Kutsubato
    May 31 at 7:55












Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "387"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);














draft saved

draft discarded
















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f199315%2fchange-texform-of-arctan%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown


























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









6
















$begingroup$

Using the code from my answer to
Format and TeXForm does not work as expected (which I include at the bottom of this answer:



Format[ArcTan[x_], TeXForm] := arctan[x]


Then:



1 + ArcTan[x] //TeXForm



$arctan (x)+1$




Here is the code:



Initial /: Verbatim[TagSetDelayed][Initial[sym_], lhs_, rhs_] := With[

new = Block[sym,
TagSetDelayed[sym, lhs, rhs];
First @ Language`ExtendedDefinition[sym]
],
protect = Unprotect[sym]
,

sym;
Replace[new,
Rule[values_, n:Except[]] :> (
values[sym] = DeleteDuplicates@Join[n, values[sym]]
),
2
];
Protect@protect;
]

Initial[Convert`TeX`ExpressionToTeX] /:
Convert`TeX`ExpressionToTeX[e__] /; !TrueQ@$TeX := Block[
$
TeX = True,
Convert`TeX`ExpressionToTeX[e]
]

Initial[Format] /: TagSetDelayed[sym_Symbol, Verbatim[Format][x_, TeXForm], rhs_] := With[
fmt = TraditionalForm,

Initial[sym] /: MakeBoxes[x, fmt] /; $TeX := MakeBoxes[rhs, fmt]
]

Initial[Format] /: SetDelayed[Verbatim[Format][x_, TeXForm], rhs_] := With[
s = getTagSymbol[Format[x, TeXForm]], fmt = TraditionalForm,
Replace[s,
HoldForm[tag_] :> (
Initial[tag] /: MakeBoxes[x, fmt] /; $TeX := MakeBoxes[rhs, fmt]
)
]
]

SetAttributes[getTagSymbol, HoldFirst]

getTagSymbol[Format[x_, TeXForm]] := Module[dummy, t,
extractTag[Hold[Message[Format::tag, HoldForm@Format, _, tag_], False]] := t = tag;
Internal`HandlerBlock[Message, extractTag,
Quiet[dummy[1] /: Format[x, TeXForm] := 1]
];
t
]

System`Convert`TeXFormDump`maketex[s_String] /; !StringMatchQ[s, """~~___~~"""] && SyntaxQ[s, TeXForm] := Replace[
s,

n_ /; StringMatchQ[n, NumberString] :> n,
w_?wordQ :> "\operatorname"<>w<>""

]

wordQ[s_String] := Length @ StringSplit[s, WordBoundary] == 1





share|improve this answer










$endgroup$














  • $begingroup$
    Looks good but it changes my $text$ blocks into $operatorname$...
    $endgroup$
    – Kutsubato
    May 31 at 7:55















6
















$begingroup$

Using the code from my answer to
Format and TeXForm does not work as expected (which I include at the bottom of this answer:



Format[ArcTan[x_], TeXForm] := arctan[x]


Then:



1 + ArcTan[x] //TeXForm



$arctan (x)+1$




Here is the code:



Initial /: Verbatim[TagSetDelayed][Initial[sym_], lhs_, rhs_] := With[

new = Block[sym,
TagSetDelayed[sym, lhs, rhs];
First @ Language`ExtendedDefinition[sym]
],
protect = Unprotect[sym]
,

sym;
Replace[new,
Rule[values_, n:Except[]] :> (
values[sym] = DeleteDuplicates@Join[n, values[sym]]
),
2
];
Protect@protect;
]

Initial[Convert`TeX`ExpressionToTeX] /:
Convert`TeX`ExpressionToTeX[e__] /; !TrueQ@$TeX := Block[
$
TeX = True,
Convert`TeX`ExpressionToTeX[e]
]

Initial[Format] /: TagSetDelayed[sym_Symbol, Verbatim[Format][x_, TeXForm], rhs_] := With[
fmt = TraditionalForm,

Initial[sym] /: MakeBoxes[x, fmt] /; $TeX := MakeBoxes[rhs, fmt]
]

Initial[Format] /: SetDelayed[Verbatim[Format][x_, TeXForm], rhs_] := With[
s = getTagSymbol[Format[x, TeXForm]], fmt = TraditionalForm,
Replace[s,
HoldForm[tag_] :> (
Initial[tag] /: MakeBoxes[x, fmt] /; $TeX := MakeBoxes[rhs, fmt]
)
]
]

SetAttributes[getTagSymbol, HoldFirst]

getTagSymbol[Format[x_, TeXForm]] := Module[dummy, t,
extractTag[Hold[Message[Format::tag, HoldForm@Format, _, tag_], False]] := t = tag;
Internal`HandlerBlock[Message, extractTag,
Quiet[dummy[1] /: Format[x, TeXForm] := 1]
];
t
]

System`Convert`TeXFormDump`maketex[s_String] /; !StringMatchQ[s, """~~___~~"""] && SyntaxQ[s, TeXForm] := Replace[
s,

n_ /; StringMatchQ[n, NumberString] :> n,
w_?wordQ :> "\operatorname"<>w<>""

]

wordQ[s_String] := Length @ StringSplit[s, WordBoundary] == 1





share|improve this answer










$endgroup$














  • $begingroup$
    Looks good but it changes my $text$ blocks into $operatorname$...
    $endgroup$
    – Kutsubato
    May 31 at 7:55













6














6










6







$begingroup$

Using the code from my answer to
Format and TeXForm does not work as expected (which I include at the bottom of this answer:



Format[ArcTan[x_], TeXForm] := arctan[x]


Then:



1 + ArcTan[x] //TeXForm



$arctan (x)+1$




Here is the code:



Initial /: Verbatim[TagSetDelayed][Initial[sym_], lhs_, rhs_] := With[

new = Block[sym,
TagSetDelayed[sym, lhs, rhs];
First @ Language`ExtendedDefinition[sym]
],
protect = Unprotect[sym]
,

sym;
Replace[new,
Rule[values_, n:Except[]] :> (
values[sym] = DeleteDuplicates@Join[n, values[sym]]
),
2
];
Protect@protect;
]

Initial[Convert`TeX`ExpressionToTeX] /:
Convert`TeX`ExpressionToTeX[e__] /; !TrueQ@$TeX := Block[
$
TeX = True,
Convert`TeX`ExpressionToTeX[e]
]

Initial[Format] /: TagSetDelayed[sym_Symbol, Verbatim[Format][x_, TeXForm], rhs_] := With[
fmt = TraditionalForm,

Initial[sym] /: MakeBoxes[x, fmt] /; $TeX := MakeBoxes[rhs, fmt]
]

Initial[Format] /: SetDelayed[Verbatim[Format][x_, TeXForm], rhs_] := With[
s = getTagSymbol[Format[x, TeXForm]], fmt = TraditionalForm,
Replace[s,
HoldForm[tag_] :> (
Initial[tag] /: MakeBoxes[x, fmt] /; $TeX := MakeBoxes[rhs, fmt]
)
]
]

SetAttributes[getTagSymbol, HoldFirst]

getTagSymbol[Format[x_, TeXForm]] := Module[dummy, t,
extractTag[Hold[Message[Format::tag, HoldForm@Format, _, tag_], False]] := t = tag;
Internal`HandlerBlock[Message, extractTag,
Quiet[dummy[1] /: Format[x, TeXForm] := 1]
];
t
]

System`Convert`TeXFormDump`maketex[s_String] /; !StringMatchQ[s, """~~___~~"""] && SyntaxQ[s, TeXForm] := Replace[
s,

n_ /; StringMatchQ[n, NumberString] :> n,
w_?wordQ :> "\operatorname"<>w<>""

]

wordQ[s_String] := Length @ StringSplit[s, WordBoundary] == 1





share|improve this answer










$endgroup$



Using the code from my answer to
Format and TeXForm does not work as expected (which I include at the bottom of this answer:



Format[ArcTan[x_], TeXForm] := arctan[x]


Then:



1 + ArcTan[x] //TeXForm



$arctan (x)+1$




Here is the code:



Initial /: Verbatim[TagSetDelayed][Initial[sym_], lhs_, rhs_] := With[

new = Block[sym,
TagSetDelayed[sym, lhs, rhs];
First @ Language`ExtendedDefinition[sym]
],
protect = Unprotect[sym]
,

sym;
Replace[new,
Rule[values_, n:Except[]] :> (
values[sym] = DeleteDuplicates@Join[n, values[sym]]
),
2
];
Protect@protect;
]

Initial[Convert`TeX`ExpressionToTeX] /:
Convert`TeX`ExpressionToTeX[e__] /; !TrueQ@$TeX := Block[
$
TeX = True,
Convert`TeX`ExpressionToTeX[e]
]

Initial[Format] /: TagSetDelayed[sym_Symbol, Verbatim[Format][x_, TeXForm], rhs_] := With[
fmt = TraditionalForm,

Initial[sym] /: MakeBoxes[x, fmt] /; $TeX := MakeBoxes[rhs, fmt]
]

Initial[Format] /: SetDelayed[Verbatim[Format][x_, TeXForm], rhs_] := With[
s = getTagSymbol[Format[x, TeXForm]], fmt = TraditionalForm,
Replace[s,
HoldForm[tag_] :> (
Initial[tag] /: MakeBoxes[x, fmt] /; $TeX := MakeBoxes[rhs, fmt]
)
]
]

SetAttributes[getTagSymbol, HoldFirst]

getTagSymbol[Format[x_, TeXForm]] := Module[dummy, t,
extractTag[Hold[Message[Format::tag, HoldForm@Format, _, tag_], False]] := t = tag;
Internal`HandlerBlock[Message, extractTag,
Quiet[dummy[1] /: Format[x, TeXForm] := 1]
];
t
]

System`Convert`TeXFormDump`maketex[s_String] /; !StringMatchQ[s, """~~___~~"""] && SyntaxQ[s, TeXForm] := Replace[
s,

n_ /; StringMatchQ[n, NumberString] :> n,
w_?wordQ :> "\operatorname"<>w<>""

]

wordQ[s_String] := Length @ StringSplit[s, WordBoundary] == 1






share|improve this answer













share|improve this answer




share|improve this answer










answered May 29 at 14:44









Carl WollCarl Woll

92.4k3 gold badges123 silver badges234 bronze badges




92.4k3 gold badges123 silver badges234 bronze badges














  • $begingroup$
    Looks good but it changes my $text$ blocks into $operatorname$...
    $endgroup$
    – Kutsubato
    May 31 at 7:55
















  • $begingroup$
    Looks good but it changes my $text$ blocks into $operatorname$...
    $endgroup$
    – Kutsubato
    May 31 at 7:55















$begingroup$
Looks good but it changes my $text$ blocks into $operatorname$...
$endgroup$
– Kutsubato
May 31 at 7:55




$begingroup$
Looks good but it changes my $text$ blocks into $operatorname$...
$endgroup$
– Kutsubato
May 31 at 7:55













4
















$begingroup$

Usually the simplest methods tend to be the best. Try the code



expr = ArcTan[x/y] - ArcTan[z/w];
StringReplace[ToString[expr, TeXForm], "\tan ^-1" -> "\arctan"]


which returns



arctanleft(fracxyright)-arctanleft(fraczwright)


and in display form is



$$ arctanleft(fracxyright)-arctanleft(fraczwright) $$






share|improve this answer












$endgroup$














  • $begingroup$
    Should work but tends to be slow
    $endgroup$
    – Kutsubato
    May 31 at 7:55















4
















$begingroup$

Usually the simplest methods tend to be the best. Try the code



expr = ArcTan[x/y] - ArcTan[z/w];
StringReplace[ToString[expr, TeXForm], "\tan ^-1" -> "\arctan"]


which returns



arctanleft(fracxyright)-arctanleft(fraczwright)


and in display form is



$$ arctanleft(fracxyright)-arctanleft(fraczwright) $$






share|improve this answer












$endgroup$














  • $begingroup$
    Should work but tends to be slow
    $endgroup$
    – Kutsubato
    May 31 at 7:55













4














4










4







$begingroup$

Usually the simplest methods tend to be the best. Try the code



expr = ArcTan[x/y] - ArcTan[z/w];
StringReplace[ToString[expr, TeXForm], "\tan ^-1" -> "\arctan"]


which returns



arctanleft(fracxyright)-arctanleft(fraczwright)


and in display form is



$$ arctanleft(fracxyright)-arctanleft(fraczwright) $$






share|improve this answer












$endgroup$



Usually the simplest methods tend to be the best. Try the code



expr = ArcTan[x/y] - ArcTan[z/w];
StringReplace[ToString[expr, TeXForm], "\tan ^-1" -> "\arctan"]


which returns



arctanleft(fracxyright)-arctanleft(fraczwright)


and in display form is



$$ arctanleft(fracxyright)-arctanleft(fraczwright) $$







share|improve this answer















share|improve this answer




share|improve this answer








edited Jun 5 at 10:57

























answered May 29 at 18:41









SomosSomos

3,0401 gold badge2 silver badges11 bronze badges




3,0401 gold badge2 silver badges11 bronze badges














  • $begingroup$
    Should work but tends to be slow
    $endgroup$
    – Kutsubato
    May 31 at 7:55
















  • $begingroup$
    Should work but tends to be slow
    $endgroup$
    – Kutsubato
    May 31 at 7:55















$begingroup$
Should work but tends to be slow
$endgroup$
– Kutsubato
May 31 at 7:55




$begingroup$
Should work but tends to be slow
$endgroup$
– Kutsubato
May 31 at 7:55


















draft saved

draft discarded















































Thanks for contributing an answer to Mathematica Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

Use MathJax to format equations. MathJax reference.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f199315%2fchange-texform-of-arctan%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown









Popular posts from this blog

Tamil (spriik) Luke uk diar | Nawigatjuun

Align equal signs while including text over equalitiesAMS align: left aligned text/math plus multicolumn alignmentMultiple alignmentsAligning equations in multiple placesNumbering and aligning an equation with multiple columnsHow to align one equation with another multline equationUsing \ in environments inside the begintabularxNumber equations and preserving alignment of equal signsHow can I align equations to the left and to the right?Double equation alignment problem within align enviromentAligned within align: Why are they right-aligned?

Where does the image of a data connector as a sharp metal spike originate from?Where does the concept of infected people turning into zombies only after death originate from?Where does the motif of a reanimated human head originate?Where did the notion that Dragons could speak originate?Where does the archetypal image of the 'Grey' alien come from?Where did the suffix '-Man' originate?Where does the notion of being injured or killed by an illusion originate?Where did the term “sophont” originate?Where does the trope of magic spells being driven by advanced technology originate from?Where did the term “the living impaired” originate?