在数组(例如表格)内插入数组(例如模板)

在数组(例如表格)内插入数组(例如模板)

我想在公式旁边的单元格中插入一个(例如一个)里面的(例如一个array模板)。有什么办法吗?arraytabular

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

在此处输入图片描述

相关内容