Timeline for Is it bad practice to replace a^{-1} with a user-defined command?
Current License: CC BY-SA 4.0
17 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Nov 11, 2020 at 6:22 | comment | added | Gaussler | @Symbol1 Then change your keyboard layout so that you have symbols instead of numbers on top. | |
Nov 11, 2020 at 2:56 | comment | added | Symbol 1 |
^{-1} is the worst idiom. For one simple concept you need five characters, three shift s, three little finger presses, and it induces grouping issues. Anything you can come up with is strictly better if you use it frequently enough.
|
|
Nov 10, 2020 at 23:44 | comment | added | Paŭlo Ebermann |
I would have the usage be \inv a , not a\inv . Just so it feels more like a function.
|
|
Nov 10, 2020 at 21:53 | vote | accept | Hilbert Jr. | ||
Nov 10, 2020 at 20:40 | history | became hot network question | |||
Nov 10, 2020 at 20:36 | comment | added | Werner♦ | Related: Consistent typography | |
Nov 10, 2020 at 19:52 | comment | added | Gaussler |
@V.Ch. See my updated answer. ;-)
|
|
Nov 10, 2020 at 16:57 | comment | added | Hilbert Jr. | @Gaussler how would I go about using xparse? What's the exact command, if you don't mind? | |
Nov 10, 2020 at 15:00 | history | tweeted | twitter.com/StackTeX/status/1326177834361106434 | ||
Nov 10, 2020 at 13:46 | comment | added | Gaussler |
@V.Ch. Further extensions only really make sense for specific purposes that depend on your context. For instance, if you want to be able to take \inv of a' as in my answer, you could use the xparse package to allow this. For instance, you could add an optional star so that a\inv* produces a^{\prime -1} .
|
|
Nov 10, 2020 at 13:23 | comment | added | Hilbert Jr. |
@egreg groups were precisely why I created the command, got tired of writing out ^{-1} everytime. Your proposed improvement is great, I was actually wondering what I'd have to do in case of exponents higher than 1. Is there way to further improve on the command or is that about it? What about what @Gaussler mentions below, about it interfering with other superscripts, is there a way of circumventing that?
|
|
Nov 10, 2020 at 12:59 | answer | added | Gaussler | timeline score: 10 | |
Nov 10, 2020 at 12:45 | comment | added | egreg |
To the contrary! It is good practice, if you have a lot of inverses to type, for instance group theory material, with maybe an average of more than one inverse per line. You could also define some editor shortcut, but that depends on the editor. A possible improvement could be \newcommand{\inv}[1][1]{^{-#1}} , so you can type a\inv but also a\inv[2] for a^{-2} . Anyway, as you see, this is mostly a question of opinion.
|
|
Nov 10, 2020 at 12:40 | comment | added | hpekristiansen | I am not sure that your question can be answered!? There will be a lot of opinions, but maybe no definitive answer. | |
Nov 10, 2020 at 12:39 | comment | added | hpekristiansen |
I would personally say that it is bad. ^{-1} is directly readable by others and yourself in the future. It is not worth having a new command to save just a few keystrokes(in my opinion). \inv could collide with other things that comes from packages or what you do yourself elsewhere or in the future.
|
|
Nov 10, 2020 at 12:36 | review | First posts | |||
Nov 10, 2020 at 12:44 | |||||
Nov 10, 2020 at 12:33 | history | asked | Hilbert Jr. | CC BY-SA 4.0 |