I found writing matrix's code is a boring work. There is one, you can see in pic below.
Can anybody help?
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It only takes a minute to sign up.
Sign up to join this communityThis is definitely possible when using the blkarray
package. Here's a mock-up with some index styling (in \scriptsize
):
\documentclass{article}
\usepackage{blkarray}% http://ctan.org/pkg/blkarray
\newcommand{\matindex}[1]{\mbox{\scriptsize#1}}% Matrix index
\begin{document}
\[
A=\begin{blockarray}{ccc}
\matindex{1} & \matindex{2} & \\
\begin{block}{(cc)c}
a & b & \matindex{3} \\
c & d & \matindex{4} \\
e & f & \\
\end{block}
\end{blockarray}
\]
\end{document}
This would also be doable using a plain array
, but would require additional vertical alignment/compensation, perhaps removing some of the code readability that exists via blkarray
.
The package nicematrix
has tools to address that kind of problem.
\documentclass{article}
\usepackage{nicematrix}
\begin{document}
\[
\NiceMatrixOptions{code-for-first-row=\scriptstyle,code-for-last-row=\scriptstyle}
A=\begin{pNiceMatrix}[first-row,last-col=3]
1 & 2 & \\
a & b & 3 \\
c & d & 4 \\
e & f & \\
\end{pNiceMatrix}
\]
\end{document}
\matrix
command?blkarray
package may provide help (Was I wrong?) from your links. But there is a large warning in its PDF document's. Can I use it without leading to any incompatibility?