7

enter image description here

The above fraction is what I would like to achieve

What I have so far is

$ \begin{bmatrix}
0 \\
0 \\
1 \\
1 
\end{bmatrix}   - \frac{ \begin{bmatrix}
0 & 0 & 1 & 1 
\end{bmatrix}  \begin{bmatrix}
1 \\
1 \\
1 \\
1 
\end{bmatrix}}{\begin{bmatrix}
1 & 1 & 1 & 1 
\end{bmatrix}  \begin{bmatrix}
1 \\
1 \\
1 \\
1 
\end{bmatrix} }$

and it looks like this

enter image description here

How can I achieve my desired result?

7
  • 2
    You also get several errors from that input.
    – egreg
    Nov 14, 2018 at 17:09
  • what are the errors? my code compiles so I didn't notice any errors
    – user130306
    Nov 14, 2018 at 17:16
  • The second $ causes TeX to leave math mode before your equation is finished. You should put it all the way at the end (after \end{bmatrix} }). You may want to instead use \[...\] or \begin{equation}...\end{equation}instead of $...$ since this looks like a display equation rather than an inline equation. Nov 14, 2018 at 17:20
  • 2
    The fixed code compiles normally and has the expected result for me.
    – Bernard
    Nov 14, 2018 at 17:25
  • 1
    yes I know, I corrected the misplaced $ and got my desired outcome so my question no longer needs an answer
    – user130306
    Nov 14, 2018 at 18:27

2 Answers 2

10

You could use the bsmallmatrix environment, provided by the mathtools package, to render the row and column vectors in the \frac expression more compactly.

enter image description here

\documentclass{article}
\usepackage{mathtools}
\begin{document}
\[
\begin{bmatrix}
  0 \\ 0 \\ 1 \\ 1 
\end{bmatrix}   
- \frac{ 
\begin{bsmallmatrix}
  0 & 0 & 1 & 1 
\end{bsmallmatrix}  
\begin{bsmallmatrix}
  1 \\ 1 \\ 1 \\ 1 
\end{bsmallmatrix}}{%
\begin{bsmallmatrix}
  1 & 1 & 1 & 1 
\end{bsmallmatrix}  
\begin{bsmallmatrix}
  1 \\ 1 \\ 1 \\ 1 
\end{bsmallmatrix} }
\begin{bmatrix}
  1 \\ 1 \\ 1 \\ 1 
\end{bmatrix} 
\]
\end{document}
10
\documentclass{article}
\usepackage{tabstackengine}
\stackMath
\newcommand\Frac[2]{\frac{\addstackgap{#1}}{\addstackgap{#2}}}
\begin{document}
\[
  \setstacktabbedgap{1ex}
  \bracketVectorstack{0\\0\\1\\1} -
  \Frac{
    \bracketMatrixstack{0&0&1&1}\bracketVectorstack{1\\1\\1\\1}
  }{
    \bracketMatrixstack{1&1&1&1}\bracketVectorstack{1\\1\\1\\1}
  }
  \bracketVectorstack{1\\1\\1\\1}
\]
\end{document}

enter image description here

The smaller size of \Frac is also possible, with a small redefinition:

\documentclass{article}
\usepackage{tabstackengine}
\stackMath
\newcommand\Frac[2]{{%
  \setstackgap{L}{.7\normalbaselineskip}\TABstackMathstyle{\scriptstyle}%
  \frac{\addstackgap{#1}}{\addstackgap{#2}}%
}}
\begin{document}
\[
  \setstacktabbedgap{1ex}
  \bracketVectorstack{0\\0\\1\\1} -
  \Frac{
    \bracketMatrixstack{0&0&1&1}\bracketMatrixstack{1\\1\\1\\1}
  }{
    \bracketMatrixstack{1&1&1&1}\bracketMatrixstack{1\\1\\1\\1}
  }
  \bracketVectorstack{1\\1\\1\\1}
\]
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .