以下是我的代码:
\documentclass{article}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\newcommand{\Rlogo}{\protect\includegraphics[height=1.8ex,keepaspectratio]{Rlogo.png}}
\usepackage{listings}
\usepackage[english,noautotitles-r,countbylistings]{SASnRdisplay}
\lstdefinestyle{r-output}{
style = r-style,
style = r-output-user
}
\lstdefinestyle{r-frame}{
frame = single,
framesep = 0.0em
}
\begin{document}
\inputRoutput*[caption={ththyeyyyedhfhfh} ,numbers=left,numberstyle=\tiny,label=code:r-out]{A2Output.txt}
\end{document}
以下是 A2Output.txt 的内容:
> S1
[,1] [,2]
[1,] 2.333333 0.5
[2,] 0.500000 1.0
> S2
[,1] [,2]
[1,] 1.0 1.500000
[2,] 1.5 2.333333
> Sp
[,1] [,2]
[1,] 1.666667 1.000000
[2,] 1.000000 1.666667
#(a)(ii)
> T2
[,1]
[1,] 2.218671e-31
> c2
[1] 7.708647
#(b)(i)
> Xbar
[1] 192.0 278.4
> S
[,1] [,2]
[1,] 121.77778 76.33333
[2,] 76.33333 92.93333
答案1
列表的名称受 管辖\SnRRoutputname
,因此您可以
\renewcommand{\SnRRoutputname}{\Rlogo}
但是,这会给你留下一个编号\Rlogo
。根据你的设置,使用可能更容易title={\Rlogo: <caption>}
:
\documentclass{article}
\begin{filecontents*}{A2Output.txt}
> S1
[,1] [,2]
[1,] 2.333333 0.5
[2,] 0.500000 1.0
> S2
[,1] [,2]
[1,] 1.0 1.500000
[2,] 1.5 2.333333
> Sp
[,1] [,2]
[1,] 1.666667 1.000000
[2,] 1.000000 1.666667
#(a)(ii)
> T2
[,1]
[1,] 2.218671e-31
> c2
[1] 7.708647
#(b)(i)
> Xbar
[1] 192.0 278.4
> S
[,1] [,2]
[1,] 121.77778 76.33333
[2,] 76.33333 92.93333
\end{filecontents*}
\newcommand{\Rlogo}{\protect\includegraphics[height=1.8ex,keepaspectratio]{example-image}}
\usepackage{listings,graphicx}
\usepackage[english,noautotitles-r,countbylistings]{SASnRdisplay}
\lstdefinestyle{r-output}{
style = r-style,
style = r-output-user
}
\lstdefinestyle{r-frame}{
frame = single,
framesep = 0.0em
}
\begin{document}
\inputRoutput*[
title={\Rlogo: ththyeyyyedhfhfh},
numbers=left,
numberstyle=\tiny
]{A2Output.txt}
\end{document}