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