我对两列幻灯片中的代码对齐有疑问。
这是我的这张幻灯片的代码,
--- &twocol
## Sample R Codes
*** =left
```{r, echo=FALSE}
options(width=30)
```
```{r, fig.height=5.5,highlight=TRUE, fig.show='hide',tidy=TRUE}
mvreg.sim <- function(xcov,beta1=matrix(c(0.7, 0.2, 0.2, 0.7),
nr = 2, nc = 2), err.mu=c(0,0),
err.sigma=matrix(c(100,0,0,100), nr=2)){
library(mvtnorm)
N <- nrow(xcov)
e <- rmvnorm(N, mean = err.mu, sigma = err.sigma)
y <- matrix(NA, nrow = N, ncol = 2)
for(i in 1:N){
y[i,] <- (xcov[i,])%*%beta1 + e[i,]
}
return(y)
}
```
*** =right
This is the explanation of the plot.
```{r, fig.height=5.5,highlight=TRUE,echo=FALSE}
x <- seq(0,10, by = 0.01)
y <- x
plot(x, sin(y), xlab = 'x-axis', ylab = 'sin(x)', main = 'Sample Plot')
```
我是新来的,对 html 知之甚少。我使用tidy=TRUE
withoptions(width=60)
来控制框内代码的宽度,但对齐方式会受到影响。我希望对齐设置为右对齐。任何帮助是极大的赞赏。