# Is there a programming language/API like documentation for common LaTeX packages (like amsmath)?

I just tried to figure out limitations (in a very abstract manner of the \sqrt makro in math package of LaTeX. Even after reading http://bay.uchicago.edu/tex-archive/macros/latex/required/amslatex/math/amsldoc.pdf it appears poorly documented (so poorly that I don't believe that so many production focused people use it without every having complain and/or improved it). How would I figure out from a technical absract documentation (not that sort of common example soaked package documentations) whether e.g. \sqrt can be broken over multiple lines? There has to be links to available containing environments, etc.

• texdoc amsmath returns (a local copy of) the user guide you link to. Perhaps you would prefer texdoc amsmath.pdf which returns a fully typeset document source of the package – David Carlisle Nov 5 '14 at 15:08
• for most latex packages texdoc _package_name_ will show the full source documentation, for some (notably amsmath and graphics) texdoc will by default return a more user oriented user guide, but the full documentation is always available. – David Carlisle Nov 5 '14 at 15:11
• to obtain a list of all recognized documentation related to a particular package, texdoc -l pkgname will return a list from which you can select the particular instance you want to look at. – barbara beeton Nov 5 '14 at 19:48

Well, texdef -t latex sqrt returns:

\long macro:->\@ifnextchar [\@sqrt \sqrtsign


This brings us to \sqrtsign (since we assume the optional argument is not present) and texdef -t latex sqrtsign returns:

\macro:->\radical "270370\relax


So you either open The TeXbook or go to the reference manual, where two keywords: rule and subformula tell you that the thing is unbreakable. Or you search this site for sqrt break and one of the results is How to break this long radical into multiple lines? which clearly shows that \sqrt construct is unbreakable.

Once you know the TeX programming layer, you can decode any definition and see what's inside. Or you just look for other sources. (As a side note, I don't see how breaking an \sqrt over multiple lines can even come up to someone's mind.)

• Thanks for that answer which fits very well to my question! To your side node: Imagine you want to stress precedences of operation, you'd want to write a long term under the root and then the simplication of that term and then extract the root, e.g. in \sqrt{1+2+3+4+5+6+7+8+9+1+2+3+4+5+6+7+8+9+8394238947923874} = \sqrt{8394238947923964} = 6\cdot sqrt(233173304108999) you might want to break the first term. – Karl Richter Nov 6 '14 at 19:52
• @KarlRichter Nobody will understand your broken sqrt notation. Just use (1+2+..........)^{1/2}, which can be broken into multiple lines without any problem and it wouldn't cause any trouble. – yo' Nov 7 '14 at 9:05