[R] Long equation in documentation

Duncan Murdoch murdoch.duncan at gmail.com
Mon Dec 10 13:41:51 CET 2012


On 12-12-10 12:02 AM, Tyler Rinker wrote:
>
> I have a long equation that I need to break in the R documentation of a package or it trails off the right hand side of the page. Here's the formula:
>
>
> \deqn{Cov(r_{ist}, r_{iuv})= [.5\rho_{ist}\rho_{iuv}(\rho_{isu}^2 + \rho_{isv}^2 + \rho_{itu}^2 + \rho_{itv}^2) + \rho_{isu}\rho_{itv}+ \rho_{isv}\rho_{itu}-(\rho_{ist}\rho_{isu}\rho_{isv} + \rho_{its}\rho_{itu}\rho_{itv}) + \rho_{ius}\rho_{iut}\rho_{iuv} + \rho_{ivs}\rho_{ivt}\rho_{ivu}]/n_i}
>
>
>
> How can I break the formula and optionally indent the second lower piece; though I'd settle for break it right now?
>
> Tyler Rinker
>
> Note:  Cross posted here after no viable answer on stackoverflow: http://stackoverflow.com/questions/13780190/break-long-formula-r-documentation
>


I don't know if there's a simple answer to this, but you would likely 
receive more answers if you made the question easier to answer, by 
posting complete code that people could try, not just a fragment.  Why 
not put together a minimal .Rd file and post that?

Here are two things to try:

Insert \cr where you want a break.

Decide what you want to see in the three formats (HTML, Latex, text) and 
manually handle each of them separately.

Duncan Murdoch




More information about the R-help mailing list