Change TeXForm of ArcTanFormat and TeXForm does not work as expectedis it possible to change/customize some conversions done by TeXForm?Awkward output of TeXFormHow to type a capital 'E' in Mathematica 9 using 'ToExpression' and 'TeXForm'?Multiplication sign in TeXForm?TeXForm without simplificationTeXForm producing weird outputsUsing patterns to modify TeXForm outputTeXForm: Adding colorMultiple TeXForm returns just single outputHow to Custominze the Output of TeXFormUsing TeXForm for subscripted variables
Boss making me feel guilty for leaving the company at the end of my internship
My parents claim they cannot pay for my college education; what are my options?
Does every chapter have to "blow the reader away" so to speak?
How to search for Android apps without ads?
Why is my Taiyaki (Cake that looks like a fish) too hard and dry?
Is fission/fusion to iron the most efficient way to convert mass to energy?
DBCC SHRINKFILE on the distribution database
Do Veracrypt encrypted volumes have any kind of brute force protection?
Jam with honey & without pectin has a saucy consistency always
Is it true that "only photographers care about noise"?
Placement of positioning lights on A320 winglets
What do I need to do, tax-wise, for a sudden windfall?
Why not make one big cpu core?
Someone who is granted access to information but not expected to read it
Can Mage Hand be used to indirectly trigger an attack?
Is there a term for someone whose preferred policies are a mix of Left and Right?
What game uses dice with compass point arrows, forbidden signs, explosions, arrows and targeting reticles?
Must a CPU have a GPU if the motherboard provides a display port (when there isn't any separate video card)?
What publication claimed that Michael Jackson died in a nuclear holocaust?
Is it possible to install Firefox on Ubuntu with no desktop enviroment?
Why are backslashes included in this shell script?
Nth term of Van Eck Sequence
Are athletes' college degrees discounted by employers and graduate school admissions?
Why does there seem to be an extreme lack of public trashcans in Taiwan?
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 TeXFormHow to type a capital 'E' in Mathematica 9 using 'ToExpression' and 'TeXForm'?Multiplication sign in TeXForm?TeXForm without simplificationTeXForm producing weird outputsUsing patterns to modify TeXForm outputTeXForm: Adding colorMultiple TeXForm returns just single outputHow to Custominze the Output of TeXFormUsing TeXForm for subscripted variables
$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
83.6k3105217
83.6k3105217
asked May 29 at 11:38
KutsubatoKutsubato
574
574
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/3.0/"u003ecc by-sa 3.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
83.6k3105217
83.6k3105217
$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
2,5651211
2,5651211
$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