你有什么问题?
目前我有这个矩阵:
现在我想对这个矩阵进行求和,通过在右边添加一个箭头来描述我正在做的事情,就像这样:
您已尝试过什么?
嗯,我发现带箭头包,但我不明白应该如何使用它。
最少的代码
第一张图片中的代码
\documentclass[a4paper, 12pt]{scrartcl}
% =============
% Packages
% =============
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc} % west european chars
\usepackage{amsmath, amsthm, amssymb} % math symbols
\usepackage{blkarray}
\parskip5pt
\parindent0pt
% ------------
% Content
% ------------
\begin{document}
\begin{align*}
\begin{blockarray}{ccccccc}
\begin{block}{(ccc|ccc)c}
1 & 5 & 4 & 1 & 0 & 0 & | \cdot 2\\
3 & 5 & 6 & 0 & 1 & 0 & \\
1 & 2 & 4 & 0 & 0 & 1 &
\end{block}
\end{blockarray}
\end{align*}
\end{document}
第二张图片中的代码
这就是我尝试应用witharrows
矩阵的方法:
\documentclass[a4paper, 12pt]{scrartcl}
% =============
% Packages
% =============
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc} % west european chars
\usepackage{amsmath, amsthm, amssymb} % math symbols
\usepackage{blkarray}
\usepackage{witharrows}
\parskip5pt
\parindent0pt
% ------------
% Content
% ------------
\begin{document}
\begin{align*}
\begin{blockarray}{ccccccc}
\begin{block}{(ccc|ccc)c}
\begin{WithArrows}[c]
1 & 5 & 4 & 1 & 0 & 0 & | \cdot 2 \Arrow{test}\\
3 & 5 & 6 & 0 & 1 & 0 &
1 & 2 & 4 & 0 & 0 & 1 &\\
\end{WithArrows}
\end{block}
\end{blockarray}
\end{align*}
\end{document}
但我收到了一堆错误。
编辑
以下是错误消息:
Document.tex|30 error| Package witharrows Error: Your environment {WithArrows} has 2 columns and you try to use one more. Maybe you have forgotten a \\. If you really want to use more you should use the option 'more-columns' at a global level or for an environment. However, you can go one for this time.
Document.tex|30 error| Package witharrows Error: Your environment {WithArrows} has 2 columns and you try to use one more. Maybe you have forgotten a \\. If you really want to use more you should use the option 'more-columns' at a global level or for an environment. However, you can go one for this time.
Document.tex|30 error| Package witharrows Error: Your environment {WithArrows} has 2 columns and you try to use one more. Maybe you have forgotten a \\. If you really want to use more you should use the option 'more-columns' at a global level or for an environment. However, you can go one for this time.
Document.tex|30 error| Package witharrows Error: Your environment {WithArrows} has 2 columns and you try to use one more. Maybe you have forgotten a \\. If you really want to use more you should use the option 'more-columns' at a global level or for an environment. However, you can go one for this time.
Document.tex|30 error| Package witharrows Error: Your environment {WithArrows} has 2 columns and you try to use one more. Maybe you have forgotten a \\. If you really want to use more you should use the option 'more-columns' at a global level or for an environment. However, you can go one for this time.
Document.tex|30 error| Package witharrows Error: You should use the command \Arrow only in the last of your environment {WithArrows}. However you can go on for this time.
Document.tex|30 error| Package witharrows Error: Your environment {WithArrows} has 2 columns and you try to use one more. Maybe you have forgotten a \\. If you really want to use more you should use the option 'more-columns' at a global level or for an environment. However, you can go one for this time.
Document.tex|30 error| Package witharrows Error: Your environment {WithArrows} has 2 columns and you try to use one more. Maybe you have forgotten a \\. If you really want to use more you should use the option 'more-columns' at a global level or for an environment. However, you can go one for this time.
Document.tex|30 error| Package witharrows Error: Your environment {WithArrows} has 2 columns and you try to use one more. Maybe you have forgotten a \\. If you really want to use more you should use the option 'more-columns' at a global level or for an environment. However, you can go one for this time.
Document.tex|30 error| Package witharrows Error: Your environment {WithArrows} has 2 columns and you try to use one more. Maybe you have forgotten a \\. If you really want to use more you should use the option 'more-columns' at a global level or for an environment. However, you can go one for this time.
Document.tex|30 error| Package witharrows Error: Your environment {WithArrows} has 2 columns and you try to use one more. Maybe you have forgotten a \\. If you really want to use more you should use the option 'more-columns' at a global level or for an environment. However, you can go one for this time.
Document.tex|30 error| Package witharrows Error: Your environment {WithArrows} has 2 columns and you try to use one more. Maybe you have forgotten a \\. If you really want to use more you should use the option 'more-columns' at a global level or for an environment. However, you can go one for this time.
Document.tex|30 error| Package witharrows Error: Your environment {WithArrows} has 2 columns and you try to use one more. Maybe you have forgotten a \\. If you really want to use more you should use the option 'more-columns' at a global level or for an environment. However, you can go one for this time.
Document.tex|30 error| Package witharrows Error: Your environment {WithArrows} has 2 columns and you try to use one more. Maybe you have forgotten a \\. If you really want to use more you should use the option 'more-columns' at a global level or for an environment. However, you can go one for this time.
Document.tex|30 error| Package witharrows Error: Your environment {WithArrows} has 2 columns and you try to use one more. Maybe you have forgotten a \\. If you really want to use more you should use the option 'more-columns' at a global level or for an environment. However, you can go one for this time.
Document.tex|30 error| Package witharrows Error: Your environment {WithArrows} has 2 columns and you try to use one more. Maybe you have forgotten a \\. If you really want to use more you should use the option 'more-columns' at a global level or for an environment. However, you can go one for this time.
Document.tex|30 error| Package witharrows Error: Your environment {WithArrows} has 2 columns and you try to use one more. Maybe you have forgotten a \\. If you really want to use more you should use the option 'more-columns' at a global level or for an environment. However, you can go one for this time.
Document.tex|30 error| Package witharrows Error: The environments of witharrows ({WithArrows} and should not end by \\. However, you can go on for this time. No similar error will be raised in this document.
Document.tex|30 error| Misplaced \noalign.
Document.tex|30 error| Package witharrows Error: Your environment {WithArrows} has 2 columns and you try to use one more. Maybe you have forgotten a \\. If you really want to use more you should use the option 'more-columns' at a global level or for an environment. However, you can go one for this time.
Document.tex|30 error| Package witharrows Error: Your environment {WithArrows} has 2 columns and you try to use one more. Maybe you have forgotten a \\. If you really want to use more you should use the option 'more-columns' at a global level or for an environment. However, you can go one for this time.
Document.tex|30 error| Package witharrows Error: Your environment {WithArrows} has 2 columns and you try to use one more. Maybe you have forgotten a \\. If you really want to use more you should use the option 'more-columns' at a global level or for an environment. However, you can go one for this time.
Document.tex|30 error| Package witharrows Error: Your environment {WithArrows} has 2 columns and you try to use one more. Maybe you have forgotten a \\. If you really want to use more you should use the option 'more-columns' at a global level or for an environment. However, you can go one for this time.
Document.tex|30 error| Package witharrows Error: Your environment {WithArrows} has 2 columns and you try to use one more. Maybe you have forgotten a \\. If you really want to use more you should use the option 'more-columns' at a global level or for an environment. However, you can go one for this time.
Document.tex|30 error| Package witharrows Error: You should use the command \Arrow only in the last of your environment {WithArrows}. However you can go on for this time.
Document.tex|30 error| Package witharrows Error: Your environment {WithArrows} has 2 columns and you try to use one more. Maybe you have forgotten a \\. If you really want to use more you should use the option 'more-columns' at a global level or for an environment. However, you can go one for this time.
Document.tex|30 error| Package witharrows Error: Your environment {WithArrows} has 2 columns and you try to use one more. Maybe you have forgotten a \\. If you really want to use more you should use the option 'more-columns' at a global level or for an environment. However, you can go one for this time.
Document.tex|30 error| Package witharrows Error: Your environment {WithArrows} has 2 columns and you try to use one more. Maybe you have forgotten a \\. If you really want to use more you should use the option 'more-columns' at a global level or for an environment. However, you can go one for this time.
Document.tex|30 error| Package witharrows Error: Your environment {WithArrows} has 2 columns and you try to use one more. Maybe you have forgotten a \\. If you really want to use more you should use the option 'more-columns' at a global level or for an environment. However, you can go one for this time.
Document.tex|30 error| Package witharrows Error: Your environment {WithArrows} has 2 columns and you try to use one more. Maybe you have forgotten a \\. If you really want to use more you should use the option 'more-columns' at a global level or for an environment. However, you can go one for this time.
Document.tex|30 error| Package witharrows Error: Your environment {WithArrows} has 2 columns and you try to use one more. Maybe you have forgotten a \\. If you really want to use more you should use the option 'more-columns' at a global level or for an environment. However, you can go one for this time.
Document.tex|30 error| Package witharrows Error: Your environment {WithArrows} has 2 columns and you try to use one more. Maybe you have forgotten a \\. If you really want to use more you should use the option 'more-columns' at a global level or for an environment. However, you can go one for this time.
Document.tex|30 error| Package witharrows Error: Your environment {WithArrows} has 2 columns and you try to use one more. Maybe you have forgotten a \\. If you really want to use more you should use the option 'more-columns' at a global level or for an environment. However, you can go one for this time.
Document.tex|30 error| Package witharrows Error: Your environment {WithArrows} has 2 columns and you try to use one more. Maybe you have forgotten a \\. If you really want to use more you should use the option 'more-columns' at a global level or for an environment. However, you can go one for this time.
Document.tex|30 error| Package witharrows Error: Your environment {WithArrows} has 2 columns and you try to use one more. Maybe you have forgotten a \\. If you really want to use more you should use the option 'more-columns' at a global level or for an environment. However, you can go one for this time.
Document.tex|30 error| Package witharrows Error: Your environment {WithArrows} has 2 columns and you try to use one more. Maybe you have forgotten a \\. If you really want to use more you should use the option 'more-columns' at a global level or for an environment. However, you can go one for this time.
Document.tex|30 error| Misplaced \noalign.
答案1
如果你使用包(见下文)可能会更好nicematrix
,但你也可以用 Ti 添加箭头钾Z 和tikzmark
图书馆。
\documentclass[a4paper, 12pt]{scrartcl}
% =============
% Packages
% =============
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc} % west european chars
\usepackage{amsmath, amsthm, amssymb} % math symbols
\usepackage{blkarray}
\usepackage{tikz}
\usetikzlibrary{tikzmark}
\parskip5pt
\parindent0pt
% ------------
% Content
% ------------
\begin{document}
\begin{align*}
\begin{blockarray}{ccccccc}
\begin{block}{(ccc|ccc)c}
1 & 5 & 4 & 1 & 0 & 0 & \tikzmarknode{times2}{| \cdot 2}\\
3 & 5 & 6 & 0 & 1 & 0 & \\
1 & 2 & 4 & 0 & 0 & \tikzmarknode{1}{1} &\\
\end{block}
\end{blockarray}
\begin{tikzpicture}[overlay,remember picture]
\draw[cyan,semithick,-latex] (times2.east) -- ++ (1em,0)
|- node[pos=0.25,right]{$(+)$} (times2.west|-1);
\end{tikzpicture}
\end{align*}
\end{document}
它nicematrix
的工作原理非常相似。请注意,此代码需要最新版本(截至 2021 年 4 月)的软件包。
\documentclass[a4paper, 12pt]{scrartcl}
\usepackage{tikz}
\usepackage{nicematrix}
\begin{document}
\[
\begin{pNiceArray}{ccc|ccc}[last-col]
1 & 5 & 4 & 1 & 0 & 0 & | \cdot 2\\
3 & 5 & 6 & 0 & 1 & 0 & \\
1 & 2 & 4 & 0 & 0 & 1 &\\
\CodeAfter
\begin{tikzpicture}
\draw[cyan,semithick,-latex] (1-7.east) -- ++ (1em,0)
|- node[pos=0.25,right]{$(+)$} (1-7.west|-3-6);
\end{tikzpicture}
\end{pNiceArray}
\]
\end{document}
答案2
A short code
with pstricks`:我定义两个节点,并将它们与相关节点连接起来。
\documentclass[svgnames]{article}
\usepackage[T1]{fontenc}
\usepackage{mathtools}
\usepackage{blkarray, bigstrut}
\usepackage{pst-node}
\begin{document}%
\begin{align*}
& \begin{blockarray}{(ccc|ccc)l}
1 & 5 & 4 & 1 & 0 & 0\bigstrut[t] & \rnode{A}{| \cdot 2}\\
3 & 5 & 6 & 0 & 1 & 0 & \\
1 & 2 & 4 & 0 & 0 & 1 & \pnode[0,0.5ex]{B}
\end{blockarray}
\ncbar[linecolor=Cyan, linejoin=1, arrowinset =0, nodesepA=2pt]{->}{A}{B}\naput{\color{Cyan}({+})}
\end{align*}
\end{document}