向数组添加注释

向数组添加注释

我想要这样的东西,只要不丑就行(我是用油漆做的,不要评判!)

由于 Gimp 安装失败,PAINT 添加了丑陋的评论

我与 Tikz 的斗争非常艰难。有人能给我一些建议,让我做点类似的东西吗,最好是用 Tikz?我愿意接受所有建议。

谢谢你的时间!

[编辑] 添加代码!

\section*{\texorpdfstring{An Example: The Single-Fault,\\ 3-Component System}}

    To motivate the discussion, consider the single-fault, 3-component system. By construction we know the state variable for the original system with no swapped components is $0,0,0$, and we are given that the output is 0. Let's consider the case where the third component, $C_3$, is faulty. The truth table with the encoding above and the givens is:


\[ \begin{array}{ccc|c}
C_1&C_2&C_3 & Result \\           \hline
0&0&0&\mathbf{0}\tikzmark{byconstruction} \\  \hline
0&0&1&\mathbf{1}\\ \hline
0&1&0&\mathbf{0}\\ \hline
0&1&1&\mathbf{1}\\ \hline
1&0&0&\mathbf{0}\\ \hline
1&0&1&\mathbf{1}\\ \hline
1&1&0&\mathbf{0}\\ \hline
1&1&1&\mathbf{1}
\end{array} \]

答案1

您可以使用tikzmark库:您在指定元素中放置一个标记,并使用该标记来绘制/放置元素(代码需要运行两到三次才能使箭头和标签到达其最终位置):

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{tikzmark,shapes.geometric}

\begin{document}
\[
\begin{array}{*{5}{c}|c}
a & b & c & d & e & f\tikzmark{starta} \\
\hline
0 & 0 & 0 & 0 & 0 & 0 \\
0 & 0 & 0 & 0 & 0 & 0\tikzmark{startb}
\end{array}
\]

\begin{tikzpicture}[remember picture,overlay]
\draw[<-]
  ([shift={(4pt,2pt)}]pic cs:starta) -- ++(1cm,0pt) node[anchor=west] {By construction};
\draw[<-,red]
  ([shift={(4pt,4pt)}]pic cs:startb) -- ++(1cm,0pt) node[anchor=west,ellipse,fill=red!30] {By same reason};
\end{tikzpicture}

\end{document}

在此处输入图片描述

相关内容