在公式中绘制括号

在公式中绘制括号

我在这个论坛上还很新。这是我的第一篇帖子。所以我希望我没有违反任何规则之类的。

我的问题是:我有一个方程,其中已经包含图片,因为我想在方程中标记一些东西。现在我想在方程的某些部分下加括号,但即使我更改坐标,也无法将括号放在正确的位置。方程的代码如下。

感谢您的帮助!

\documentclass{scrreprt}
\usepackage{amsmath,bm}
\usepackage{tikz}
\usetikzlibrary{arrows,matrix,positioning,decorations.pathreplacing}

\begin{document}
\begin{equation}
\bm{Bu}=    
    \begin{tikzpicture}[baseline={([yshift=-.5ex]current bounding box.center)},vertex/.style={anchor=base,
    circle,fill=black!25,minimum size=18pt,inner sep=2pt}]  
    \matrix [matrix of math nodes,left delimiter={[},right delimiter={]}] (m)
    {
        0 & 0 & 0 & 0  \\ 
        0 & 0 & 0 & 0  \\ 
        0 & 0 & 0 & 0  \\
        0 & 0 & 0 & 0  \\
        \times & \times & \times & \times  \\ 
        \times & \times & \times & \times  \\ 
        \times & \times & \times & \times  \\ 
        \times & \times & \times & \times  \\
    };
    \draw[color=red] (m-1-3.north west) -- (m-1-3.north east) -- (m-8-3.south east) --              (m-8-3.south west) -- (m-1-3.north west);
    \end{tikzpicture}
    \begin{tikzpicture}[baseline={([yshift=-.5ex]current bounding box.center)},vertex/.style={anchor=base,
    circle,fill=black!25,minimum size=18pt,inner sep=2pt}]
    \matrix [matrix of math nodes,left delimiter=(,right delimiter=)] (m)
    {
    0 \\
    0 \\ 
    \times \\ 
    0 \\
    };
    \draw[color=red] (m-3-1.north west) -- (m-3-1.north east) -- (m-3-1.south east) --              (m-3-1.south west) -- (m-3-1.north west);
    \end{tikzpicture}
    \begin{tikzpicture}
    \draw [thick, black,decorate,decoration={brace,amplitude=10pt,mirror},xshift=0.4pt,yshift=-0.4pt](0,10) -- (10,10) node[black,midway,yshift=-0.6cm] {\footnotesize $Form aus der\\Literatur$};  
    \end{tikzpicture}
    =
    \underbrace{
    \begin{pmatrix}
    0 \\ 0 \\ 0 \\ 0 \\ \times \\ \times \\ \times \\ \times
    \end{pmatrix}
    \times}_{\substack{\text{Ausgabe aus} \\ \text{Simpack}}}
\label{eq:problem-state}
\end{equation}
\end{document}

答案1

我删除了你的 tikz 构造并将其替换为我在 另一个答案一切正常,使用正常\underbrace

\documentclass{scrreprt}
\usepackage{amsmath,bm}
\def\mykern{\kern-\fboxsep\kern-\fboxrule}
\def\cfbox#1{\mykern\smash{\protect\fbox{#1}\mykern}}
\fboxrule=1pt
\begin{document}
\begin{equation}
\bm{Bu}=
\underbrace{
    \left[
\begin{array}{cccc}
    0 & 0 & \cfbox{\protect\rule[-96pt]{0pt}{1pt}$0$} & 0 \\
    0 & 0 & 0  & 0 \\
    0 & 0 & 0  & 0 \\
    0 & 0 & 0  & 0 \\
    \times & \times & \times & \times \\
    \times & \times & \times & \times \\
    \times & \times & \times & \times \\
    \times & \times & \times & \times \\
\end{array}\right]
\left(\begin{array}{c}
    0\\0\\ \cfbox{\protect\rule[0pt]{0pt}{1pt}$\times$}\\0
    \end{array}\right)}_{\footnotesize \text{Form aus der Literatur}}
=\underbrace{\left(\begin{array}{c}
0\\0\\ 0\\0\\\times\\\times\\\times\\\times
\end{array}\right)\times}_{\footnotesize\text{Ausgabe aus Simpack}}
\end{equation}
\end{document}

在此处输入图片描述

答案2

以下解决方案使用您的代码,但进行了一些小的修正。现在两个矩阵都位于同一个图形内,并且也位于下括号内。关键是TikZ将它们正确地对齐到等式内。(m1.west)baseline

\documentclass{scrreprt}
\usepackage{amsmath,bm}
\usepackage{tikz}
\usetikzlibrary{arrows,matrix,positioning,decorations.pathreplacing}

\begin{document}
\begin{equation}
\bm{Bu}=    
\begin{tikzpicture}[baseline=(m1.west),vertex/.style={anchor=base,
    circle,fill=black!25,minimum size=18pt,inner sep=2pt}]  
    \matrix [matrix of math nodes,left delimiter={[},right delimiter={]}] (m1)
    {
        0 & 0 & 0 & 0  \\ 
        0 & 0 & 0 & 0  \\ 
        0 & 0 & 0 & 0  \\
        0 & 0 & 0 & 0  \\
        \times & \times & \times & \times  \\ 
        \times & \times & \times & \times  \\ 
        \times & \times & \times & \times  \\ 
        \times & \times & \times & \times  \\
    };
    \draw[color=red] (m1-1-3.north west) rectangle (m1-8-3.south east);
    \matrix [matrix of math nodes,left delimiter=(,right delimiter=), right= 7mm of m1] (m2)
    {
    0 \\
    0 \\ 
    \times \\ 
    0 \\
    };
    \draw[color=red] (m2-3-1.north west) rectangle (m2-3-1.south east);
    \draw [thick, black,decorate,decoration={brace,amplitude=10pt,mirror}]([shift={(-2mm,-1mm)}]m1.south west) -- ([shift={(2mm,-1mm)}]m1.south-|m2.east) node[black,midway,yshift=-0.7cm, font=\footnotesize, align=center] {Form aus der\\Literatur};  
    \end{tikzpicture}
    =
    \underbrace{
    \begin{pmatrix}
    0 \\ 0 \\ 0 \\ 0 \\ \times \\ \times \\ \times \\ \times
    \end{pmatrix}
    \times}_{\substack{\text{Ausgabe aus} \\ \text{Simpack}}}
\label{eq:problem-state}
\end{equation}
\end{document}

在此处输入图片描述

相关内容