![我怎样才能将“R 输出:”字样中的 R 替换成我通过 \Rlogo 定义的图片呢?](https://linux22.com/image/437685/%E6%88%91%E6%80%8E%E6%A0%B7%E6%89%8D%E8%83%BD%E5%B0%86%E2%80%9CR%20%E8%BE%93%E5%87%BA%EF%BC%9A%E2%80%9D%E5%AD%97%E6%A0%B7%E4%B8%AD%E7%9A%84%20R%20%E6%9B%BF%E6%8D%A2%E6%88%90%E6%88%91%E9%80%9A%E8%BF%87%20%5CRlogo%20%E5%AE%9A%E4%B9%89%E7%9A%84%E5%9B%BE%E7%89%87%E5%91%A2%EF%BC%9F.png)
以下是我的代码:
\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}