5

I'm sorry I don't exactly know how to word the question, a figure should show what I want. Here's what I have enter image description here

And here's what I want enter image description here

M_f is a matrix whose components are not determined so I just want to write it's name inside the system.

Here's the code

\documentclass[a4paper,12pt,twoside,openright]{report}
\usepackage{amsmath}
\usepackage{arydshln}

\begin{document}

\begin{equation}
\renewcommand{\arraystretch}{1.4}
\left[
\begin{array}{c;{2pt/2pt} c c}
 M_s &  & \\ \hdashline[2pt/2pt]
 & \matr{M}_f & \\
-\rho &  &
\end{array}
\right] \left[
\begin{array}{c}
\ddot{u} \\ \hdashline[2pt/2pt]
p_1 \\
p_2
\end{array}
\right]
\end{equation}

\end{document}

Thank you for your help.

And also if someone can advice me how to change the thickness of the dashed lines in the matrix, I tried changing the pt but what happens is that only the thickness change and not the the width. I can't post a third image since I only have 10 reputation points to show you the difference.

  • Please provide an MWE that starts from \documentclass – Michael Fraiman Jun 7 '17 at 19:24
  • What does the \matr command do? – Bernard Jun 7 '17 at 20:12
  • @Bernard Sorry I forgot to specify it, it's a function I made to bold out a letter, I made it when I started using latex and I got used to it instead of switching to the available functions. – Mr. Pi Jun 8 '17 at 20:31
2

Nest an array:

\documentclass[a4paper,12pt,twoside,openright]{report}
\usepackage{amsmath}
\usepackage{arydshln}

\begin{document}

\begin{equation}
\renewcommand{\arraystretch}{1.4}
\left[\begin{array}{@{}c;{2pt/1pt}c@{}}
  M_s  & \\
\hdashline[2pt/1pt]
\begin{array}{@{}c@{}} \\ -\rho\end{array} & \mathbf{M}_f \\
\end{array}\right]
\!
\left[\begin{array}{c}
  \ddot{u} \\
\hdashline[2pt/2pt]
  p_1      \\
  p_2
\end{array}
\right]
\end{equation}

\end{document}

enter image description here

I'd avoid those ugly dashed lines, though:

\documentclass[a4paper,12pt,twoside,openright]{report}
\usepackage{amsmath}

\begin{document}

\begin{equation}
\renewcommand{\arraystretch}{1.4}
\left[\begin{array}{@{}c|c@{}}
  M_s  & \\
\hline
\begin{array}{@{}c@{}} \\ -\rho\end{array} & \mathbf{M}_f \\
\end{array}\right]
\! 
\left[\begin{array}{c}
  \ddot{u} \\
\hline
  p_1      \\
  p_2
\end{array}
\right]
\end{equation}

\end{document}

enter image description here

If you want the left matrix has three equal columns, you can add phantoms:

\documentclass[a4paper,12pt,twoside,openright]{report}
\usepackage{amsmath}

\begin{document}

\begin{equation}
\renewcommand{\arraystretch}{1.4}
\left[\begin{array}{@{}c|cc@{}}
  M_s  & \hphantom{-\rho} & \hphantom{-\rho}\\
\hline
\begin{array}{@{}c@{}} \\ -\rho\end{array} &
 \multicolumn{2}{c}{\mathbf{M}_f} \\
\end{array}\right]
\! 
\left[\begin{array}{c}
  \ddot{u} \\
\hline
  p_1      \\
  p_2
\end{array}
\right]
\end{equation}

\end{document}

enter image description here

  • It looks to me like the OP also wants the block with the M_f in to appear two columns wide, not just one? – Peter LeFanu Lumsdaine Jun 7 '17 at 20:30
  • 1
    @PeterLeFanuLumsdaine Added – egreg Jun 7 '17 at 20:45
2

Use the \multirow command from the multirow package to combine two rows for the matrix M_f.

\documentclass[a4paper,12pt,twoside,openright]{report}
\usepackage{amsmath,multirow}
\usepackage{arydshln}

\begin{document}

\begin{equation}
\renewcommand{\arraystretch}{1.4}
\left[\begin{array}{c;{2pt/1pt}c}
     M_s  &                                 \\ \hdashline[2pt/1pt]
          & \multirow{2}{*}{$\mathbf{M}_f$} \\
    -\rho &              
\end{array}\right] 
\left[\begin{array}{@{}c@{}}
    \ddot{u} \\ \hdashline[2pt/1pt]
    p_1      \\
    p_2
\end{array}
\right]
\end{equation}

\end{document}

enter image description here

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.