该代码来自Knitr Texstudio的大块
我在Texstudio中使用Knitr将我的R脚本包括在文档中,但问题是我的代码来自颜色块背景
这是我的代码示例
\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\begin{document}
<<>>=
library(equatiomatic)
summary(cars)
extract_eq(lm(dist~speed,cars))
@
<<>>=
x <- rnorm(100)
y <- rnorm(100)
@
Throughout history, many people have wondered about the means of $x$ and $y$.
Today we can provide some answers. The mean of $x$ is approximately
\Sexpr{extract_eq(lm(dist~speed,cars))}. The mean of $y$ is approximately \Sexpr{round(mean(y), 3)}.
References
\end{document
I use knitr in texstudio to include my R script into my document, but the problem is my code comes out of the color chunk background
This is my code example
\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\begin{document}
<<>>=
library(equatiomatic)
summary(cars)
extract_eq(lm(dist~speed,cars))
@
<<>>=
x <- rnorm(100)
y <- rnorm(100)
@
Throughout history, many people have wondered about the means of $x$ and $y$.
Today we can provide some answers. The mean of $x$ is approximately
\Sexpr{extract_eq(lm(dist~speed,cars))}. The mean of $y$ is approximately \Sexpr{round(mean(y), 3)}.
References
\end{document
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论