1
$\begingroup$

In mathematica code, I have a table of quantities that involve subscripts and superscripts. I need to put short text titles in the first row of the table. Suppose I have index1="A", index2="B", and index3="C", where A, B, and C are undefined symbols. (Later I might change A, B, and C to different symbols like $\mu,\nu$, and $\gamma $.)

Question 1. I desire an output of $\Gamma_{BC}^A \dot{x}^B\dot{x}^C$. I want to use an expression using index1, index2, and index3. I have tried things like ToExpression["$\Gamma_{index2 index3}^{index1}\dot{x}^{index2} \dot{x}^{index3}$"].

Question 2. I desire an output of $\partial_B$ $g_{CA}$ + $\partial_C$ $g_{AB}$. As above, I have tried many variations of $\partial_{index2}$ $g_{index3 index1}$ + $\partial_{index3}$ g$_{index1 index2}$.

$\endgroup$

1 Answer 1

1
$\begingroup$
Style[Row[{Subsuperscript[\[CapitalGamma], #2 #3, #1], 
      Superscript[OverDot[x], #2], 
      Superscript[OverDot[x], #3]}] & @@ {A, B, C}
  , 20] // TraditionalForm

$\Gamma _{B C}^A\dot{x}^B\dot{x}^C$


Style[Row[{Subscript[\[Delta], #2], Subscript[g, #2 #3], " + ", 
      Subscript[\[Delta], #3], Subscript[g, #1 #2]}] & @@ {A, B, C}
  , 20] // TraditionalForm

$\delta _Bg_{B C}\text{ + }\delta _Cg_{A B}$

$\endgroup$
3
  • $\begingroup$ This is great!. Thank you. I learned that "Row" mimics an expression where I control the arrangement rather than being dependent on the natural expression ordering of characters. And, I learned the &@@ trick to get A, B, and C to print out rather than index1, index2, etc. I was able to simplify your first answer, bypassing the &@@ trick, and I eventually was able to use del instead of delta in the 2nd one. I'll try to post my actual equations eventually. I don't think I can post them in a comment. Should I post them in "Answer Your Question" even though you have answered it? $\endgroup$
    – matrixbud
    Commented Nov 8, 2023 at 2:47
  • $\begingroup$ Thanks for the accept. I am glad I was able to help. The question can be answered to the extent of the details provided in the OP. It is therefore recommended to provide a minimal example. If your solution is different from this one, the site policy encourages you to share it. Have a nice day. $\endgroup$
    – Syed
    Commented Nov 8, 2023 at 2:59
  • $\begingroup$ On 2nd thought my answers are similar enough not to post. Thanks again. $\endgroup$
    – matrixbud
    Commented Nov 8, 2023 at 3:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.