# Physics replacement effort

I'm currently considering writing up some macros in order to provide a somewhat more reasonable alternative to what the physics package does. This is heavily inspired by Alternatives to the physics package.

The problem is: Which kind of macros should be implemented? I don't want to add questionable syntax like the package does, but more reasonable things with proper LaTeX typical optional arguments or even some more unconventional but still (imho) reasonable things, e.g. _ starting an optional argument for something that should be subscript and right delimited by either a ^ (starting a superscript) or the next mandatory argument.

Everyone is encouraged to wish for macros I should implement. If somebody has a finished solution for something that should be in the package -- and the person is willing to share it -- one can post those solutions as answers as well.

So what can a single answer to this question contain? A wish for a macro (optionally along with syntax proposals) or a macro-implementation (which might be subject to further discussions). Please only one per answer. You might upvote implementations or macro-wishes you deem a good idea to be in such a package.

Edit: So far the packages braket and diffcoeff were brought to my attention, which seem to provide macros for subsets of the physics package's functionality.

• Maybe, it's easier to fork physics and fix the issues in the package itself? – homocomputeris Jan 24 '19 at 20:02
• @homocomputeris since one of the complains about the physics package is the questionable syntax, I'd prefer a complete rewrite. Removing the spurious spaces could be done this way, but I'm not really interested in that (contacting the maintainer to report spurious spaces should be the preferred approach for this). – Skillmon Jan 24 '19 at 20:09
• I decided to make my own set of improved macroes for bra, ket etc. which I use frequently, and some of the math macros (improved ofc.) that physics´ define. At this point, I am close to finish a package with the math macroes. But the physics ones... the code needs some updates and the documentation is non-existing. But I hope to make a package with it aswell. If you are interested, feel free send me a message. – Simon May 15 '19 at 15:35
• @Simon I'm not really interested, personally. This question was to see what others wish for and I had some spare time. But you still might publish it and post the link here. – Skillmon May 15 '19 at 16:12

Recently I took the effort of migrating my master thesis from using the physics package to its alternatives and my own macros.

Allow me to sum up my thoughts on the matter:

1. There should be no drop-in replacement for the physics package per se. This package is hell on Earth and it's the LaTeX equivalent to systemd. It tries to do so much without being good at anything.

2. On that note, LaTeX packages should follow the UNIX and KISS principles, they should do one thing and do it well. IMO, the new physics package should be broken down into several non-overlapping packages:

• derivatives (which is already well covered by diffcoeff)
• Dirac notation (which is already well covered by braket)
• matrices (which is already covered by amsmath)
• vector and vector operations (can be done manually but it would be nice to have a package with dedicated useful macros)
• quick quad text in math mode with common macros for if,iff,c.c.,ow (to be done)
• useful math functions defined by physics and not present in other common packages (to be done)
• automatic bracket resizing, i.e. physics' \qty (to be done)
• LaTeX has automatic bracket resizing: \left, \right – Skillmon Oct 2 '19 at 6:27
• @Skiimon, \left and \rightare such an ugly and annoying syntax to use. Surely something better can come up. Furthermore, the physics package does auto resizing for common functions such as \sin, \log, \exp, etc and that is the real replacement I am looking for since it is so convenient. – Rui Marques Oct 2 '19 at 13:33
• I won't overload \sin, \log, \exp, etc. Has too much potential to break things. An argument grabbing syntax for auto-sizing would be fine. But the way phyisics implements it (with varying syntax for the used braces/brackets) is one of the things the criticism of physics stems from, so this won't be done that way. – Skillmon Oct 2 '19 at 14:51
• What about instead of overloading, defining auto-resizing versions with a slightly different name, i.e. \Sin, \Log and \Exp? A well implemented \qty replacement would be a great start. – Rui Marques Oct 2 '19 at 15:44

Syntax for notating and globally changing accuracy and precision, and unit conversion. This might be beyond the scope of a physics package; it's also slightly outside the scope of siunitx. Still, it would be quite useful -- automatic unit conversion is used all the time in Wikipedia markup, and some journals require different default units. Maybe this would be a separate project.

• Thanks for the suggestion. Rounding precision is part of siunitx. Not sure what exactly the scope of unit conversion would be, and I'm not sure how an interface to set up the unit conversion should look like. – Skillmon Jul 22 '19 at 14:26
• Not just precision but accuracy (+/- 2sigma) is what I meant. And as with unit conversion, I think the point is that if and when a decent interface/package comes around, you should be ready to make any physics package compatible with it. A syntax for a dimensioned value would probably look like: \dimval{<number>}[<sigma>]{<units>} with <units> being a composition of any number of {unit_k}[exp_k]. I don't know how many different implementations of composing N units are viable in TeX, but I think I got the end result right. – Kompootor Jul 23 '19 at 14:24
• IIRC accuracy is also part of siunitx, and siunitx does have an interface to input units with exponents, it just has no unit conversion, it displays the units you input and doesn't change them to an equivalent notation of some sort (so if you input \si{\volt\ampere} it won't display \watt). I'm not sure what else you'd need. – Skillmon Jul 23 '19 at 16:26
• Looking at the docu more closely it seems both precision and accuracy are table formatting functions. Precision of course should not be part of a dimvalue primitive, but accuracy should ideally be part of a primitive in a future package. None of this is Physics since making dimvalue primitives is what makes unit conversion possible, but it's a tough problem to design and code, especially if you're not using LuaTex. So just note that a future primitive might look like this and require compatibility. – Kompootor Jul 23 '19 at 16:48
• you're misusing the term "primitive", which in TeX-lingo is a set of, well, primitives that are provided by TeX to build macros with, e.g. \def is a primitive. The option round-precision of siunitx is usable anywhere, not only in tables, as well as \pm for accuracy which is usable in any number formatting macro of siunitx`. – Skillmon Jul 23 '19 at 17:13