![如何制作以下矩阵?](https://linux22.com/image/292883/%E5%A6%82%E4%BD%95%E5%88%B6%E4%BD%9C%E4%BB%A5%E4%B8%8B%E7%9F%A9%E9%98%B5%EF%BC%9F.png)
我按照以下矩阵代码操作,但不起作用,因此需要一些指导来重现代码。我想制作以下矩阵(图像)?
我按照以下代码操作,但不起作用。请给我一些指导,以便重现以下代码。
\documentclass{article}
\usepackage{fancyvrb}
\usepackage{color}
\definecolor{darkblue}{rgb}{0.1,0.3,0.5}
\DefineVerbatimEnvironment%
{MyVerbatim}{Verbatim}
{gobble=0,label=\hspace{.85\textwidth},labelposition=all,
frame=single,framerule=3pt,framesep=5mm,rulecolor=\color{black}}
\begin{document}
\begin{minipage}{6cm}
\begin{MyVerbatim}
JHENM KA AG KEW GENAH BHERKATEY HAN (USER-U1_S1)
*** *** *** *** *** *** *** (USER-U1_S1)
Words: 7 Correct: 0 Errors: 7 Percent correct = 0.00\% Error = 100.00\% Accuracy = 0.00\%
Insertions: 0 Deletions: 7 Substitutions: 0
JHENM KA AG KEW GENAH bherkatey han (USER-U1_S2)
*** *** *** *** *** bherkatey han (USER-U1_S2)
Words: 7 Correct: 2 Errors: 5 Percent correct = 28.57\% Error = 71.43\% Accuracy = 28.57\%
Insertions: 0 Deletions: 5 Substitutions: 0
JHENM KA AG kew genah BHERKATEY HAN (USER-U1_S3)
*** *** *** kew genah *** *** (USER-U1_S3)
Words: 7 Correct: 2 Errors: 5 Percent correct = 28.57\% Error = 71.43\% Accuracy = 28.57\%
Insertions: 0 Deletions: 5 Substitutions: 0
ABELAS ANESAN KA deshemn hey (USER-U2_S3)
*** *** *** deshemn hey (USER-U2_S3)
Words: 5 Correct: 2 Errors: 3 Percent correct = 40.00\% Error = 60.00\% Accuracy = 40.00\%
Insertions: 0 Deletions: 3 Substitutions: 0
abelas ANESAN KA DESHEMN HEY (USER-U2_S4)
abelas *** *** *** *** (USER-U2_S4)
Words: 5 Correct: 1 Errors: 4 Percent correct = 20.00\% Error = 80.00\% Accuracy = 20.00\%
Insertions: 0 Deletions: 4 Substitutions: 0
TOTAL Words: 31 Correct: 7 Errors: 24
TOTAL Percent correct = 22.58\% Error = 77.42\% Accuracy = 22.58\%
TOTAL Insertions: 0 Deletions: 24 Substitutions: 0
\end{MyVerbatim}
\end{minipage}
\hfill
\end{document}
答案1
(精确的值可根据您的需要更改)。
\documentclass{article}
\usepackage{fancyvrb}
\usepackage{color}
\textwidth14cm
\definecolor{darkblue}{rgb}{0.1,0.3,0.5}
\DefineVerbatimEnvironment%
{MyVerbatim}{Verbatim}
{gobble=0,label=\hspace{.85\textwidth},labelposition=all,
frame=single,framerule=3pt,framesep=5mm,rulecolor=\color{black}}
\begin{document}
\begin{minipage}{0.9\textwidth}
\begin{MyVerbatim}
JHENM KA AG KEW GENAH BHERKATEY HAN (USER-U1_S1)
*** *** *** *** *** *** *** (USER-U1_S1)
Words: 7 Correct: 0 Errors: 7 Percent correct = 0.00\% Error =
100.00\% Accuracy = 0.00\%
Insertions: 0 Deletions: 7 Substitutions: 0
JHENM KA AG KEW GENAH bherkatey han (USER-U1_S2)
*** *** *** *** *** bherkatey han (USER-U1_S2)
Words: 7 Correct: 2 Errors: 5 Percent correct = 28.57\% Error =
71.43\% Accuracy = 28.57\%
Insertions: 0 Deletions: 5 Substitutions: 0
JHENM KA AG kew genah BHERKATEY HAN (USER-U1_S3)
*** *** *** kew genah *** *** (USER-U1_S3)
Words: 7 Correct: 2 Errors: 5 Percent correct = 28.57\% Error =
71.43\% Accuracy = 28.57\%
Insertions: 0 Deletions: 5 Substitutions: 0
ABELAS ANESAN KA deshemn hey (USER-U2_S3)
*** *** *** deshemn hey (USER-U2_S3)
Words: 5 Correct: 2 Errors: 3 Percent correct = 40.00\% Error =
60.00\% Accuracy = 40.00\%
Insertions: 0 Deletions: 3 Substitutions: 0
abelas ANESAN KA DESHEMN HEY (USER-U2_S4)
abelas *** *** *** *** (USER-U2_S4)
Words: 5 Correct: 1 Errors: 4 Percent correct = 20.00\% Error =
80.00\% Accuracy = 20.00\%
Insertions: 0 Deletions: 4 Substitutions: 0
TOTAL Words: 31 Correct: 7 Errors: 24
TOTAL Percent correct = 22.58\% Error =
77.42\% Accuracy = 22.58\%
TOTAL Insertions: 0 Deletions: 24 Substitutions: 0
\end{MyVerbatim}
\end{minipage}
\hfill
\end{document}
带圆括号的版本(红色的,绿色的来自fancyvrb
):
\documentclass{article}
\usepackage{fancyvrb}
\usepackage{color}
\textwidth14cm
\definecolor{darkblue}{rgb}{0.1,0.3,0.5}
\DefineVerbatimEnvironment%
{MyVerbatim}{Verbatim}
{gobble=0,label=\hspace{.85\textwidth},labelposition=all,
frame=single,framerule=3pt,framesep=5mm,rulecolor=\color{green}}
\begin{document}
$\color{red}\left(\color{black}
\begin{minipage}{0.9\textwidth}
\begin{MyVerbatim}
JHENM KA AG KEW GENAH BHERKATEY HAN (USER-U1_S1)
*** *** *** *** *** *** *** (USER-U1_S1)
Words: 7 Correct: 0 Errors: 7 Percent correct = 0.00\% Error =
100.00\% Accuracy = 0.00\%
Insertions: 0 Deletions: 7 Substitutions: 0
JHENM KA AG KEW GENAH bherkatey han (USER-U1_S2)
*** *** *** *** *** bherkatey han (USER-U1_S2)
Words: 7 Correct: 2 Errors: 5 Percent correct = 28.57\% Error =
71.43\% Accuracy = 28.57\%
Insertions: 0 Deletions: 5 Substitutions: 0
JHENM KA AG kew genah BHERKATEY HAN (USER-U1_S3)
*** *** *** kew genah *** *** (USER-U1_S3)
Words: 7 Correct: 2 Errors: 5 Percent correct = 28.57\% Error =
71.43\% Accuracy = 28.57\%
Insertions: 0 Deletions: 5 Substitutions: 0
ABELAS ANESAN KA deshemn hey (USER-U2_S3)
*** *** *** deshemn hey (USER-U2_S3)
Words: 5 Correct: 2 Errors: 3 Percent correct = 40.00\% Error =
60.00\% Accuracy = 40.00\%
Insertions: 0 Deletions: 3 Substitutions: 0
abelas ANESAN KA DESHEMN HEY (USER-U2_S4)
abelas *** *** *** *** (USER-U2_S4)
Words: 5 Correct: 1 Errors: 4 Percent correct = 20.00\% Error =
80.00\% Accuracy = 20.00\%
Insertions: 0 Deletions: 4 Substitutions: 0
TOTAL Words: 31 Correct: 7 Errors: 24
TOTAL Percent correct = 22.58\% Error =
77.42\% Accuracy = 22.58\%
TOTAL Insertions: 0 Deletions: 24 Substitutions: 0
\end{MyVerbatim}
\end{minipage}
\color{red}\right)$
\hfill
\end{document}
答案2
另一个选项是tcolorbox
及其listings
库。当然,它需要调整括号的颜色和宽度。
\documentclass[border=3mm]{standalone}
\usepackage[most]{tcolorbox}
\definecolor{darkblue}{rgb}{0.1,0.3,0.5}
\tikzset{myborderline/.style=%
{rounded corners=7mm, line width=5pt, draw=green!80!black!40}
}
\newtcblisting{myarray}{empty, notitle, arc=7mm, listing only,%
overlay unbroken = {%
\draw[myborderline] ([xshift=8mm]frame.north west)%
-| (frame.west) |- ([xshift=8mm]frame.south west);
\draw[myborderline] ([xshift=-8mm]frame.north east)%
-| (frame.east) |- ([xshift=-8mm]frame.south east);
},
listing options={language={}, basicstyle=\ttfamily\small, breaklines=true}
}
\begin{document}
\begin{myarray}
JHENM KA AG KEW GENAH BHERKATEY HAN (USER-U1_S1)
*** *** *** *** *** *** *** (USER-U1_S1)
Words: 7 Correct: 0 Errors: 7 Percent correct = 0.00% Error = 100.00% Accuracy = 0.00%
Insertions: 0 Deletions: 7 Substitutions: 0
JHENM KA AG KEW GENAH bherkatey han (USER-U1_S2)
*** *** *** *** *** bherkatey han (USER-U1_S2)
Words: 7 Correct: 2 Errors: 5 Percent correct = 28.57% Error = 71.43% Accuracy = 28.57%
Insertions: 0 Deletions: 5 Substitutions: 0
JHENM KA AG kew genah BHERKATEY HAN (USER-U1_S3)
*** *** *** kew genah *** *** (USER-U1_S3)
Words: 7 Correct: 2 Errors: 5 Percent correct = 28.57% Error = 71.43% Accuracy = 28.57%
Insertions: 0 Deletions: 5 Substitutions: 0
ABELAS ANESAN KA deshemn hey (USER-U2_S3)
*** *** *** deshemn hey (USER-U2_S3)
Words: 5 Correct: 2 Errors: 3 Percent correct = 40.00% Error = 60.00% Accuracy = 40.00%
Insertions: 0 Deletions: 3 Substitutions: 0
abelas ANESAN KA DESHEMN HEY (USER-U2_S4)
abelas *** *** *** *** (USER-U2_S4)
Words: 5 Correct: 1 Errors: 4 Percent correct = 20.00% Error = 80.00% Accuracy = 20.00%
Insertions: 0 Deletions: 4 Substitutions: 0
TOTAL Words: 31 Correct: 7 Errors: 24
TOTAL Percent correct = 22.58% Error = 77.42% Accuracy = 22.58%
TOTAL Insertions: 0 Deletions: 24 Substitutions: 0
\end{myarray}
\end{document}
更新如果要调整图形大小,可以使用\resizebox
命令(来自graphicx
已加载的包tcolorbox
)。但由于列表环境不能用作命令参数,lrbox
需要一个(最后一句话和解决方案取自大卫·卡莱尔回答到与 listing 包一起使用时,tikzpicture 的 resizebox 会失败)。下面的代码显示了一个例子:
\documentclass{article}
\usepackage[most]{tcolorbox}
\usepackage{lipsum}
\definecolor{darkblue}{rgb}{0.1,0.3,0.5}
\tikzset{myborderline/.style=%
{rounded corners=7mm, line width=5pt, draw=green!80!black!40}
}
\newtcblisting{myarray}{empty, notitle, arc=7mm, listing only,%
overlay unbroken = {%
\draw[myborderline] ([xshift=8mm]frame.north west)%
-| (frame.west) |- ([xshift=8mm]frame.south west);
\draw[myborderline] ([xshift=-8mm]frame.north east)%
-| (frame.east) |- ([xshift=-8mm]frame.south east);
},
listing options={language={}, basicstyle=\ttfamily\small, breaklines=true}
}
\begin{document}
\lipsum[1]
\begin{lrbox}{0}%
\begin{myarray}
JHENM KA AG KEW GENAH BHERKATEY HAN (USER-U1_S1)
*** *** *** *** *** *** *** (USER-U1_S1)
Words: 7 Correct: 0 Errors: 7 Percent correct = 0.00% Error = 100.00% Accuracy = 0.00%
Insertions: 0 Deletions: 7 Substitutions: 0
JHENM KA AG KEW GENAH bherkatey han (USER-U1_S2)
*** *** *** *** *** bherkatey han (USER-U1_S2)
Words: 7 Correct: 2 Errors: 5 Percent correct = 28.57% Error = 71.43% Accuracy = 28.57%
Insertions: 0 Deletions: 5 Substitutions: 0
JHENM KA AG kew genah BHERKATEY HAN (USER-U1_S3)
*** *** *** kew genah *** *** (USER-U1_S3)
Words: 7 Correct: 2 Errors: 5 Percent correct = 28.57% Error = 71.43% Accuracy = 28.57%
Insertions: 0 Deletions: 5 Substitutions: 0
ABELAS ANESAN KA deshemn hey (USER-U2_S3)
*** *** *** deshemn hey (USER-U2_S3)
Words: 5 Correct: 2 Errors: 3 Percent correct = 40.00% Error = 60.00% Accuracy = 40.00%
Insertions: 0 Deletions: 3 Substitutions: 0
abelas ANESAN KA DESHEMN HEY (USER-U2_S4)
abelas *** *** *** *** (USER-U2_S4)
Words: 5 Correct: 1 Errors: 4 Percent correct = 20.00% Error = 80.00% Accuracy = 20.00%
Insertions: 0 Deletions: 4 Substitutions: 0
TOTAL Words: 31 Correct: 7 Errors: 24
TOTAL Percent correct = 22.58% Error = 77.42% Accuracy = 22.58%
TOTAL Insertions: 0 Deletions: 24 Substitutions: 0
\end{myarray}%
\end{lrbox}
\begin{center}
\resizebox{.5\linewidth}{!}{\usebox0}
\end{center}
\lipsum[2]
\end{document}