4

I am pretty new in this forum. It's my first post. So I hope I don't break any rules or so.

My Question is: I have an equation, which contains already a pics, because I wanted to mark some stuff in my equation. Now I want to underbrace some parts of my equation but I can't put the brace on the right spot, even if I change the coordinates. The code for the equation is given below.

Thank You for your help!

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

I removed your tikz constructs and replaced them with something I found in another answer and everything worked fine by using the normal \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}

enter image description here

| improve this answer | |
  • It looks really neat, the only thing I would like to change is to put the Matrix in square brackets. I can't find a was to do that. – Toggo May 4 '16 at 8:46
  • Oh yes, I changed it. The matrix is now more intuitiv set using array. – BenjaminH May 4 '16 at 8:48
3

Following solution uses your TikZ code but with some minor corrections. Now both matrices are inside the same figure and also the lower braces. To correctly align them inside the equation, (m1.west) is the baseline point.

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

enter image description here

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.