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;
$begingroup$
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
$endgroup$
add a comment
|
$begingroup$
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
$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
add a comment
|
$begingroup$
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
$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
latex format
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
add a comment
|
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
add a comment
|
2 Answers
2
active
oldest
votes
$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
$endgroup$
$begingroup$
Looks good but it changes my $text$ blocks into $operatorname$...
$endgroup$
– Kutsubato
May 31 at 7:55
add a comment
|
$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) $$
$endgroup$
$begingroup$
Should work but tends to be slow
$endgroup$
– Kutsubato
May 31 at 7:55
add a comment
|
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
$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
$endgroup$
$begingroup$
Looks good but it changes my $text$ blocks into $operatorname$...
$endgroup$
– Kutsubato
May 31 at 7:55
add a comment
|
$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
$endgroup$
$begingroup$
Looks good but it changes my $text$ blocks into $operatorname$...
$endgroup$
– Kutsubato
May 31 at 7:55
add a comment
|
$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
$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
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
add a comment
|
$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
add a comment
|
$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) $$
$endgroup$
$begingroup$
Should work but tends to be slow
$endgroup$
– Kutsubato
May 31 at 7:55
add a comment
|
$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) $$
$endgroup$
$begingroup$
Should work but tends to be slow
$endgroup$
– Kutsubato
May 31 at 7:55
add a comment
|
$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) $$
$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) $$
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
add a comment
|
$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
add a comment
|
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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