Double subscript [duplicate]












1
















This question already has an answer here:




  • Double superscript error involving tilde

    5 answers



  • How to typeset a double subscript (sic!) not a subsubscript correctly

    1 answer




I have some macros whose expansion generates something like:



documentclass{amsart}
begin{document}
({T_2}_k)
end{document}


This compiles fine; technically there's a double subscript, but the braces hide it from TeX. However, under some circumstances, the macros generate something like:



documentclass{amsart}
begin{document}
({widetilde T_2}_k)
end{document}


This generates the error



! Double subscript.
l.3 ({widetilde T_2}_
k)
?


If I were generating the text directly, I could just do (widetilde T_{2k}) or similar, but that's not an option here.



Question 1. Why does the first document compile, and the second generate an error?



Question 2. Without changing the definitions of the macros, is there any way to make something like



documentclass{amsart}
newcommandmacroa{widetilde T_2}
newcommandmacrob[1]{#1_k}
begin{document}
(macrobmacroa)
end{document}


compile—e.g., by adding braces, as would work if the first definition were instead:



documentclass{amsart}
newcommandmacroa{T_2}
newcommandmacrob[1]{#1_k}
begin{document}
(macrob{{macroa}})
end{document}


?



EDIT: Now that I realise that this is an error with mathaccents in general rather than just with widetilde, I see that a nice expansion by @HendrikVogt of an answer by @egreg does the necessary digging into TeX's internals to see what is going on. In particular,



documentclass{amsart}
newcommandmacroa{widetilde T_2}
newcommandmacrob[1]{#1_k}
begin{document}
(macrob{{{}macroa}})
end{document}


works (although the apparently more natural



documentclass{amsart}
newcommandmacroa{widetilde T_2}
newcommandmacrob[1]{#1_k}
begin{document}
(macrob{{}macroa})
end{document}


doesn't).










share|improve this question















marked as duplicate by LSpice, egreg, Community Jan 17 at 21:03


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
















  • Please clarify whether you want widetilde to span just T or T_2.

    – Mico
    Jan 15 at 4:02











  • @Mico, I want it to span just T. However, that part is behaving correctly; it's just the double subscript that puzzles me, since I can't see how an accent could change the subscript handling.

    – LSpice
    Jan 15 at 4:15






  • 1





    This is known. While I look for the duplicate, use {{}widetilde{T}_2}_k

    – egreg
    Jan 17 at 20:39













  • @egreg, indeed, once I realised it was a mathaccent issue I spotted your explanation, on which @‍HendrikVogt elaborated.

    – LSpice
    Jan 17 at 20:40
















1
















This question already has an answer here:




  • Double superscript error involving tilde

    5 answers



  • How to typeset a double subscript (sic!) not a subsubscript correctly

    1 answer




I have some macros whose expansion generates something like:



documentclass{amsart}
begin{document}
({T_2}_k)
end{document}


This compiles fine; technically there's a double subscript, but the braces hide it from TeX. However, under some circumstances, the macros generate something like:



documentclass{amsart}
begin{document}
({widetilde T_2}_k)
end{document}


This generates the error



! Double subscript.
l.3 ({widetilde T_2}_
k)
?


If I were generating the text directly, I could just do (widetilde T_{2k}) or similar, but that's not an option here.



Question 1. Why does the first document compile, and the second generate an error?



Question 2. Without changing the definitions of the macros, is there any way to make something like



documentclass{amsart}
newcommandmacroa{widetilde T_2}
newcommandmacrob[1]{#1_k}
begin{document}
(macrobmacroa)
end{document}


compile—e.g., by adding braces, as would work if the first definition were instead:



documentclass{amsart}
newcommandmacroa{T_2}
newcommandmacrob[1]{#1_k}
begin{document}
(macrob{{macroa}})
end{document}


?



EDIT: Now that I realise that this is an error with mathaccents in general rather than just with widetilde, I see that a nice expansion by @HendrikVogt of an answer by @egreg does the necessary digging into TeX's internals to see what is going on. In particular,



documentclass{amsart}
newcommandmacroa{widetilde T_2}
newcommandmacrob[1]{#1_k}
begin{document}
(macrob{{{}macroa}})
end{document}


works (although the apparently more natural



documentclass{amsart}
newcommandmacroa{widetilde T_2}
newcommandmacrob[1]{#1_k}
begin{document}
(macrob{{}macroa})
end{document}


doesn't).










share|improve this question















marked as duplicate by LSpice, egreg, Community Jan 17 at 21:03


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
















  • Please clarify whether you want widetilde to span just T or T_2.

    – Mico
    Jan 15 at 4:02











  • @Mico, I want it to span just T. However, that part is behaving correctly; it's just the double subscript that puzzles me, since I can't see how an accent could change the subscript handling.

    – LSpice
    Jan 15 at 4:15






  • 1





    This is known. While I look for the duplicate, use {{}widetilde{T}_2}_k

    – egreg
    Jan 17 at 20:39













  • @egreg, indeed, once I realised it was a mathaccent issue I spotted your explanation, on which @‍HendrikVogt elaborated.

    – LSpice
    Jan 17 at 20:40














1












1








1









This question already has an answer here:




  • Double superscript error involving tilde

    5 answers



  • How to typeset a double subscript (sic!) not a subsubscript correctly

    1 answer




I have some macros whose expansion generates something like:



documentclass{amsart}
begin{document}
({T_2}_k)
end{document}


This compiles fine; technically there's a double subscript, but the braces hide it from TeX. However, under some circumstances, the macros generate something like:



documentclass{amsart}
begin{document}
({widetilde T_2}_k)
end{document}


This generates the error



! Double subscript.
l.3 ({widetilde T_2}_
k)
?


If I were generating the text directly, I could just do (widetilde T_{2k}) or similar, but that's not an option here.



Question 1. Why does the first document compile, and the second generate an error?



Question 2. Without changing the definitions of the macros, is there any way to make something like



documentclass{amsart}
newcommandmacroa{widetilde T_2}
newcommandmacrob[1]{#1_k}
begin{document}
(macrobmacroa)
end{document}


compile—e.g., by adding braces, as would work if the first definition were instead:



documentclass{amsart}
newcommandmacroa{T_2}
newcommandmacrob[1]{#1_k}
begin{document}
(macrob{{macroa}})
end{document}


?



EDIT: Now that I realise that this is an error with mathaccents in general rather than just with widetilde, I see that a nice expansion by @HendrikVogt of an answer by @egreg does the necessary digging into TeX's internals to see what is going on. In particular,



documentclass{amsart}
newcommandmacroa{widetilde T_2}
newcommandmacrob[1]{#1_k}
begin{document}
(macrob{{{}macroa}})
end{document}


works (although the apparently more natural



documentclass{amsart}
newcommandmacroa{widetilde T_2}
newcommandmacrob[1]{#1_k}
begin{document}
(macrob{{}macroa})
end{document}


doesn't).










share|improve this question

















This question already has an answer here:




  • Double superscript error involving tilde

    5 answers



  • How to typeset a double subscript (sic!) not a subsubscript correctly

    1 answer




I have some macros whose expansion generates something like:



documentclass{amsart}
begin{document}
({T_2}_k)
end{document}


This compiles fine; technically there's a double subscript, but the braces hide it from TeX. However, under some circumstances, the macros generate something like:



documentclass{amsart}
begin{document}
({widetilde T_2}_k)
end{document}


This generates the error



! Double subscript.
l.3 ({widetilde T_2}_
k)
?


If I were generating the text directly, I could just do (widetilde T_{2k}) or similar, but that's not an option here.



Question 1. Why does the first document compile, and the second generate an error?



Question 2. Without changing the definitions of the macros, is there any way to make something like



documentclass{amsart}
newcommandmacroa{widetilde T_2}
newcommandmacrob[1]{#1_k}
begin{document}
(macrobmacroa)
end{document}


compile—e.g., by adding braces, as would work if the first definition were instead:



documentclass{amsart}
newcommandmacroa{T_2}
newcommandmacrob[1]{#1_k}
begin{document}
(macrob{{macroa}})
end{document}


?



EDIT: Now that I realise that this is an error with mathaccents in general rather than just with widetilde, I see that a nice expansion by @HendrikVogt of an answer by @egreg does the necessary digging into TeX's internals to see what is going on. In particular,



documentclass{amsart}
newcommandmacroa{widetilde T_2}
newcommandmacrob[1]{#1_k}
begin{document}
(macrob{{{}macroa}})
end{document}


works (although the apparently more natural



documentclass{amsart}
newcommandmacroa{widetilde T_2}
newcommandmacrob[1]{#1_k}
begin{document}
(macrob{{}macroa})
end{document}


doesn't).





This question already has an answer here:




  • Double superscript error involving tilde

    5 answers



  • How to typeset a double subscript (sic!) not a subsubscript correctly

    1 answer








accents subscripts grouping






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 17 at 21:06







LSpice

















asked Jan 15 at 3:11









LSpiceLSpice

681413




681413




marked as duplicate by LSpice, egreg, Community Jan 17 at 21:03


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.






marked as duplicate by LSpice, egreg, Community Jan 17 at 21:03


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.















  • Please clarify whether you want widetilde to span just T or T_2.

    – Mico
    Jan 15 at 4:02











  • @Mico, I want it to span just T. However, that part is behaving correctly; it's just the double subscript that puzzles me, since I can't see how an accent could change the subscript handling.

    – LSpice
    Jan 15 at 4:15






  • 1





    This is known. While I look for the duplicate, use {{}widetilde{T}_2}_k

    – egreg
    Jan 17 at 20:39













  • @egreg, indeed, once I realised it was a mathaccent issue I spotted your explanation, on which @‍HendrikVogt elaborated.

    – LSpice
    Jan 17 at 20:40



















  • Please clarify whether you want widetilde to span just T or T_2.

    – Mico
    Jan 15 at 4:02











  • @Mico, I want it to span just T. However, that part is behaving correctly; it's just the double subscript that puzzles me, since I can't see how an accent could change the subscript handling.

    – LSpice
    Jan 15 at 4:15






  • 1





    This is known. While I look for the duplicate, use {{}widetilde{T}_2}_k

    – egreg
    Jan 17 at 20:39













  • @egreg, indeed, once I realised it was a mathaccent issue I spotted your explanation, on which @‍HendrikVogt elaborated.

    – LSpice
    Jan 17 at 20:40

















Please clarify whether you want widetilde to span just T or T_2.

– Mico
Jan 15 at 4:02





Please clarify whether you want widetilde to span just T or T_2.

– Mico
Jan 15 at 4:02













@Mico, I want it to span just T. However, that part is behaving correctly; it's just the double subscript that puzzles me, since I can't see how an accent could change the subscript handling.

– LSpice
Jan 15 at 4:15





@Mico, I want it to span just T. However, that part is behaving correctly; it's just the double subscript that puzzles me, since I can't see how an accent could change the subscript handling.

– LSpice
Jan 15 at 4:15




1




1





This is known. While I look for the duplicate, use {{}widetilde{T}_2}_k

– egreg
Jan 17 at 20:39







This is known. While I look for the duplicate, use {{}widetilde{T}_2}_k

– egreg
Jan 17 at 20:39















@egreg, indeed, once I realised it was a mathaccent issue I spotted your explanation, on which @‍HendrikVogt elaborated.

– LSpice
Jan 17 at 20:40





@egreg, indeed, once I realised it was a mathaccent issue I spotted your explanation, on which @‍HendrikVogt elaborated.

– LSpice
Jan 17 at 20:40










0






active

oldest

votes

















0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes

Popular posts from this blog

How to change which sound is reproduced for terminal bell?

Can I use Tabulator js library in my java Spring + Thymeleaf project?

Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents