我想在公式旁边的单元格中插入一个(例如一个)里面的(例如一个array
模板)。有什么办法吗?array
tabular
\documentclass[a4paper, 12pt]{book}
\usepackage{amssymb, amsmath,mathtools, tikz}
\newcommand{\stencilpt}[4][]{\node[circle,draw,inner sep=0.1em,minimum size=0.8cm,font=\tiny,#1] at (#2) (#3) {#4}}
\begin{document}
\begin{center}
\begin{tabular}{ |l|c| }
\hline
backward approximation & $f'(t) \approx \frac{f(t) - f(t-h)}{h}+ O(h)$\\ \hline
\end{tabular}
\end{center}
\begin{tikzpicture}
\stencilpt{ 0,0}{i} {$\frac{-1}{h}$};
\stencilpt{ 1,0}{i+1}{$\frac{1}{h}$};
\draw
(i) -- (i+1);
\end{tikzpicture}
\end{document}
答案1
在序言中添加一个新列tabular
,并将tikzpicture
环境放在适当的单元格中:
\documentclass[a4paper, 12pt]{book}
\usepackage{amssymb, amsmath,mathtools, tikz}
\newcommand{\stencilpt}[4][]{\node[circle,draw,inner sep=0.1em,minimum size=0.8cm,font=\tiny,#1] at (#2) (#3) {#4}}
\begin{document}
\begin{center}
\begin{tabular}{|l |l|c| }
\hline
backward approximation & $f'(t) \approx \frac{f(t) - f(t-h)}{h}+ O(h)$ &\begin{tikzpicture}[baseline=(i)]
\stencilpt{ 0,0}{i} {$\frac{-1}{h}$};
\stencilpt{ 1,0}{i+1}{$\frac{1}{h}$};
\draw
(i) -- (i+1);
\end{tikzpicture}\\ \hline
\end{tabular}
\end{center}
\end{document}