1

I follow the following code for the Matrices but it's not working so need some guidance to reproduce the code. I want to make the following Matrices (image)? enter image description here

I follow the following code but it's not working. So give me some guidance to reproduce the following code.

\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

(The precise values are to change according to your needs).

\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} 

enter image description here

And the version with rounded parentheses (Red ones. Green are from 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} 

enter image description here

| improve this answer | |
  • it's possible to change the bracket style. – Micky K Jun 19 '14 at 5:00
  • 1
    @LaTeXKhan If it was a question, please see the second version. – Przemysław Scherwentke Jun 19 '14 at 5:49
  • how i remove the just square brackets – Micky K Jun 19 '14 at 6:17
  • @LaTeXKhan They a defined by the line frame=single,framerule=3pt,framesep=5mm,rulecolor=\color{green}, so you can remove it, leaving the final, second }. – Przemysław Scherwentke Jun 19 '14 at 6:19
  • How can i adjust the size of above matrix. I am interested to small the size of about matrix – Micky K Jun 19 '14 at 9:26
3

Another option with tcolorbox and its listings library. Of course, it needs to adjust brackets color and width.

\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} 

enter image description here

Update If you want to resize the figure it's possible to use \resizebox command (from graphicx package which is already loaded by tcolorbox). But because listings environments cannot be used as command argument an lrbox is needed (this last sentence and solution was taken from David Carlisle answer to resizebox fails for tikzpicture when used in conjunction with listing package). Next code shows an example:

\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} 

enter image description here

| improve this answer | |
  • Now I'm interested to reduce the size of Matrix – Micky K Jun 19 '14 at 9:39
  • @LaTeXKhan What does it means? If changing fontsize is enough, do it: basicstyle=\ttfamily\tiny. If you want to resaize the whole box could use \resizebox. – Ignasi Jun 19 '14 at 10:06
  • Yes I'm re-sizing the whole Matrix. – Micky K Jun 19 '14 at 10:15
  • 1
    @LaTeXKhan I've added an example with resizebox – Ignasi Jun 19 '14 at 11:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.