-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Align symbolic and numeric matrices #66
Comments
Some related notes on this:
Also, the default for |
Hi Michael, From my experience aligning symbols above matrices is awkward, at least if you want them centered. If you're okay with right aligning adding a few more '&' can work. Eqn("\\mathbf{S} & = & \\mathbf{V} & &\\mathbf{\\Lambda} & &\\mathbf{V}^\\top", Eqn_newline(),
latexMatrix(S), "& = & ", latexMatrix(V), "& &", diag(Lambda), "& &", latexMatrix(V, transpose=TRUE),
align = TRUE) To get the symbols middle aligned you'd need to add '&' within the matrices themselves. I can take a stab at this later (right now family responsibilities are calling....). |
It's been awhile since I thought about this.
I think that to get everything you want in an automatic way would require a complete redesign of the how the row/column names are handled. OTOH patching the current approach should be feasible but more complicated to use. |
OK, I wasn't proposing anything in the way of re-design, just making some observations. I can try to work around-- e.g., by explicitly using The main point had to do with alignment. |
I was able to quickly implement much of what you want at the expense of additional complexity. For example,
There are several new options that control default behaviour; see the code and help file for details. I didn't implement changing the size of the row/column labels text for the reason I mentioned previously. The changes are in the GitHub repo for the package. My testing was cursory, so the code should be exercised more. |
If you want horizontal alignment to work when mixing matrices some of which have column labels and some not, I think you'll have to define empty column labels (e.g., I don't really understand why vertical alignment is so difficult. I'd be tempted simply to align on |
I screwed around a bit with the size of the row/column labels, and the effect wasn't as extreme as I expected, so I added a
So, more flexibility at the expense of a bit more complexity. |
Hi John Your solution looks nice, but it turns out vs. Codecogs, whatever that is So, I'm not sure what to do about this commit, 30992cf Your example works fine with just |
Why dispense with it rather than just not using it if the target is an html document to be processed by mathjax? BTW, the text size commands don't work in math mode, so not with, e.g., Another thought: There are now too many (7) options used by |
I went ahead and consolidated the Feel free to remove the |
Starting to use
latexMatrix()
and friends in my book. I ran into a little problem with aligning two equations, one symbolic and the other numeric. My test file isdev/eigen-ex.R
Goal: show the eigen decomposition of a cov matrix, with a numeric example, ie,
S = V Lambda V^T
where,
I tried using
\phantom{}
to give the symbolic part look like "S = V Lambda V^T"(fiddling with the size of the phantom)
which gives:
Note too bad, but very fiddly. Is there a better LaTeX way? I tried other alignment (
&
) tabs, but there'ssomething I don't understand.
Gives:
I think this is more of a LaTeX issue, than a problem in the package.
I looked at
Eqn_hspace()
, but couldn't figure out how to make it work in this context, because the function and docs related to alignment around=
.The text was updated successfully, but these errors were encountered: